Set up Code Coverage using Codecov and Added badges #100
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
on: | |
# This is configured to run on pull requests. If desired you can change it to run on all pushes. | |
# be aware that windows and MacOS takes can take a while for setup and both of them incur extra expense for Actions. | |
pull_request: | |
# this will allow the tests to be run on demand | |
workflow_dispatch: | |
name: Test on all platforms | |
env: | |
GO_VERSION: 1.23 | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Test with coverage | |
run: go test -coverprofile=coverage.out ./... | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.out | |
flags: platform-tests | |
name: Codecov Platform Tests | |
fail_ci_if_error: true |