From f40d03a12dd2513de39845ca2905b028865f514a Mon Sep 17 00:00:00 2001 From: gagliardetto Date: Wed, 14 Jun 2023 16:40:18 +0000 Subject: [PATCH 1/3] Add tests workflow --- .github/workflows/build-release.yml | 35 ++++++++++++++++------------- .github/workflows/tests.yml | 18 +++++++++++++++ 2 files changed, 37 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index b75b4c9e..61a1c997 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -11,22 +11,25 @@ jobs: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 + - uses: actions/checkout@v3 + with: + fetch-depth: 0 - - name: Setup go env - uses: actions/setup-go@v3 - with: - go-version: '1.20' - check-latest: true + - name: Setup go env + uses: actions/setup-go@v3 + with: + go-version: '1.20' + check-latest: true - - name: Build cli - run: make + - name: Build cli + run: make compile-all - - name: Publish to release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: | - bin/faithful-cli + - name: Publish to release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + bin/darwin/amd64/faithful-cli_darwin_amd64 + bin/darwin/arm64/faithful-cli_darwin_arm64 + bin/linux/amd64/faithful-cli_linux_amd64 + bin/windows/amd64/faithful-cli_windows_amd64.exe diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..ddbd7e6d --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,18 @@ +on: [pull_request] +name: tests +jobs: + test: + strategy: + matrix: + go-version: [1.20.x] + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: Checkout code + uses: actions/checkout@v2 + - name: Test + run: go test ./... From a15a4e338ee93fdf983ff4ea39c1a9eba6d7fb01 Mon Sep 17 00:00:00 2001 From: gagliardetto Date: Wed, 14 Jun 2023 16:43:03 +0000 Subject: [PATCH 2/3] Build release only on push to main --- .github/workflows/build-release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 61a1c997..bb48538d 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -1,10 +1,9 @@ name: main on: - pull_request: push: tags: - - '*' + - "v*.*.*" jobs: build: From 464a36fb0a9158fcaf8854bb2a226e30de963dc6 Mon Sep 17 00:00:00 2001 From: gagliardetto Date: Wed, 14 Jun 2023 16:46:04 +0000 Subject: [PATCH 3/3] Set fetch-depth --- .github/workflows/tests.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ddbd7e6d..3e2f091c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,10 +9,12 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Install Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: ${{ matrix.go-version }} - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Test run: go test ./...