Repository navigation
ci: test and run the binary on arm64; arm64-first builds #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,41 @@ permissions: | |
| contents: read | ||
|
|
||
| jobs: | ||
| # The same code on arm64, natively: release.go publishes darwin/arm64 and | ||
| # linux/arm64 binaries, and they are cross-compiled on amd64, so without this job | ||
| # neither the tests nor the binary would ever run on arm64. GitHub-hosted, free for | ||
| # public repositories: ubuntu-24.04-arm is Linux on arm64, macos-latest Apple | ||
| # Silicon. Only what depends on the architecture runs here; the other gates are | ||
| # the same everywhere and run once, in release. | ||
| arm64: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-24.04-arm, macos-latest] | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | ||
| with: | ||
| go-version: '1.26' | ||
| check-latest: true | ||
|
|
||
| - name: go test | ||
| run: go test ./... -race | ||
|
|
||
| - name: run the binary | ||
| run: | | ||
| go build -trimpath -o awless-ro . | ||
| echo "built for $(go env GOOS)/$(go env GOARCH) on $(uname -sm)" | ||
| ./awless-ro version | ||
| ./awless-ro --help > /dev/null | ||
|
|
||
| release: | ||
| # arm64 artefacts are published only once their tests and binary have run on | ||
| # arm64. | ||
| needs: arm64 | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good, nothing gets published before arm64 passes. Side effect: a release now waits on |
||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| # To create the release and attach the artefacts. Nothing else. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,13 @@ generate: | |
| @echo "Generating commands code: runtime, doc, etc." | ||
| @go generate gen/aws/generators/main.go | ||
|
|
||
| # arm64 by default: Apple Silicon and Graviton are the machines this is built for. | ||
| # Override for anything else, e.g. `make build GOARCH=amd64`, or with GOARCH in the | ||
| # environment. Only the binary is cross-built: make would otherwise export GOARCH to | ||
| # every recipe, and generate and test have to run on the host. | ||
| GOARCH ?= arm64 | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One thing to be aware of: on an amd64 machine |
||
| unexport GOARCH | ||
|
|
||
| build: generate test | ||
| @echo "Building application binary" | ||
| @go build -trimpath -o awless-ro | ||
| @echo "Building application binary for $$(go env GOOS)/$(GOARCH)" | ||
| @GOARCH=$(GOARCH) go build -trimpath -o awless-ro | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This job is the same block as the one in release.yml, copy for copy. It's short, so OK for now, but the two will drift (someone bumps setup-go or adds a step in one and forgets the other). If we touch it again, a small reusable workflow would fix that.