-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (40 loc) · 1.2 KB
/
go-test.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
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Go Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch: # Allows manual trigger
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Run Tests and Count
run: |
cd go-app
# Run tests and store the pass/fail status
go test -v ./... 2>&1 | tee test_output.txt
TEST_COUNT=$(grep -c "^=== RUN" test_output.txt)
echo "TEST_COUNT=$TEST_COUNT" >> $GITHUB_ENV
- name: Test Coverage
run: |
cd go-app
go test -race -coverprofile=coverage.out -covermode=atomic ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./go-app/coverage.out
- name: Create Test Count Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: ${{ secrets.DYNA_GIST_ID }}
filename: minion-testresults.json
label: tests
message: ${{ env.TEST_COUNT }} passed
color: green