This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (52 loc) · 1.64 KB
/
go-tests.yaml
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Go Tests
on:
push:
branches: ["main", "master"]
pull_request:
branches: ["main", "master", "release-*"]
jobs:
test:
name: Go Tests
strategy:
matrix:
go-version: ["1.20"]
platform: ["ubuntu-latest"]
runs-on: ${{ matrix.platform }}
timeout-minutes: 10
steps:
- name: Check out Code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Install tparse
run: go install github.com/mfridman/tparse@latest
- name: Check for .codecov.yaml
id: codecov-enabled
uses: andstor/file-existence-action@v2
with:
files: .codecov.yaml
- if: steps.codecov-enabled.outputs.files_exists == 'true'
name: Enable Go Coverage
run: echo 'COVER_OPTS=-coverprofile=coverage.txt -covermode=atomic' >> $GITHUB_ENV
- name: Test
env:
GOFLAGS: "-v -race -count=1 -json"
run: go test $COVER_OPTS ./... | tparse -all -notests -format markdown >> $GITHUB_STEP_SUMMARY
- name: Verify git clean
shell: bash
run: |
if [[ -z "$(git status --porcelain)" ]]; then
echo "${{ github.repository }} up to date."
else
echo "${{ github.repository }} is dirty."
echo "::error:: $(git status)"
exit 1
fi
- if: steps.codecov-enabled.outputs.files_exists == 'true'
name: Produce Codecov Report
uses: codecov/codecov-action@v3