Update CI config (#27) #82
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: | |
push: | |
branches: [main] # pushes TO main | |
pull_request: | |
branches: [main] # pull requests AGAINST main | |
# cancel CI runs when a new commit is pushed to any branch except main | |
concurrency: | |
group: "test-${{ github.ref }}" | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
jobs: | |
test: | |
name: test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go-version: | |
- '1.21' | |
- '1.20' | |
- '1.19' | |
steps: | |
- name: setup | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{matrix.go-version}} | |
- name: checkout | |
uses: actions/checkout@v4 | |
- id: go-cache-paths | |
run: | | |
echo "::set-output name=go-build::$(go env GOCACHE)" | |
echo "::set-output name=go-mod::$(go env GOMODCACHE)" | |
- name: cache build | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.go-cache-paths.outputs.go-build }} | |
key: ${{ runner.os }}-go-${{ matrix.go-version }}-build-${{ hashFiles('**/go.sum') }} | |
- name: cache mod | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.go-cache-paths.outputs.go-mod }} | |
key: ${{ runner.os }}-go-${{ matrix.go-version }}-mod-${{ hashFiles('**/go.sum') }} | |
- name: test | |
run: make testci | |
- name: report code coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage.out | |
if: ${{ matrix.go-version == '1.21' }} |