Go #314
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: Go | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
schedule: | |
# Every day at 8am. | |
- cron: "0 8 * * *" | |
# Cancel running workflows on new push to a PR. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
cross_build: | |
name: Cross-platform builds | |
strategy: | |
matrix: | |
go-version: ['1.21.x', '1.22.x'] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go ${{ matrix.go-version }} | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Cross-compile | |
run: ./cross-compile.sh | |
build_and_test: | |
name: Build and test | |
strategy: | |
matrix: | |
go-version: ['1.21.x', '1.22.x'] | |
platform: [ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go ${{ matrix.go-version }} | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Build | |
run: go build -v ./... | |
- name: Test | |
run: go test -v -covermode atomic -coverpkg ./... -coverprofile cover.out ./... | |
- name: Convert GOCOVERDIR coverage data | |
run: go tool covdata textfmt -i=cmd/mkuimage/cover -o cmdcover.out | |
- uses: codecov/codecov-action@v4-beta | |
env: | |
CODECOV_TOKEN: '804457b0-03f8-4cf6-bc99-eaf43399177b' | |
with: | |
flags: ${{ matrix.platform }}-unit | |
fail_ci_if_error: true | |
verbose: true | |
files: cover.out,cmdcover.out | |
race: | |
name: Race test | |
strategy: | |
matrix: | |
go-version: ['1.21.x', '1.22.x'] | |
platform: [ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go ${{ matrix.go-version }} | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Race | |
run: go test -race -v ./... |