Skip to content

Commit 11be37d

Browse files
fieldingclaude
andcommitted
Add CI and release workflows
- CI: build + smoke test on push/PR (ubuntu + macos) - Release: cross-compile on tag push, attach tarballs + sha256 to GitHub release (linux x86_64/aarch64, darwin x86_64/aarch64) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 152dd77 commit 11be37d

2 files changed

Lines changed: 120 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
15+
runs-on: ${{ matrix.os }}
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: mlugg/setup-zig@v2
21+
with:
22+
version: 0.15.2
23+
24+
- name: Install libgit2 (Linux)
25+
if: runner.os == 'Linux'
26+
run: sudo apt-get update && sudo apt-get install -y libgit2-dev
27+
28+
- name: Install libgit2 (macOS)
29+
if: runner.os == 'macOS'
30+
run: brew install libgit2
31+
32+
- name: Build
33+
run: zig build
34+
35+
- name: Build (ReleaseFast)
36+
run: zig build -Doptimize=ReleaseFast
37+
38+
- name: Smoke test
39+
run: |
40+
git log --oneline -5
41+
./zig-out/bin/nit status
42+
./zig-out/bin/nit log -n 5
43+
./zig-out/bin/nit show

.github/workflows/release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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+
name: nit-linux-x86_64
19+
- os: ubuntu-latest
20+
target: aarch64-linux
21+
name: nit-linux-aarch64
22+
- os: macos-latest
23+
target: x86_64-macos
24+
name: nit-darwin-x86_64
25+
- os: macos-latest
26+
target: aarch64-macos
27+
name: nit-darwin-aarch64
28+
29+
runs-on: ${{ matrix.os }}
30+
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- uses: mlugg/setup-zig@v2
35+
with:
36+
version: 0.15.2
37+
38+
- name: Install libgit2 (Linux)
39+
if: runner.os == 'Linux'
40+
run: sudo apt-get update && sudo apt-get install -y libgit2-dev
41+
42+
- name: Install libgit2 (macOS)
43+
if: runner.os == 'macOS'
44+
run: brew install libgit2
45+
46+
- name: Build
47+
run: zig build -Doptimize=ReleaseFast
48+
49+
- name: Package
50+
run: |
51+
cp zig-out/bin/nit nit
52+
tar czf ${{ matrix.name }}.tar.gz nit
53+
shasum -a 256 ${{ matrix.name }}.tar.gz > ${{ matrix.name }}.tar.gz.sha256
54+
55+
- name: Upload artifact
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: ${{ matrix.name }}
59+
path: |
60+
${{ matrix.name }}.tar.gz
61+
${{ matrix.name }}.tar.gz.sha256
62+
63+
release:
64+
needs: build
65+
runs-on: ubuntu-latest
66+
steps:
67+
- uses: actions/download-artifact@v4
68+
with:
69+
merge-multiple: true
70+
71+
- name: Create release
72+
uses: softprops/action-gh-release@v2
73+
with:
74+
generate_release_notes: true
75+
files: |
76+
*.tar.gz
77+
*.sha256

0 commit comments

Comments
 (0)