Skip to content

Commit

Permalink
Add multi-dimension matrix cross-compile build job
Browse files Browse the repository at this point in the history
to check whether building would work for the various OSes
and architectures in particular.
Testing still needs to use the host's native config of course.
  • Loading branch information
kaiburjack committed Aug 18, 2022
1 parent 4da9b24 commit f8ead53
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,44 @@ on:
pull_request:
branches: [ main ]
jobs:
build:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.17', '1.18', '1.19' ]
name: Go ${{ matrix.go }} build
name: lint
steps:
- uses: actions/checkout@master
- uses: reviewdog/action-golangci-lint@v2
with:
fail_on_error: true
go_version: ${{ matrix.go }}
- run: |
gofmt -l . && test -z $(gofmt -l .)
go vet .
go install github.com/mgechev/revive@latest
revive -config revive.toml .
- run: go build -v .
build:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.17', '1.18', '1.19' ]
os: [ 'windows', 'linux' ]
arch: [ 'amd64', 'arm64' ]
name: Go ${{ matrix.go }}-${{ matrix.os }}-${{ matrix.arch }} build
steps:
- uses: actions/checkout@master
- uses: reviewdog/action-golangci-lint@v2
with:
fail_on_error: true
go_version: ${{ matrix.go }}
- run: GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -v .
test:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.17', '1.18', '1.19' ]
name: Go ${{ matrix.go }} test
steps:
- uses: actions/checkout@master
- uses: reviewdog/action-golangci-lint@v2
with:
fail_on_error: true
go_version: ${{ matrix.go }}
- run: go test -v .

0 comments on commit f8ead53

Please sign in to comment.