Skip to content

Commit

Permalink
ci(goreleaser): multiarch external releases (#2021)
Browse files Browse the repository at this point in the history
This backports the following commits from `main` to `release/v0.8`:
- [ci(goreleaser): multiarch external releases
(#2008)](#2008)
- [ci(goreleaser): fix local docker build
(#2020)](#2020)

issue: none
  • Loading branch information
corverroos authored Oct 1, 2024
1 parent b9964ac commit bd24f8a
Show file tree
Hide file tree
Showing 8 changed files with 255 additions and 178 deletions.
24 changes: 1 addition & 23 deletions .github/workflows/clicommand.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,9 @@ jobs:

- name: Build binaries
uses: goreleaser/goreleaser-action@v5
env:
GOOS: linux
with:
version: 2
args: build --single-target --snapshot --clean --id=halo --id=relayer --id=monitor --id=anvilproxy

- name: Build halo image
run: |
cd dist/halo_linux_amd64_v1
docker build -f "../../halo/Dockerfile" . -t "omniops/halo:${GITHUB_SHA::7}"
- name: Build relayer image
run: |
cd dist/relayer_linux_amd64_v1
docker build -f "../../relayer/Dockerfile" . -t "omniops/relayer:${GITHUB_SHA::7}"
- name: Build monitor image
run: |
cd dist/monitor_linux_amd64_v1
docker build -f "../../monitor/Dockerfile" . -t "omniops/monitor:${GITHUB_SHA::7}"
- name: Build anvilproxy image
run: |
cd dist/anvilproxy_linux_amd64_v1
docker build -f "../../e2e/anvilproxy/Dockerfile" . -t "omniops/anvilproxy:${GITHUB_SHA::7}"
args: release -f .goreleaser-snapshot.yaml --snapshot --clean --skip=archive

- name: Build halovisor image
run: scripts/halovisor/build.sh "${GITHUB_SHA::7}"
Expand Down
24 changes: 1 addition & 23 deletions .github/workflows/pr-e2etest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,13 @@ jobs:

- name: Build binaries
uses: goreleaser/goreleaser-action@v5
env:
GOOS: linux
with:
version: 2
args: build --single-target --snapshot --clean --id=halo --id=relayer --id=monitor --id=anvilproxy

- name: Build halo image
run: |
cd dist/halo_linux_amd64_v1
docker build -f "../../halo/Dockerfile" . -t "omniops/halo:${GITHUB_SHA::7}"
args: release -f .goreleaser-snapshot.yaml --snapshot --clean --skip=archive

- name: Build halovisor image
run: scripts/halovisor/build.sh "${GITHUB_SHA::7}"

- name: Build relayer image
run: |
cd dist/relayer_linux_amd64_v1
docker build -f "../../relayer/Dockerfile" . -t "omniops/relayer:${GITHUB_SHA::7}"
- name: Build monitor image
run: |
cd dist/monitor_linux_amd64_v1
docker build -f "../../monitor/Dockerfile" . -t "omniops/monitor:${GITHUB_SHA::7}"
- name: Build anvilproxy image
run: |
cd dist/anvilproxy_linux_amd64_v1
docker build -f "../../e2e/anvilproxy/Dockerfile" . -t "omniops/anvilproxy:${GITHUB_SHA::7}"
- name: Run devnet1 e2e test
run: |
go install github.com/omni-network/omni/e2e
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: goreleaser/goreleaser-action@v5
with:
version: 2
args: release --clean
args: release -f .goreleaser-official.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -42,6 +42,7 @@ jobs:
HALO_VERSION_0_GENESIS=${{ github.ref_name }}
platforms: |
linux/amd64
linux/arm64
push: true
tags: |
omniops/halovisor:latest
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/release-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,11 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Speed up CI by skipping multi-arch builds
- name: Skip multi-arch builds
run: |
cp .goreleaser.yaml .snapshot-goreleaser.yaml
sed -i -e 's/linux, darwin/linux/g' .snapshot-goreleaser.yaml
sed -i -e 's/amd64, arm64/amd64/g' .snapshot-goreleaser.yaml
cat .snapshot-goreleaser.yaml
- name: Build docker images
uses: goreleaser/goreleaser-action@v5
with:
version: 2
# Use --snapshot to build current HEAD commit (this doesn't publish images)
args: release --snapshot --clean --config=.snapshot-goreleaser.yaml
args: release -f .goreleaser-snapshot.yaml --snapshot --clean --skip=archive
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
155 changes: 155 additions & 0 deletions .goreleaser-official.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
version: 2

project_name: omni

# halo and omni cli:
# - External facing
# - Released as binaries inside archive tarball
# - So require linux/darwin/amd/arm matrix of binaires (tarballs)
# - Only linux/amd/arm docker images required
# - Tag images with {Tag} and latest
#
# relayer, monitor:
# - Internal facing (not external)
# - Not released as binaries
# - Only linux/amd docker image required.
# - Tag images with {Tag} only
#
# anvilproxy: nothing required for official release

builds:
- id: halo
main: ./halo
binary: halo
env: [CGO_ENABLED=0]
goos: [linux, darwin]
goarch: [amd64, arm64]
ldflags:
- -s -w -X github.com/omni-network/omni/lib/buildinfo.version={{.Tag}}

- id: omni
main: ./cli/cmd/omni
binary: omni
env: [ CGO_ENABLED=0 ]
goos: [ linux, darwin ]
goarch: [ amd64, arm64 ]
ldflags:
- -s -w -X github.com/omni-network/omni/lib/buildinfo.version={{.Tag}}

- id: relayer
main: ./relayer
binary: relayer
env: [CGO_ENABLED=0]
goos: [linux]
goarch: [amd64]
ldflags:
- -s -w -X github.com/omni-network/omni/lib/buildinfo.version={{.Tag}}

- id: monitor
main: ./monitor
binary: monitor
env: [CGO_ENABLED=0]
goos: [linux]
goarch: [amd64]
ldflags:
- -s -w -X github.com/omni-network/omni/lib/buildinfo.version={{.Tag}}

dockers:
- id: halo-amd64
ids: [halo]
goos: linux
goarch: amd64
use: buildx
build_flag_templates:
- "--platform=linux/amd64"
dockerfile: ./halo/Dockerfile
image_templates:
- omniops/halo:{{.Tag}}-amd64

- id: halo-arm64
ids: [halo]
goos: linux
goarch: arm64
use: buildx
build_flag_templates:
- "--platform=linux/arm64"
dockerfile: ./halo/Dockerfile
image_templates:
- omniops/halo:{{.Tag}}-arm64

- id: omni-amd64
ids: [omni]
goos: linux
goarch: amd64
use: buildx
build_flag_templates:
- "--platform=linux/amd64"
dockerfile: ./cli/cmd/omni/Dockerfile
image_templates:
- omniops/omni:{{.Tag}}-amd64

- id: omni-arm64
ids: [omni]
goos: linux
goarch: arm64
use: buildx
build_flag_templates:
- "--platform=linux/arm64"
dockerfile: ./cli/cmd/omni/Dockerfile
image_templates:
- omniops/omni:{{.Tag}}-arm64

- ids: [relayer]
goos: linux
goarch: amd64
dockerfile: ./relayer/Dockerfile
image_templates:
- omniops/relayer:{{.Tag}}

- ids: [monitor]
goos: linux
goarch: amd64
dockerfile: ./monitor/Dockerfile
image_templates:
- omniops/monitor:{{.Tag}}

docker_manifests:
- name_template: omniops/halo:{{.Tag}}
image_templates:
- omniops/halo:{{.Tag}}-amd64
- omniops/halo:{{.Tag}}-arm64
- name_template: omniops/halo:latest
image_templates:
- omniops/halo:{{.Tag}}-amd64
- omniops/halo:{{.Tag}}-arm64
- name_template: omniops/omni:{{.Tag}}
image_templates:
- omniops/omni:{{.Tag}}-amd64
- omniops/omni:{{.Tag}}-arm64
- name_template: omniops/omni:latest
image_templates:
- omniops/omni:{{.Tag}}-amd64
- omniops/omni:{{.Tag}}-arm64

archives:
- format: tar.gz
builds: # Only include external facing binaries. We use docker internally.
- halo
- omni
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
release:
draft: true
replace_existing_draft: true
prerelease: auto
mode: append

changelog:
disable: true
89 changes: 89 additions & 0 deletions .goreleaser-snapshot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
version: 2

project_name: omni

# No binaries (archives) need to be released for snapshots
# Only linux/amd64 docker images are needed

builds:
- id: halo
main: ./halo
binary: halo
env: [CGO_ENABLED=0]
goos: [linux]
goarch: [amd64]

- id: relayer
main: ./relayer
binary: relayer
env: [CGO_ENABLED=0]
goos: [linux]
goarch: [amd64]

- id: monitor
main: ./monitor
binary: monitor
env: [CGO_ENABLED=0]
goos: [linux]
goarch: [amd64]

- id: omni
main: ./cli/cmd/omni
binary: omni
env: [ CGO_ENABLED=0 ]
goos: [ linux ]
goarch: [ amd64 ]

- id: anvilproxy
main: ./e2e/anvilproxy
binary: anvilproxy
env: [ CGO_ENABLED=0 ]
goos: [ linux ]
goarch: [ amd64 ]

dockers:
- ids: [ halo ]
dockerfile: ./halo/Dockerfile
goos: linux
goarch: amd64
image_templates:
- omniops/halo:{{ .ShortCommit }}
- omniops/halo:main

- ids: [omni]
dockerfile: ./cli/cmd/omni/Dockerfile
goos: linux
goarch: amd64
image_templates:
- omniops/omni:{{ .ShortCommit }}
- omniops/omni:main

- ids: [relayer]
dockerfile: ./relayer/Dockerfile
goos: linux
goarch: amd64
image_templates:
- omniops/relayer:{{ .ShortCommit }}
- omniops/relayer:main

- ids: [monitor]
dockerfile: ./monitor/Dockerfile
goos: linux
goarch: amd64
image_templates:
- omniops/monitor:{{ .ShortCommit }}
- omniops/monitor:main

- ids: [anvilproxy]
dockerfile: ./e2e/anvilproxy/Dockerfile
goos: linux
goarch: amd64
image_templates:
- omniops/anvilproxy:{{ .ShortCommit }}
- omniops/anvilproxy:main

release:
disable: true

changelog:
disable: true
Loading

0 comments on commit bd24f8a

Please sign in to comment.