Skip to content

Merge pull request #516 from ForestJohnson/ForestJohnson-patch-1 #565

Merge pull request #516 from ForestJohnson/ForestJohnson-patch-1

Merge pull request #516 from ForestJohnson/ForestJohnson-patch-1 #565

Workflow file for this run

name: Tests
on: [push, pull_request]
jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
go: ['1.20', '1.21']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- name: run unit tests
run: |
go get -v -t ./...
echo "" > "${GITHUB_WORKSPACE}"/coverage.txt
for d in $(go list ./...); do
go test -v -race -coverprofile=profile.out -covermode=atomic "${d}"
if [ -f profile.out ]; then
cat profile.out >> "${GITHUB_WORKSPACE}"/coverage.txt
rm profile.out
fi
done
- name: report coverage to codecov
uses: codecov/codecov-action@v3
integration-tests:
runs-on: ubuntu-latest
strategy:
matrix:
go: ['1.20', '1.21']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- name: run integ tests
run: |
go get -v -t -tags=integration ./...
echo "" > "${GITHUB_WORKSPACE}"/coverage.txt
for d in $(go list -tags=integration ./...); do
go test -c -tags=integration -v -race -coverprofile=profile.out -covermode=atomic "${d}"
testbin="./$(basename $d).test"
# only run it if it was built - i.e. if there are integ tests
test -x "${testbin}" && sudo "./${testbin}"
if [ -f profile.out ]; then
cat profile.out >> "${GITHUB_WORKSPACE}"/coverage.txt
rm profile.out
fi
done
- name: report coverage to codecov
uses: codecov/codecov-action@v3