-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (29 loc) · 850 Bytes
/
go.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: build
on:
push:
branches:
- '**'
jobs:
test-and-coverage:
name: Test and Upload Coverage to Codacy
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '^1.21' # Set the Go version as per your project requirement
- name: Test and Generate Coverage Report
run: |
mkdir -p .coverage
if ! go test -v -coverprofile=.coverage/cover.out ./...; then
echo "Test failed."
exit 1
fi
- name: Codacy Coverage Reporter
if: success()
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
run: |
bash <(curl -Ls https://coverage.codacy.com/get.sh) report --force-coverage-parser go -r .coverage/cover.out