Debian Codegraph @

.github/workflows/tests.yml

raw
1 name: Tests
2
3 on: [push, pull_request]
4
5 jobs:
6 unit-tests:
7 runs-on: ubuntu-latest
8 strategy:
9 matrix:
10 go: ['1.23', '1.24']
11 steps:
12 - uses: actions/checkout@v4
13 - uses: actions/setup-go@v4
14 with:
15 go-version: ${{ matrix.go }}
16 - name: run unit tests
17 run: |
18 go get -v -t ./...
19 echo "" > "${GITHUB_WORKSPACE}"/coverage.txt
20 for d in $(go list ./...); do
21 go test -v -race -coverprofile=profile.out -covermode=atomic "${d}"
22 if [ -f profile.out ]; then
23 cat profile.out >> "${GITHUB_WORKSPACE}"/coverage.txt
24 rm profile.out
25 fi
26 done
27 - name: report coverage to codecov
28 uses: codecov/codecov-action@v3
29 integration-tests:
30 runs-on: ubuntu-latest
31 strategy:
32 matrix:
33 go: ['1.23', '1.24']
34 steps:
35 - uses: actions/checkout@v4
36 - uses: actions/setup-go@v4
37 with:
38 go-version: ${{ matrix.go }}
39 - name: run integ tests
40 run: |
41 go get -v -t -tags=integration ./...
42 echo "" > "${GITHUB_WORKSPACE}"/coverage.txt
43 for d in $(go list -tags=integration ./...); do
44 go test -c -tags=integration -v -race -coverprofile=profile.out -covermode=atomic "${d}"
45 testbin="./$(basename $d).test"
46 # only run it if it was built - i.e. if there are integ tests
47 test -x "${testbin}" && sudo "./${testbin}"
48 if [ -f profile.out ]; then
49 cat profile.out >> "${GITHUB_WORKSPACE}"/coverage.txt
50 rm profile.out
51 fi
52 done
53 - name: report coverage to codecov
54 uses: codecov/codecov-action@v3