Skip to content

Commit f234f91

Browse files
committed
Add CI/CD pipelines and standardize build scripts
### Features - Add GitHub Actions CI workflow for automated testing, linting, and type checking on every push and PR - Add GitHub Actions release workflow for multi-platform binary builds triggered by version tags ### Refactoring - Standardize build script names in package.json to match target platform architecture (linux-x64, darwin-arm64, darwin-x64, windows-x64) - Update build:all script to reference corrected platform-specific build commands - Update binary output filenames to include architecture for clarity ### Documentation - Add .gitignore rule for Bun build artifacts (.*.bun-build)
1 parent 0541f23 commit f234f91

4 files changed

Lines changed: 131 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
name: Test
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Bun
19+
uses: oven-sh/setup-bun@v2
20+
with:
21+
bun-version: latest
22+
23+
- name: Install dependencies
24+
run: bun install --frozen-lockfile
25+
26+
- name: Lint
27+
run: bun run lint
28+
29+
- name: Type check
30+
run: bun run typecheck
31+
32+
- name: Test
33+
run: bun test

.github/workflows/release.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
name: Build ${{ matrix.target }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- target: linux-x64
20+
os: ubuntu-latest
21+
artifact: upkeep-linux-x64
22+
- target: darwin-arm64
23+
os: macos-14
24+
artifact: upkeep-darwin-arm64
25+
- target: darwin-x64
26+
os: macos-13
27+
artifact: upkeep-darwin-x64
28+
- target: windows-x64
29+
os: windows-latest
30+
artifact: upkeep-windows-x64.exe
31+
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
36+
- name: Setup Bun
37+
uses: oven-sh/setup-bun@v2
38+
with:
39+
bun-version: latest
40+
41+
- name: Install dependencies
42+
run: bun install --frozen-lockfile
43+
44+
- name: Build binary
45+
run: bun run build:${{ matrix.target }}
46+
47+
- name: Upload artifact
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: ${{ matrix.artifact }}
51+
path: dist/${{ matrix.artifact }}
52+
if-no-files-found: error
53+
54+
release:
55+
name: Create Release
56+
needs: build
57+
runs-on: ubuntu-latest
58+
59+
steps:
60+
- name: Checkout
61+
uses: actions/checkout@v4
62+
63+
- name: Download all artifacts
64+
uses: actions/download-artifact@v4
65+
with:
66+
path: artifacts
67+
68+
- name: Prepare release files
69+
run: |
70+
mkdir -p release
71+
cp artifacts/upkeep-linux-x64/upkeep-linux-x64 release/
72+
cp artifacts/upkeep-darwin-arm64/upkeep-darwin-arm64 release/
73+
cp artifacts/upkeep-darwin-x64/upkeep-darwin-x64 release/
74+
cp artifacts/upkeep-windows-x64.exe/upkeep-windows-x64.exe release/
75+
chmod +x release/upkeep-linux-x64
76+
chmod +x release/upkeep-darwin-arm64
77+
chmod +x release/upkeep-darwin-x64
78+
ls -la release/
79+
80+
- name: Create GitHub Release
81+
uses: softprops/action-gh-release@v2
82+
with:
83+
files: |
84+
release/upkeep-linux-x64
85+
release/upkeep-darwin-arm64
86+
release/upkeep-darwin-x64
87+
release/upkeep-windows-x64.exe
88+
generate_release_notes: true
89+
draft: false
90+
prerelease: false

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ Thumbs.db
2929
# Bun binary lockfile (text-based bun.lock should be committed)
3030
*.lockb
3131

32+
# Bun build artifacts
33+
.*.bun-build
34+
3235
# TypeScript
3336
*.tsbuildinfo
3437

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
"scripts": {
1111
"dev": "bun run src/cli/index.ts",
1212
"build": "bun build ./src/cli/index.ts --compile --outfile dist/upkeep",
13-
"build:all": "bun run build:linux && bun run build:macos && bun run build:windows",
14-
"build:linux": "bun build ./src/cli/index.ts --compile --target=bun-linux-x64 --outfile dist/upkeep-linux",
15-
"build:macos": "bun build ./src/cli/index.ts --compile --target=bun-darwin-arm64 --outfile dist/upkeep-macos",
16-
"build:windows": "bun build ./src/cli/index.ts --compile --target=bun-windows-x64 --outfile dist/upkeep-windows.exe",
13+
"build:all": "bun run build:linux-x64 && bun run build:darwin-arm64 && bun run build:darwin-x64 && bun run build:windows-x64",
14+
"build:linux-x64": "bun build ./src/cli/index.ts --compile --target=bun-linux-x64 --outfile dist/upkeep-linux-x64",
15+
"build:darwin-arm64": "bun build ./src/cli/index.ts --compile --target=bun-darwin-arm64 --outfile dist/upkeep-darwin-arm64",
16+
"build:darwin-x64": "bun build ./src/cli/index.ts --compile --target=bun-darwin-x64 --outfile dist/upkeep-darwin-x64",
17+
"build:windows-x64": "bun build ./src/cli/index.ts --compile --target=bun-windows-x64 --outfile dist/upkeep-windows-x64.exe",
1718
"test": "bun test",
1819
"test:watch": "bun test --watch",
1920
"test:coverage": "bun test --coverage",

0 commit comments

Comments
 (0)