Skip to content

Commit ddf91f6

Browse files
authored
Merge pull request #61 from aifoundry-org/build-binary-ci
simplify ci.yaml to single runner with cross-compile; add release creation and artifact push
2 parents ce130ca + 13c9a59 commit ddf91f6

File tree

3 files changed

+37
-18
lines changed

3 files changed

+37
-18
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,6 @@ jobs:
2424
run: |
2525
make test
2626
build:
27-
strategy:
28-
matrix:
29-
include:
30-
- arch: amd64
31-
os: linux
32-
- arch: arm64
33-
os: linux
34-
- arch: riscv64
35-
os: linux
36-
- arch: amd64
37-
os: darwin
38-
- arch: arm64
39-
os: darwin
40-
4127
runs-on: ubuntu-latest
4228
steps:
4329
- name: Checkout code
@@ -48,7 +34,7 @@ jobs:
4834
go-version-file: 'go.mod'
4935
- name: Build
5036
run: |
51-
make build ARCH=${{ matrix.arch }} OS=${{ matrix.os }}
37+
make build-all
5238
image:
5339
runs-on: ubuntu-latest
5440
steps:

.github/workflows/publish.yaml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,35 @@ on:
66
- 'v*'
77

88
jobs:
9-
build-and-push:
9+
build-binaries:
10+
name: Build Binaries
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
- name: Set up Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version-file: 'go.mod'
19+
- name: Build
20+
run: |
21+
make build-all
22+
23+
- name: Create SHA256 checksum for files
24+
run: |
25+
for file in bin/*; do
26+
sha256sum "$file" | awk '{ print $1 }' > "${file}.sha256"
27+
done
28+
- name: Create GitHub Release
29+
id: create_release
30+
uses: softprops/action-gh-release@v2
31+
with:
32+
draft: false
33+
prerelease: true
34+
files: |
35+
bin/*
36+
37+
build-and-push-image:
1038
name: Build and Push Docker Image
1139
runs-on: ubuntu-latest
1240

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ TARGET ?= /usr/local/bin/$(CONTROLLER_NAME)
1818

1919
IMAGE_NAME ?= aifoundryorg/oxide-controller
2020

21+
PLATFORMS ?= linux/amd64 linux/arm64 linux/riscv64 darwin/amd64 darwin/arm64
22+
CONTROLLERS := $(foreach plat,$(PLATFORMS),$(CONTROLLER_GENERIC)-$(subst /,-,$(plat)))
23+
24+
build-all: $(CONTROLLERS)
25+
2126
build: $(CONTROLLER)
2227

2328
install: build
@@ -26,8 +31,8 @@ install: build
2631
$(BINDIR):
2732
@mkdir -p $@
2833

29-
$(CONTROLLER): $(BINDIR)
30-
@go build -o $@ ./cmd/
34+
$(CONTROLLER_GENERIC)-%: $(BINDIR)
35+
@GOOS=$(word 1,$(subst -, ,$*)) GOARCH=$(word 2,$(subst -, ,$*)) go build -o $@ ./cmd/
3136

3237
link: $(CONTROLLER) $(CONTROLLER_GENERIC)
3338

0 commit comments

Comments
 (0)