Skip to content

Commit ae1f4b3

Browse files
committed
Add CI and release GitHub Actions workflows
Add two GitHub Actions workflows: ci.yml and release.yml. Both run on macOS (macos-15) and select Xcode 16, resolve SPM dependencies, build Debug (treating warnings as errors) and Release configurations, and perform app bundle validation and a smoke test (launch and quit). The release workflow triggers on tagged pushes (v*), depends on the validate job, extracts the version from the tag, and creates a GitHub release (softprops/action-gh-release). These workflows add automated build validation and release generation for the PromptBar Xcode project.
1 parent d708da8 commit ae1f4b3

2 files changed

Lines changed: 248 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
SCHEME: PromptBar
11+
PROJECT: PromptBar/PromptBar.xcodeproj
12+
13+
jobs:
14+
validate:
15+
runs-on: macos-15
16+
timeout-minutes: 20
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Select Xcode
23+
run: sudo xcode-select -s /Applications/Xcode_16.app/Contents/Developer
24+
25+
- name: Resolve SPM dependencies
26+
run: xcodebuild -resolvePackageDependencies -project "$PROJECT" -scheme "$SCHEME"
27+
28+
# ── Static Analysis ───────────────────────────────────────────
29+
- name: Build Debug (with warnings as errors)
30+
run: |
31+
xcodebuild build \
32+
-project "$PROJECT" \
33+
-scheme "$SCHEME" \
34+
-configuration Debug \
35+
CODE_SIGN_IDENTITY="-" \
36+
CODE_SIGNING_REQUIRED=NO \
37+
CODE_SIGNING_ALLOWED=NO \
38+
ONLY_ACTIVE_ARCH=NO \
39+
GCC_TREAT_WARNINGS_AS_ERRORS=YES
40+
41+
# ── Release Build ─────────────────────────────────────────────
42+
- name: Build Release
43+
run: |
44+
xcodebuild build \
45+
-project "$PROJECT" \
46+
-scheme "$SCHEME" \
47+
-configuration Release \
48+
CODE_SIGN_IDENTITY="-" \
49+
CODE_SIGNING_REQUIRED=NO \
50+
CODE_SIGNING_ALLOWED=NO \
51+
ONLY_ACTIVE_ARCH=NO
52+
53+
# ── Verify App Bundle ─────────────────────────────────────────
54+
- name: Verify app bundle structure
55+
run: |
56+
APP=$(find ~/Library/Developer/Xcode/DerivedData -name "PromptBar.app" -path "*/Release/*" | head -1)
57+
58+
if [ -z "$APP" ]; then
59+
echo "::error::PromptBar.app not found in build output"
60+
exit 1
61+
fi
62+
63+
echo "Found app at: $APP"
64+
65+
# Check the binary exists
66+
if [ ! -f "$APP/Contents/MacOS/PromptBar" ]; then
67+
echo "::error::Missing main binary"
68+
exit 1
69+
fi
70+
71+
# Check Info.plist exists
72+
if [ ! -f "$APP/Contents/Info.plist" ]; then
73+
echo "::error::Missing Info.plist"
74+
exit 1
75+
fi
76+
77+
# Check required resources
78+
if [ ! -f "$APP/Contents/Resources/GoogleService-Info.plist" ]; then
79+
echo "::error::Missing GoogleService-Info.plist"
80+
exit 1
81+
fi
82+
83+
if [ ! -d "$APP/Contents/Resources/Assets.car" ]; then
84+
echo "::error::Missing compiled assets"
85+
exit 1
86+
fi
87+
88+
# Check the binary links against expected frameworks
89+
LINKED=$(otool -L "$APP/Contents/MacOS/PromptBar")
90+
for fw in WebKit AppKit SwiftUI; do
91+
if ! echo "$LINKED" | grep -q "$fw"; then
92+
echo "::error::Binary not linked against $fw"
93+
exit 1
94+
fi
95+
done
96+
97+
echo "App bundle validation passed"
98+
99+
# ── Smoke Test ────────────────────────────────────────────────
100+
- name: Smoke test (launch and quit)
101+
run: |
102+
APP=$(find ~/Library/Developer/Xcode/DerivedData -name "PromptBar.app" -path "*/Release/*" | head -1)
103+
104+
# Launch the app in background, give it a few seconds, then check it's running
105+
open "$APP"
106+
sleep 3
107+
108+
if pgrep -x "PromptBar" > /dev/null; then
109+
echo "App launched successfully"
110+
pkill -x "PromptBar"
111+
echo "App terminated cleanly"
112+
else
113+
echo "::error::App failed to launch or crashed on startup"
114+
exit 1
115+
fi

