Sharing logs via slog #179
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 ] | |
# 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: | |
tidy: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go-version: [ '1.21.x' ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go ${{ matrix.go-version }} | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: tidy | |
run: | | |
go mod tidy | |
go mod verify | |
git status | |
if [[ -n "$(git status --porcelain .)" ]]; then | |
echo 'go.mod/go.sum is out-of-date: run `go mod tidy` in the right module directories (see git status) and then check in the changes' | |
echo 'If `go mod tidy` results in no changes, make sure you are using the latest relase of Go' | |
git status --porcelain . | |
exit 1 | |
fi | |
- name: gofmt | |
run: test -z "$(gofmt -s -l $(find -name '*.go'))" | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go-version: [ '1.21.x' ] | |
goos: ['darwin', 'freebsd', 'linux'] | |
goarch: ['arm64', 'amd64'] | |
include: | |
- go-version: 1.21.x | |
goos: linux | |
goarch: riscv64 | |
- go-version: 1.21.x | |
goos: linux | |
goarch: arm | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
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 ./... | |
- name: Build tools | |
run: cd ./tools/runvmtest && go build | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go-version: [ '1.21.x' ] | |
vmarch: [ 'amd64', 'arm64', 'riscv64' ] | |
goarm: [''] | |
include: | |
# QEMU arm -M virt seems to support only v5. GOARM default as of 1.21 | |
# is v7. | |
- go-version: '1.21.x' | |
vmarch: 'arm' | |
goarm: '5' | |
env: | |
VMTEST_ARCH: ${{ matrix.vmarch }} | |
GOARM: ${{ matrix.goarm }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go ${{ matrix.go-version }} | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Build runvm tool | |
run: (cd ./tools/runvmtest && go build) | |
- name: Test | |
run: | | |
./tools/runvmtest/runvmtest -- \ | |
go test -v -coverprofile=coverage.txt -covermode=atomic -coverpkg=./... ./... | |
- uses: codecov/codecov-action@v4-beta | |
env: | |
CODECOV_TOKEN: '6793138f-7113-4561-aa24-08bdd9111678' | |
with: | |
flags: ${{ matrix.vmarch }}-${{ matrix.go-version }} | |
fail_ci_if_error: true | |
verbose: true |