-
Notifications
You must be signed in to change notification settings - Fork 232
101 lines (89 loc) · 3.11 KB
/
build.yml
File metadata and controls
101 lines (89 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Build Platform Binaries
on:
workflow_dispatch:
push:
tags:
- 'v*'
jobs:
build-platform:
name: Build ${{ matrix.slug }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
slug: codemachine-linux-x64
- os: ubuntu-latest
slug: codemachine-linux-arm64
target: linux-arm64
- os: macos-14
slug: codemachine-darwin-arm64
- os: macos-14
slug: codemachine-darwin-x64
target: darwin-x64
- os: windows-latest
slug: codemachine-windows-x64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Read Bun version from package.json
id: bun-version
shell: bash
run: echo "version=$(jq -r '.engines.bun' package.json)" >> $GITHUB_OUTPUT
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ steps.bun-version.outputs.version }}
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build platform binary
shell: bash
run: |
if [ -n "${{ matrix.target }}" ]; then
bun run build --target ${{ matrix.target }}
else
bun run build
fi
- name: Verify cm alias in package.json
shell: bash
run: |
if ! grep -q '"cm"' binaries/${{ matrix.slug }}/package.json; then
echo "❌ ERROR: 'cm' alias missing from binaries/${{ matrix.slug }}/package.json"
exit 1
fi
echo "✅ cm alias verified in package.json"
- name: Test binary execution (Unix)
if: runner.os != 'Windows' && matrix.target == ''
continue-on-error: true
run: |
chmod +x binaries/${{ matrix.slug }}/codemachine
binaries/${{ matrix.slug }}/codemachine --version || echo "⚠️ Binary execution test skipped (may require dependencies)"
- name: Test binary execution (Windows)
if: runner.os == 'Windows'
continue-on-error: true
run: |
binaries/${{ matrix.slug }}/codemachine.exe --version
if ($LASTEXITCODE -ne 0) { Write-Host "⚠️ Binary execution test skipped (may require dependencies)" }
- name: Upload binary package
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.slug }}
path: binaries/${{ matrix.slug }}
- name: Smoke test platform binary
if: matrix.target == ''
shell: bash
run: |
chmod +x binaries/${{ matrix.slug }}/codemachine* || true
binaries/${{ matrix.slug }}/codemachine --version
- name: Verify cross-compiled binary exists
if: matrix.target != ''
shell: bash
run: |
if [ -f "binaries/${{ matrix.slug }}/codemachine" ]; then
echo "✅ Cross-compiled binary exists: binaries/${{ matrix.slug }}/codemachine"
file binaries/${{ matrix.slug }}/codemachine
else
echo "❌ Binary not found"
exit 1
fi