.github/workflows/release.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: Build & Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
env:
12+
SCHEME: PromptBar
13+
PROJECT: PromptBar/PromptBar.xcodeproj
14+
CONFIGURATION: Release
15+
16+
jobs:
17+
validate:
18+
runs-on: macos-15
19+
timeout-minutes: 20
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Select Xcode
26+
run: sudo xcode-select -s /Applications/Xcode_16.app/Contents/Developer
27+
28+
- name: Resolve SPM dependencies
29+
run: xcodebuild -resolvePackageDependencies -project "$PROJECT" -scheme "$SCHEME"
30+
31+
# ── Debug build (warnings as errors) ──────────────────────────
32+
- name: Build Debug
33+
run: |
34+
xcodebuild build \
35+
-project "$PROJECT" \
36+
-scheme "$SCHEME" \
37+
-configuration Debug \
38+
CODE_SIGN_IDENTITY="-" \
39+
CODE_SIGNING_REQUIRED=NO \
40+
CODE_SIGNING_ALLOWED=NO \
41+
ONLY_ACTIVE_ARCH=NO \
42+
GCC_TREAT_WARNINGS_AS_ERRORS=YES
43+
44+
# ── Release build ─────────────────────────────────────────────
45+
- name: Build Release
46+
run: |
47+
xcodebuild build \
48+
-project "$PROJECT" \
49+
-scheme "$SCHEME" \
50+
-configuration Release \
51+
CODE_SIGN_IDENTITY="-" \
52+
CODE_SIGNING_REQUIRED=NO \
53+
CODE_SIGNING_ALLOWED=NO \
54+
ONLY_ACTIVE_ARCH=NO
55+
56+
# ── Verify app bundle ─────────────────────────────────────────
57+
- name: Verify app bundle structure
58+
run: |
59+
APP=$(find ~/Library/Developer/Xcode/DerivedData -name "PromptBar.app" -path "*/Release/*" | head -1)
60+
61+
if [ -z "$APP" ]; then
62+
echo "::error::PromptBar.app not found in build output"
63+
exit 1
64+
fi
65+
66+
echo "Found app at: $APP"
67+
68+
if [ ! -f "$APP/Contents/MacOS/PromptBar" ]; then
69+
echo "::error::Missing main binary"
70+
exit 1
71+
fi
72+
73+
if [ ! -f "$APP/Contents/Info.plist" ]; then
74+
echo "::error::Missing Info.plist"
75+
exit 1
76+
fi
77+
78+
if [ ! -f "$APP/Contents/Resources/GoogleService-Info.plist" ]; then
79+
echo "::error::Missing GoogleService-Info.plist"
80+
exit 1
81+
fi
82+
83+
if [ ! -d "$APP/Contents/Resources/Assets.car" ]; then
84+
echo "::error::Missing compiled assets"
85+
exit 1
86+
fi
87+
88+
LINKED=$(otool -L "$APP/Contents/MacOS/PromptBar")
89+
for fw in WebKit AppKit SwiftUI; do
90+
if ! echo "$LINKED" | grep -q "$fw"; then
91+
echo "::error::Binary not linked against $fw"
92+
exit 1
93+
fi
94+
done
95+
96+
echo "App bundle validation passed"
97+
98+
# ── Smoke test ────────────────────────────────────────────────
99+
- name: Smoke test (launch and quit)
100+
run: |
101+
APP=$(find ~/Library/Developer/Xcode/DerivedData -name "PromptBar.app" -path "*/Release/*" | head -1)
102+
103+
open "$APP"
104+
sleep 3
105+
106+
if pgrep -x "PromptBar" > /dev/null; then
107+
echo "App launched successfully"
108+
pkill -x "PromptBar"
109+
echo "App terminated cleanly"
110+
else
111+
echo "::error::App failed to launch or crashed on startup"
112+
exit 1
113+
fi
114+
115+
release:
116+
needs: validate
117+
runs-on: macos-15
118+
timeout-minutes: 10
119+
120+
steps:
121+
- name: Checkout
122+
uses: actions/checkout@v4
123+
124+
- name: Extract version from tag
125+
id: version
126+
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
127+
128+
# ── GitHub Release (source-only) ──────────────────────────────
129+
- name: Create GitHub Release
130+
uses: softprops/action-gh-release@v2
131+
with:
132+
name: PromptBar ${{ steps.version.outputs.VERSION }}
133+
generate_release_notes: true

0 commit comments

Comments
 (0)