Skip to content

Commit

Permalink
chore(ci): Fix builds
Browse files Browse the repository at this point in the history
  • Loading branch information
samcm committed Apr 17, 2024
1 parent 97410d1 commit dd34102
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 60 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,11 @@ 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 }} \
-e RELEASE_SUFFIX=${{ env.RELEASE_SUFFIX }} \
goreleaser/goreleaser-cross:latest release --clean --config .goreleaser.yaml.new
27 changes: 6 additions & 21 deletions .github/workflows/test-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,10 @@ jobs:
uses: docker/setup-buildx-action@v2
with:
endpoint: builders
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Update GoReleaser config
- name: Run GoReleaser in Docker
run: |
cp .goreleaser.yaml ../.goreleaser.yaml.new
# If we have a RELEASE_SUFFIX, update the goreleaser config to not set
# the release as the latest
if [[ -n "$RELEASE_SUFFIX" ]]; then
echo "release:" >> ../.goreleaser.yaml.new
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 --skip-publish --skip-validate
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
-e GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
goreleaser/goreleaser-cross:latest release --clean --config .goreleaser.yaml --skip-publish --skip-validate
91 changes: 61 additions & 30 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,72 @@ before:
- go mod tidy
- go generate ./...
builds:
- env:
- id: linux-amd64
env:
- CGO_ENABLED=1
- >-
{{- if eq .Os "darwin" }}
{{- if eq .Arch "amd64"}}CC=o64-clang{{- end }}
{{- if eq .Arch "arm64"}}CC=aarch64-apple-darwin20.2-clang{{- end }}
{{- end }}
{{- if eq .Os "windows" }}
{{- if eq .Arch "amd64" }}CC=x86_64-w64-mingw32-gcc{{- end }}
{{- end }}
- >-
{{- if eq .Os "darwin" }}
{{- if eq .Arch "amd64"}}CXX=o64-clang+{{- end }}
{{- if eq .Arch "arm64"}}CXX=aarch64-apple-darwin20.2-clang++{{- end }}
{{- end }}
{{- if eq .Os "windows" }}
{{- if eq .Arch "amd64" }}CXX=x86_64-w64-mingw32-g++{{- end }}
{{- end }}
- 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 dd34102

Please sign in to comment.