CI: upload coverage using codecov-action@v4 #34
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, pull_request ] | |
jobs: | |
test: | |
strategy: | |
matrix: | |
go-version: | |
- 1.22.x | |
- 1.21.x | |
- 1.20.x | |
- 1.19.x | |
- 1.18.x | |
- 1.17.x | |
- 1.16.x | |
- 1.15.x | |
- 1.14.x | |
- 1.13.x | |
- 1.12.x | |
- 1.11.x | |
- 1.10.x | |
- 1.9.x | |
- 1.8.x | |
os: | |
- ubuntu-latest | |
- macos-latest | |
exclude: | |
# Old Go releases fail on recent MacOS. | |
- os: macos-latest | |
go-version: 1.10.x | |
- os: macos-latest | |
go-version: 1.9.x | |
- os: macos-latest | |
go-version: 1.8.x | |
#arch: | |
# - amd64 | |
# - ppc64le | |
# - s390x | |
# - arm64 | |
runs-on: ${{ matrix.os }} | |
env: | |
GOPATH: ${{ github.workspace }} | |
GO111MODULE: on | |
defaults: | |
run: | |
working-directory: ${{ env.GOPATH }}/src/github.com/${{ github.repository }} | |
steps: | |
# https://github.com/mvdan/github-actions-golang | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }} | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Check Import path | |
run: GO111MODULE=off go list # Verify that go_import_path is ok for go < 1.11 | |
- name: Install dependencies | |
shell: bash | |
# Fetch dependencies: | |
# - go < 1.11: | |
# - go get -v -t ./... | |
# - go get -v -t -tags generate ./... | |
# - go >= 1.11: | |
# - go list -mod=readonly -test | |
# - go list -mod=readonly -tags generate | |
run: "case \"$(go version)\" in (*' go1.'[02-9]*|*' go1.10.'*) go get -t -v ./... && go get -v -tags generate ./... ;; (*) go list -mod=readonly -test && go list -mod=readonly -tags generate ;; esac" | |
- name: Test | |
run: go test -coverprofile=coverage.txt -covermode=atomic | |
- name: Upload coverage to Codecov.io | |
# https://github.com/codecov/codecov-action | |
# https://docs.codecov.com/docs/quick-start | |
uses: codecov/codecov-action@v4 | |
with: | |
# https://app.codecov.io/gh/dolmen-go/endian/settings | |
# https://github.com/dolmen-go/endian/settings/secrets/actions | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: go vet | |
shell: bash | |
run: go vet | |
- name: go vet, for generators | |
shell: bash | |
run: go vet -tags generate |