Skip to content

Commit 3ba62c7

Browse files
Enhance GitHub Actions workflow by adding a test job that installs dependencies, runs tests, and uploads coverage to Codacy, while updating the release job dependencies to include integration tests.
1 parent 7721868 commit 3ba62c7

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

.github/workflows/go.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,26 @@ jobs:
3030
cli-v2-macos
3131
3232
test:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
- name: Set up Go
38+
uses: actions/setup-go@v4
39+
- name: Install dependencies from .codacy/codacy.yaml
40+
run: |
41+
go build ./cli-v2.go
42+
./cli-v2 install
43+
- name: "Run tests"
44+
run: |
45+
go test -coverprofile=unit.coverage.out ./...
46+
- name: "Upload coverage to Codacy"
47+
env:
48+
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
49+
run: |
50+
bash <(curl -Ls https://coverage.codacy.com/get.sh) report --force-coverage-parser go -r unit.coverage.out
51+
52+
ittest:
3353
needs: build
3454
runs-on: ${{ matrix.os }}
3555
strategy:
@@ -61,7 +81,7 @@ jobs:
6181
./cli-v2 install
6282
6383
release:
64-
needs: test
84+
needs: [test, ittest]
6585
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.event_name == 'push'
6686
runs-on: ubuntu-latest
6787
steps:

0 commit comments

Comments
 (0)