add coverage step #16
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: Build | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go-version: [ '1.21' ] | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go ${{ matrix.go-version }} | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Display Go version | |
run: go version | |
- name: Build | |
run: go build -mod vendor -v ./... | |
- name: Test | |
run: go test -mod vendor -race -v ./... | |
# - name: Update coverage report | |
# uses: ncruces/go-coverage-report@v0 | |
# with: | |
# report: 'true' | |
# chart: 'true' | |
# amend: 'false' | |
# if: | | |
# matrix.go-version == '1.21' && | |
# github.event_name == 'push' | |
# continue-on-error: true | |
- name: Create coverage report | |
run: go test -mod vendor -coverprofile=coverage.txt -v ./... | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |