Skip to content

add coverage step

add coverage step #16

Workflow file for this run

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 }}