Skip to content

Commit 41a4dd4

Browse files
committed
README (full guide, Go edition), CI on macOS/Linux/Windows, release workflow for 5 platforms
1 parent 2c991e7 commit 41a4dd4

3 files changed

Lines changed: 441 additions & 33 deletions

File tree

.github/workflows/ci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Runs the test suite on macOS, Linux and Windows for every push and pull request.
2+
3+
name: CI
4+
5+
on:
6+
push:
7+
branches: [main]
8+
pull_request:
9+
10+
jobs:
11+
test:
12+
name: test (${{ matrix.os }})
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
os: [macos-latest, ubuntu-latest, windows-latest]
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-go@v5
21+
with:
22+
go-version-file: go.mod
23+
- run: go vet ./...
24+
- name: Test
25+
shell: bash
26+
# The race detector needs cgo; keep Windows on the plain test run.
27+
run: |
28+
if [ "$RUNNER_OS" = Windows ]; then go test ./...; else go test -race ./...; fi
29+
- name: Cross-compile every release target
30+
shell: bash
31+
run: |
32+
for t in darwin/arm64 darwin/amd64 linux/amd64 linux/arm64 windows/amd64; do
33+
CGO_ENABLED=0 GOOS=${t%/*} GOARCH=${t#*/} go build -o /dev/null ./cmd/agentiloop
34+
done

.github/workflows/release.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Builds `agentiloop` for macOS, Linux and Windows.
2+
#
3+
# - Push a tag like `v0.1.0` → builds everything and publishes a GitHub Release.
4+
# - "Run workflow" on the Actions tab → builds everything; download from the run's Artifacts.
5+
#
6+
# macOS signing is optional: add these repo secrets and the mac binaries get
7+
# signed with your Developer ID and notarized. Without them they're unsigned.
8+
# MACOS_CERT_P12 base64 of a "Developer ID Application" .p12
9+
# MACOS_CERT_PASSWORD password of that .p12
10+
# MACOS_SIGN_IDENTITY e.g. "Developer ID Application: Your Name (TEAMID)"
11+
# APPLE_ID, APPLE_TEAM_ID, APPLE_APP_PASSWORD for notarization (app-specific password)
12+
13+
name: Release
14+
15+
on:
16+
push:
17+
tags: ["v*"]
18+
workflow_dispatch:
19+
20+
permissions:
21+
contents: write
22+
23+
jobs:
24+
build:
25+
name: ${{ matrix.name }}
26+
runs-on: ${{ matrix.os }}
27+
env:
28+
# `secrets` can't be used in `if:`, so expose "is a cert configured?" as an env var.
29+
HAS_MAC_CERT: ${{ secrets.MACOS_CERT_P12 != '' }}
30+
CGO_ENABLED: "0"
31+
GOOS: ${{ matrix.goos }}
32+
GOARCH: ${{ matrix.goarch }}
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
include:
37+
- { name: macos-arm64, os: macos-latest, goos: darwin, goarch: arm64 }
38+
- { name: macos-x86_64, os: macos-latest, goos: darwin, goarch: amd64 }
39+
- { name: linux-x86_64, os: ubuntu-latest, goos: linux, goarch: amd64 }
40+
- { name: linux-arm64, os: ubuntu-latest, goos: linux, goarch: arm64 }
41+
- { name: windows-x86_64, os: windows-latest, goos: windows, goarch: amd64 }
42+
43+
steps:
44+
- uses: actions/checkout@v4
45+
46+
- uses: actions/setup-go@v5
47+
with:
48+
go-version-file: go.mod
49+
50+
- name: Build
51+
shell: bash
52+
run: |
53+
EXT=""; [ "$GOOS" = windows ] && EXT=".exe"
54+
go build -trimpath -ldflags "-s -w" -o "dist/agentiloop${EXT}" ./cmd/agentiloop
55+
56+
- name: Sign and notarize (macOS, optional)
57+
if: runner.os == 'macOS' && env.HAS_MAC_CERT == 'true'
58+
env:
59+
MACOS_CERT_P12: ${{ secrets.MACOS_CERT_P12 }}
60+
MACOS_CERT_PASSWORD: ${{ secrets.MACOS_CERT_PASSWORD }}
61+
MACOS_SIGN_IDENTITY: ${{ secrets.MACOS_SIGN_IDENTITY }}
62+
APPLE_ID: ${{ secrets.APPLE_ID }}
63+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
64+
APPLE_APP_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }}
65+
run: |
66+
BIN=dist/agentiloop
67+
KC=$RUNNER_TEMP/build.keychain
68+
echo "$MACOS_CERT_P12" | base64 --decode > "$RUNNER_TEMP/cert.p12"
69+
security create-keychain -p ci "$KC"
70+
security set-keychain-settings -lut 3600 "$KC"
71+
security unlock-keychain -p ci "$KC"
72+
security import "$RUNNER_TEMP/cert.p12" -k "$KC" -P "$MACOS_CERT_PASSWORD" -T /usr/bin/codesign
73+
security set-key-partition-list -S apple-tool:,apple: -s -k ci "$KC"
74+
security list-keychains -d user -s "$KC"
75+
codesign --force --timestamp --options runtime --sign "$MACOS_SIGN_IDENTITY" "$BIN"
76+
# Notarize only when the Apple ID credentials are set; signing alone still works.
77+
if [ -n "$APPLE_ID" ] && [ -n "$APPLE_APP_PASSWORD" ]; then
78+
ditto -c -k "$BIN" "$RUNNER_TEMP/notarize.zip"
79+
xcrun notarytool submit "$RUNNER_TEMP/notarize.zip" --wait \
80+
--apple-id "$APPLE_ID" --team-id "$APPLE_TEAM_ID" --password "$APPLE_APP_PASSWORD"
81+
else
82+
echo "APPLE_ID / APPLE_APP_PASSWORD not set; skipping notarization"
83+
fi
84+
85+
- name: Package (macOS / Linux)
86+
if: runner.os != 'Windows'
87+
run: |
88+
NAME=agentiloop-${{ matrix.name }}
89+
mkdir -p "pkg/$NAME"
90+
cp dist/agentiloop README.md LICENSE "pkg/$NAME/"
91+
tar -C pkg -czf "pkg/$NAME.tar.gz" "$NAME"
92+
93+
- name: Package (Windows)
94+
if: runner.os == 'Windows'
95+
shell: pwsh
96+
run: |
97+
$name = "agentiloop-${{ matrix.name }}"
98+
New-Item -ItemType Directory -Force pkg/$name | Out-Null
99+
Copy-Item dist/agentiloop.exe, README.md, LICENSE pkg/$name/
100+
Compress-Archive -Path pkg/$name -DestinationPath pkg/$name.zip
101+
102+
- uses: actions/upload-artifact@v4
103+
with:
104+
name: agentiloop-${{ matrix.name }}
105+
path: |
106+
pkg/*.tar.gz
107+
pkg/*.zip
108+
109+
release:
110+
name: Publish release
111+
needs: build
112+
if: startsWith(github.ref, 'refs/tags/v')
113+
runs-on: ubuntu-latest
114+
steps:
115+
- uses: actions/download-artifact@v4
116+
with:
117+
path: dist
118+
merge-multiple: true
119+
- uses: softprops/action-gh-release@v2
120+
with:
121+
files: dist/*
122+
generate_release_notes: true
123+
# 0.x versions and tags like v1.0.0-beta.1 are published as pre-releases.
124+
prerelease: ${{ startsWith(github.ref_name, 'v0.') || contains(github.ref_name, '-') }}

0 commit comments

Comments
 (0)