Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
16 changes: 1 addition & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,6 @@ jobs:
run: |
make test
build:
strategy:
matrix:
include:
- arch: amd64
os: linux
- arch: arm64
os: linux
- arch: riscv64
os: linux
- arch: amd64
os: darwin
- arch: arm64
os: darwin

runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -48,7 +34,7 @@ jobs:
go-version-file: 'go.mod'
- name: Build
run: |
make build ARCH=${{ matrix.arch }} OS=${{ matrix.os }}
make build-all
image:
runs-on: ubuntu-latest
steps:
Expand Down
30 changes: 29 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,35 @@ on:
- 'v*'

jobs:
build-and-push:
build-binaries:
name: Build Binaries
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Build
run: |
make build-all

- name: Create SHA256 checksum for files
run: |
for file in bin/*; do
sha256sum "$file" | awk '{ print $1 }' > "${file}.sha256"
done
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v2
with:
draft: false
prerelease: true
files: |
bin/*

build-and-push-image:
name: Build and Push Docker Image
runs-on: ubuntu-latest

Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ TARGET ?= /usr/local/bin/$(CONTROLLER_NAME)

IMAGE_NAME ?= aifoundryorg/oxide-controller

PLATFORMS ?= linux/amd64 linux/arm64 linux/riscv64 darwin/amd64 darwin/arm64
CONTROLLERS := $(foreach plat,$(PLATFORMS),$(CONTROLLER_GENERIC)-$(subst /,-,$(plat)))

build-all: $(CONTROLLERS)

build: $(CONTROLLER)

install: build
Expand All @@ -26,8 +31,8 @@ install: build
$(BINDIR):
@mkdir -p $@

$(CONTROLLER): $(BINDIR)
@go build -o $@ ./cmd/
$(CONTROLLER_GENERIC)-%: $(BINDIR)
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated to this change, but this target should be either phony (to use make as a task runner) or list source dependencies explicitly (to use make as a build system). I'd go with first, as go build is smart enough already.

Currently it fails to recompile when there are changes.

Copy link
Member Author

Choose a reason for hiding this comment

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

We can add it as a future small PR, since you already approved this.

@GOOS=$(word 1,$(subst -, ,$*)) GOARCH=$(word 2,$(subst -, ,$*)) go build -o $@ ./cmd/

link: $(CONTROLLER) $(CONTROLLER_GENERIC)

Expand Down