Skip to content

Commit

Permalink
fix(ci): Multiarch BLS build (#300)
Browse files Browse the repository at this point in the history
* style: remove unnecessary environment variable in builds

* chore(ci): Fix builds

* chore(ci): Fix builds

* chore(ci): Fix builds

* style: update goreleaser versions and env variables

* chore(ci): Fix builds

* chore(ci): Fix builds

* chore(ci): Fix builds

* chore(ci): Fix builds

---------

Signed-off-by: Sam Calder-Mason <sam.calder-mason@ethereum.org>
  • Loading branch information
samcm authored Apr 17, 2024
1 parent b1ec19c commit e1f0465
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 23 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ jobs:
echo " prerelease: true" >> ../.goreleaser.yaml.new
echo " make_latest: false" >> ../.goreleaser.yaml.new
fi
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean --config ../.goreleaser.yaml.new
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_SUFFIX: ${{ env.RELEASE_SUFFIX }}
- name: Run GoReleaser in Docker
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
-e GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
-v /var/run/docker.sock:/var/run/docker.sock \
-e RELEASE_SUFFIX=${{ env.RELEASE_SUFFIX }} \
goreleaser/goreleaser-cross:v1.22.2 release --clean --config .goreleaser.yaml.new
49 changes: 49 additions & 0 deletions .github/workflows/test-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: test-build

on:
pull_request:
workflow_dispatch:

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- uses: actions/setup-node@v3
name: Set up Node
with:
node-version: 18
- name: Run apt-get update
run: sudo apt-get update
- name: Install cross-compiler for linux/arm64
run: sudo apt-get -y install gcc-aarch64-linux-gnu
- name: Install make
run: sudo apt-get -y install make
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Context for Buildx
shell: bash
id: buildx-context
run: |
docker context create builders
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
endpoint: builders
- name: Run GoReleaser in Docker
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
-e GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
-v /var/run/docker.sock:/var/run/docker.sock \
-e RELEASE_SUFFIX="test" \
goreleaser/goreleaser-cross:v1.22.2 release --clean --config .goreleaser.yaml --skip=publish --skip=validate
77 changes: 63 additions & 14 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,72 @@ before:
- go mod tidy
- go generate ./...
builds:
- binary: xatu-{{.Version}}
- id: linux-amd64
env:
- CGO_ENABLED=1
- CC=x86_64-linux-gnu-gcc
- CXX=x86_64-linux-gnu-g++
binary: xatu-{{.Version}}
goos:
- linux
- windows
- darwin
- linux
goarch:
- amd64
ldflags:
- -s -w -X github.com/ethpandaops/xatu/pkg/proto/xatu.Release={{.Tag}} -X github.com/ethpandaops/xatu/pkg/proto/xatu.GitCommit={{.ShortCommit}}
mod_timestamp: "{{ .CommitTimestamp }}"

- id: linux-arm64
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc
- CXX=aarch64-linux-gnu-g++
binary: xatu-{{.Version}}
goos:
- linux
goarch:
- arm64
ldflags:
- -s -w -X github.com/ethpandaops/xatu/pkg/proto/xatu.Release={{.Tag}} -X github.com/ethpandaops/xatu/pkg/proto/xatu.GitCommit={{.ShortCommit}}
mod_timestamp: "{{ .CommitTimestamp }}"

- id: windows-amd64
env:
- CGO_ENABLED=1
- CC=x86_64-w64-mingw32-gcc
- CXX=x86_64-w64-mingw32-g++
binary: xatu-{{.Version}}
goos:
- windows
goarch:
- amd64
ldflags:
- -s -w -X github.com/ethpandaops/xatu/pkg/proto/xatu.Release={{.Tag}} -X github.com/ethpandaops/xatu/pkg/proto/xatu.GitCommit={{.ShortCommit}}
mod_timestamp: "{{ .CommitTimestamp }}"

- id: darwin-amd64
env:
- CGO_ENABLED=1
- CC=o64-clang
- CXX=o64-clang++
binary: xatu-{{.Version}}
goos:
- darwin
goarch:
- amd64
ldflags:
- -s -w -X github.com/ethpandaops/xatu/pkg/proto/xatu.Release={{.Tag}} -X github.com/ethpandaops/xatu/pkg/proto/xatu.GitCommit={{.ShortCommit}}
mod_timestamp: "{{ .CommitTimestamp }}"

- id: darwin-arm64
env:
- CGO_ENABLED=1
- CC=o64-clang
- CXX=o64-clang++
binary: xatu-{{.Version}}
goos:
- darwin
goarch:
- amd64
- arm64
goarm:
- 6
- 7
ignore:
- goarch: 386
# broken with go-ethereum github.com/prometheus/tsdb module
- goos: windows
goarch: arm64
- arm64
ldflags:
- -s -w -X github.com/ethpandaops/xatu/pkg/proto/xatu.Release={{.Tag}} -X github.com/ethpandaops/xatu/pkg/proto/xatu.GitCommit={{.ShortCommit}}
mod_timestamp: "{{ .CommitTimestamp }}"
Expand Down

0 comments on commit e1f0465

Please sign in to comment.