Do not build local os/arch when crossbuilding #224
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: [master] | |
pull_request: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-22.04 | |
permissions: | |
id-token: write | |
contents: read | |
attestations: write | |
strategy: | |
matrix: | |
go: ["1.22"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
filter: tree:0 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/go-build | |
~/.cache/golangci-lint | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
${{ runner.os }}-go- | |
- name: Set up Go ${{ matrix.go }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
cache: false | |
id: go | |
- name: Setup docker QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Setup docker buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Verify go mod | |
run: make go-mod-verify | |
- name: Lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
args: --timeout=10m | |
skip-cache: true | |
- name: Test | |
run: make test | |
- name: Crossbuild | |
run: make crossbuild | |
- name: Build docker image | |
run: | | |
make docker-buildx-build | |
- uses: actions/attest-build-provenance@v1 | |
with: | |
subject-path: | | |
dist/*-darwin-amd64* | |
dist/*-darwin-arm64* | |
dist/*-linux-amd64* | |
dist/*-linux-arm64* | |
dist/*-windows-amd64* | |
dist/*-windows-arm64* | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build | |
retention-days: 3 | |
path: | | |
dist/*-darwin-amd64* | |
dist/*-darwin-arm64* | |
dist/*-linux-amd64* | |
dist/*-linux-arm64* | |
dist/*-windows-amd64* | |
dist/*-windows-arm64* |