Skip to content

Commit c33ec66

Browse files
committed
ci: add GitHub Actions workflows for CI and releases
- Add ci.yml: Build and test on Linux/macOS with Zig 0.15.2 - Runs on push to main and pull requests - Includes format check with zig fmt - Add release.yml: Automated binary releases on git tags - Builds for 4 targets: linux-amd64, linux-arm64, macos-amd64, macos-arm64 - Uses ReleaseSafe optimization - Auto-generates release notes Signed-off-by: leocavalcante <[email protected]>
1 parent 1635801 commit c33ec66

File tree

2 files changed

+108
-0
lines changed

2 files changed

+108
-0
lines changed

.github/workflows/ci.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest, macos-latest]
14+
runs-on: ${{ matrix.os }}
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Setup Zig
20+
uses: mlugg/setup-zig@v2
21+
with:
22+
version: 0.15.2
23+
24+
- name: Build
25+
run: zig build
26+
27+
- name: Run tests
28+
run: zig build test
29+
30+
lint:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Setup Zig
36+
uses: mlugg/setup-zig@v2
37+
with:
38+
version: 0.15.2
39+
40+
- name: Check formatting
41+
run: zig fmt --check src/

.github/workflows/release.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
strategy:
14+
matrix:
15+
include:
16+
- os: ubuntu-latest
17+
target: x86_64-linux
18+
artifact: opencoder-linux-amd64
19+
- os: ubuntu-latest
20+
target: aarch64-linux
21+
artifact: opencoder-linux-arm64
22+
- os: macos-latest
23+
target: x86_64-macos
24+
artifact: opencoder-macos-amd64
25+
- os: macos-latest
26+
target: aarch64-macos
27+
artifact: opencoder-macos-arm64
28+
runs-on: ${{ matrix.os }}
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- name: Setup Zig
34+
uses: mlugg/setup-zig@v2
35+
with:
36+
version: 0.15.2
37+
38+
- name: Build release
39+
run: zig build -Doptimize=ReleaseSafe -Dtarget=${{ matrix.target }}
40+
41+
- name: Rename binary
42+
run: mv zig-out/bin/opencoder ${{ matrix.artifact }}
43+
44+
- name: Upload artifact
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: ${{ matrix.artifact }}
48+
path: ${{ matrix.artifact }}
49+
50+
release:
51+
needs: build
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Download all artifacts
55+
uses: actions/download-artifact@v4
56+
with:
57+
path: artifacts
58+
59+
- name: Create release
60+
uses: softprops/action-gh-release@v2
61+
with:
62+
files: |
63+
artifacts/opencoder-linux-amd64/opencoder-linux-amd64
64+
artifacts/opencoder-linux-arm64/opencoder-linux-arm64
65+
artifacts/opencoder-macos-amd64/opencoder-macos-amd64
66+
artifacts/opencoder-macos-arm64/opencoder-macos-arm64
67+
generate_release_notes: true

0 commit comments

Comments
 (0)