Skip to content

Commit 13cd11b

Browse files
aksOpsclaude
andauthored
fix(release): simplify to single-runner linux-only build (#135)
v0.3.0 release run (#25779202189) failed at the publish job with: error: git is in a dirty state │ Please check in your pipeline what can be changing the following files: │ ?? prebuilt/ Root cause: the workflow ran a build matrix (linux/amd64, linux/arm64, darwin/arm64), uploaded each result as an actions artifact, then the publish job downloaded them into `prebuilt/` — but goreleaser's release subcommand refuses to run when the working tree has untracked files. Worse: `goreleaser release --clean` rebuilds everything from source ANYWAY, ignoring the downloaded artifacts, so the matrix was wasted effort. The original matrix was over-engineering for CGO. linux→linux cross-compile to arm64 works cleanly with gcc-aarch64-linux-gnu (both kuzudb and go-sqlite3 build). Simpler design that actually ships v0.3.0: - Single ubuntu-latest runner. - Two `builds:` entries in .goreleaser.yml, one per arch, each with the right CC pinned for the cross-compile. - darwin/arm64 deferred to a follow-up workflow that uses a macos runner and attaches binaries to the same draft Release. Linux is the priority shape — most codeiq use is in CI / dev containers / Linux servers. Darwin lands later without forcing v0.3.0 to wait. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e590843 commit 13cd11b

2 files changed

Lines changed: 40 additions & 87 deletions

File tree

.github/workflows/release-go.yml

Lines changed: 14 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@ name: release-go
22

33
# Tag-triggered release pipeline for the codeiq Go binary.
44
#
5-
# Trigger: push a tag matching `v*.*.*` (e.g. `git tag v1.0.0 && git push --tags`).
6-
# Cross-OS build via per-runner matrix (CGO + native kuzudb/sqlite means
7-
# we can't cross-compile cleanly from a single host).
5+
# Trigger: push a tag matching `v*.*.*` (e.g. `git tag v0.3.0 && git push --tags`).
86
#
9-
# Phase 5 of the Java→Go port. Replaces release-java.yml (kept around
10-
# until Phase 6 cutover for any emergency Java release).
7+
# v0.3.0 scope: linux/amd64 + linux/arm64 only. Single ubuntu-latest
8+
# runner builds both via the linux→linux cross-compile with
9+
# gcc-aarch64-linux-gnu (CGO permits this cross — both kuzu and
10+
# go-sqlite3 build cleanly).
11+
#
12+
# darwin/arm64 deferred — needs a macos runner and separate matrix.
13+
# Follow-up: add a `release-darwin.yml` that attaches darwin binaries
14+
# to the same draft Release.
1115

1216
on:
1317
push:
@@ -16,7 +20,7 @@ on:
1620
workflow_dispatch:
1721
inputs:
1822
tag:
19-
description: 'Tag to release (e.g. v1.0.0). Must already exist.'
23+
description: 'Tag to release (e.g. v0.3.0). Must already exist.'
2024
required: true
2125

2226
permissions:
@@ -26,63 +30,8 @@ permissions:
2630
attestations: write
2731

2832
jobs:
29-
# Per-target release. Runs the same .goreleaser.yml on each runner;
30-
# archives are merged in the publish job below.
31-
build:
32-
name: build (${{ matrix.os }} / ${{ matrix.goarch }})
33-
runs-on: ${{ matrix.runner }}
34-
strategy:
35-
fail-fast: false
36-
matrix:
37-
include:
38-
- os: linux
39-
goarch: amd64
40-
runner: ubuntu-latest
41-
- os: linux
42-
goarch: arm64
43-
runner: ubuntu-24.04-arm
44-
- os: darwin
45-
goarch: arm64
46-
runner: macos-14
47-
steps:
48-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
49-
with:
50-
fetch-depth: 0
51-
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
52-
with:
53-
go-version: '1.25.10'
54-
cache: true
55-
cache-dependency-path: go/go.sum
56-
- name: Install build deps (linux)
57-
if: runner.os == 'Linux'
58-
run: sudo apt-get update -y && sudo apt-get install -y build-essential
59-
- name: Install Syft (SBOM)
60-
uses: anchore/sbom-action/download-syft@e22c389904149dbc22b58101806040fa8d37a610 # v0.24.0
61-
- name: Install Cosign (signing)
62-
uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2
63-
- uses: goreleaser/goreleaser-action@1a80836c5c9d9e5755a25cb59ec6f45a3b5f41a8 # v7.2.1
64-
with:
65-
distribution: goreleaser
66-
version: '~> v2'
67-
# Single-target build per runner; combined publish runs in a
68-
# separate job that consumes all three artifact bundles.
69-
args: build --single-target --clean --snapshot
70-
env:
71-
GOOS: ${{ matrix.os }}
72-
GOARCH: ${{ matrix.goarch }}
73-
- name: Upload binary artifact
74-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
75-
with:
76-
name: codeiq-${{ matrix.os }}-${{ matrix.goarch }}
77-
path: dist/codeiq_*/codeiq*
78-
retention-days: 1
79-
80-
# Combined publish: pulls the three binaries built above, packages
81-
# them with SBOMs, signs the checksum manifest via Sigstore keyless,
82-
# and uploads the GitHub Release. Runs on linux only.
8333
release:
84-
name: publish release
85-
needs: build
34+
name: release
8635
runs-on: ubuntu-latest
8736
steps:
8837
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -94,24 +43,17 @@ jobs:
9443
cache: true
9544
cache-dependency-path: go/go.sum
9645
- name: Install build deps
97-
run: sudo apt-get update -y && sudo apt-get install -y build-essential
46+
run: |
47+
sudo apt-get update -y
48+
sudo apt-get install -y build-essential gcc-aarch64-linux-gnu
9849
- name: Install Syft (SBOM)
9950
uses: anchore/sbom-action/download-syft@e22c389904149dbc22b58101806040fa8d37a610 # v0.24.0
10051
- name: Install Cosign (signing)
10152
uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2
102-
- name: Download pre-built binaries
103-
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
104-
with:
105-
pattern: codeiq-*
106-
path: prebuilt
10753
- uses: goreleaser/goreleaser-action@1a80836c5c9d9e5755a25cb59ec6f45a3b5f41a8 # v7.2.1
10854
with:
10955
distribution: goreleaser
11056
version: '~> v2'
111-
# Full release: archives + SBOMs + cosign sigs + GitHub Release
112-
# draft + (optional) Homebrew tap. The owning org sets
113-
# HOMEBREW_TAP_GITHUB_TOKEN to publish to homebrew-codeiq;
114-
# forks leave it unset and the brew step skips silently.
11557
args: release --clean
11658
env:
11759
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,33 @@ before:
2424
- sh -c "cd go && go test ./... -count=1"
2525

2626
builds:
27-
- id: codeiq
27+
# linux/amd64 — native build on the ubuntu-latest runner.
28+
- id: codeiq-linux-amd64
29+
main: ./cmd/codeiq
30+
dir: go
31+
binary: codeiq
32+
env:
33+
- CGO_ENABLED=1
34+
- CC=gcc
35+
flags:
36+
- -trimpath
37+
ldflags:
38+
- -s -w
39+
- -X 'github.com/randomcodespace/codeiq/go/internal/buildinfo.Version={{.Version}}'
40+
- -X 'github.com/randomcodespace/codeiq/go/internal/buildinfo.Commit={{.ShortCommit}}'
41+
- -X 'github.com/randomcodespace/codeiq/go/internal/buildinfo.Date={{.Date}}'
42+
- -X 'github.com/randomcodespace/codeiq/go/internal/buildinfo.Dirty={{.IsGitDirty}}'
43+
goos: [linux]
44+
goarch: [amd64]
45+
# linux/arm64 — cross-compile from the ubuntu-latest runner using
46+
# gcc-aarch64-linux-gnu installed in the release workflow.
47+
- id: codeiq-linux-arm64
2848
main: ./cmd/codeiq
2949
dir: go
3050
binary: codeiq
3151
env:
3252
- CGO_ENABLED=1
53+
- CC=aarch64-linux-gnu-gcc
3354
flags:
3455
- -trimpath
3556
ldflags:
@@ -38,20 +59,10 @@ builds:
3859
- -X 'github.com/randomcodespace/codeiq/go/internal/buildinfo.Commit={{.ShortCommit}}'
3960
- -X 'github.com/randomcodespace/codeiq/go/internal/buildinfo.Date={{.Date}}'
4061
- -X 'github.com/randomcodespace/codeiq/go/internal/buildinfo.Dirty={{.IsGitDirty}}'
41-
# CGO + kuzudb makes cross-arch fragile from a single host; the
42-
# release workflow runs this config once per (OS, arch) runner.
43-
goos:
44-
- linux
45-
- darwin
46-
goarch:
47-
- amd64
48-
- arm64
49-
ignore:
50-
# darwin/amd64 needs a darwin runner — skip when this config is
51-
# consumed on a linux runner. The release workflow re-runs the
52-
# darwin builds on macOS runners.
53-
- goos: darwin
54-
goarch: amd64
62+
goos: [linux]
63+
goarch: [arm64]
64+
# darwin/arm64 deferred — needs a macos runner. Follow-up:
65+
# release-darwin.yml attaches macOS binaries to the same draft Release.
5566

5667
archives:
5768
- id: codeiq

0 commit comments

Comments
 (0)