Merge pull request #224 from arnested/go-version-update #354
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: | |
- push | |
name: Build and test | |
permissions: | |
contents: read | |
jobs: | |
go-versions: | |
name: Lookup go versions | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.versions.outputs.matrix }} | |
minimal: ${{ steps.versions.outputs.minimal }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: arnested/go-version-action@v1 | |
id: versions | |
go_generate: | |
name: Check generated code is up to date | |
runs-on: ubuntu-latest | |
needs: go-versions | |
env: | |
workdir: go/src/github.com/arnested/ssh2iterm2 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: ${{env.workdir}} | |
- name: Setup Go ${{ needs.go-versions.outputs.minimal }} | |
uses: WillAbides/setup-go-faster@v1.14.0 | |
with: | |
go-version: ${{ needs.go-versions.outputs.minimal }} | |
ignore-local: true | |
- name: Go version | |
run: go version | |
build_and_test: | |
name: Build and test | |
runs-on: macos-latest | |
needs: go-versions | |
strategy: | |
matrix: | |
go-version: ${{ fromJSON(needs.go-versions.outputs.matrix) }} | |
goarch: ["amd64", "arm64"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go$ {{ matrix.go-version }} | |
uses: WillAbides/setup-go-faster@v1.14.0 | |
with: | |
go-version: ${{ matrix.go-version }}.x | |
ignore-local: true | |
- name: Go version | |
run: go version | |
- name: go test | |
env: | |
GOOS: darwin | |
GOARCH: ${{ matrix.goarch }} | |
# We enable cgo to be able to test with `-race`. | |
CGO_ENABLED: 1 | |
run: go test -v -race -cover -covermode=atomic -coverprofile=coverage.txt ./... | |
- name: Upload coverage report to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
flags: go${{ matrix.go-version }} |