Skip to content
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

add arm support #83

Merged
merged 5 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
jobs:
build:
runs-on: ubuntu-20.04
strategy:
matrix:
arch: [amd64, arm64]
steps:
- uses: actions/checkout@v4

Expand All @@ -17,6 +20,11 @@ jobs:
with:
go-version: "1.22"

- name: Set environment variables for architecture
run: |
echo "GOARCH=${{ matrix.arch }}" >> $GITHUB_ENV
echo "GOOS=linux" >> $GITHUB_ENV

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
Expand Down
34 changes: 31 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,45 @@ on:

jobs:
build:
name: Build and release image
name: Build and release binaries
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64]
steps:
- uses: actions/checkout@v4

- run: docker login -u "${{ secrets.QUAY_IO_USER }}" -p "${{ secrets.QUAY_IO_TOKEN }}" quay.io

unclesamwk marked this conversation as resolved.
Show resolved Hide resolved
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"

- name: Set environment variables for architecture
run: |
echo "GOARCH=${{ matrix.arch }}" >> $GITHUB_ENV
echo "GOOS=linux" >> $GITHUB_ENV

- name: Build binaries for ${{ matrix.arch }}
run: |
mkdir -p dist
go build -o dist/myapp-${{ matrix.arch }} .

- name: Upload binaries
uses: actions/upload-artifact@v3
with:
name: binaries-${{ matrix.arch }}
path: dist/myapp-${{ matrix.arch }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Goreleaser already builds the binaries and images for all required architectures. A separate Github matrix build is not necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i means that the change is obsolet? Can you help me please to finish adding arm build support?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depends; if you only need the binaries, your additional entry in .goreleaser.yml is sufficient. If you need a multi-arch Docker image, this would be a bit more work (look at the .goreleaser.yml of the mittwald/kubernetes-replicator project for reference).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i only need arm64 binary, i reverted other changes


release:
name: Release binaries
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: dist

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
Expand Down
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ builds:
- linux
goarch:
- amd64
- arm64
- <<: *defaultBuild
id: mittnitectl
binary: mittnitectl
Expand Down