Skip to content

Commit 2a14636

Browse files
committed
feat: enhance workflows with manual inputs for testing and dry run options
1 parent 45dd168 commit 2a14636

File tree

2 files changed

+59
-6
lines changed

2 files changed

+59
-6
lines changed

.github/workflows/build.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# It runs tests to verify main branch integrity, then builds self-contained executables
55
# for macOS (x64, ARM64) and Windows (x64), and performs smoke tests on each.
66
#
7-
# Triggers: Push to 'main' branch
7+
# Triggers: Push to 'main' branch, Manual dispatch
88
# Performance Target: ≤15 minutes total
99
# Artifacts: Self-contained executables with metadata and checksums
1010

@@ -14,6 +14,12 @@ on:
1414
push:
1515
branches: [main]
1616
workflow_dispatch: # Allow manual triggering for debugging
17+
inputs:
18+
skip_tests:
19+
description: 'Skip test job (for faster workflow testing)'
20+
required: false
21+
type: boolean
22+
default: false
1723

1824
# Cancel in-progress builds for the same commit to save resources
1925
concurrency:
@@ -32,6 +38,7 @@ jobs:
3238
test:
3339
name: Test on Main
3440
runs-on: ubuntu-latest
41+
if: ${{ github.event.inputs.skip_tests != 'true' }}
3542

3643
steps:
3744
- name: Checkout code
@@ -75,6 +82,7 @@ jobs:
7582
name: Build macOS x64
7683
runs-on: macos-latest
7784
needs: test
85+
if: ${{ always() && (needs.test.result == 'success' || needs.test.result == 'skipped') }}
7886

7987
steps:
8088
- name: Checkout code
@@ -142,6 +150,7 @@ jobs:
142150
name: Build macOS ARM64
143151
runs-on: macos-latest
144152
needs: test
153+
if: ${{ always() && (needs.test.result == 'success' || needs.test.result == 'skipped') }}
145154

146155
steps:
147156
- name: Checkout code
@@ -209,6 +218,7 @@ jobs:
209218
name: Build Windows x64
210219
runs-on: windows-latest
211220
needs: test
221+
if: ${{ always() && (needs.test.result == 'success' || needs.test.result == 'skipped') }}
212222

213223
steps:
214224
- name: Checkout code
@@ -287,12 +297,12 @@ jobs:
287297
path: ./artifacts
288298

289299
- name: Set executable permissions
290-
run: chmod +x ./artifacts/TenSecondTom
300+
run: chmod +x ./artifacts/tom
291301

292302
- name: Run smoke test (--version)
293303
run: |
294304
echo "🧪 Running smoke test: --version"
295-
./artifacts/TenSecondTom --version
305+
./artifacts/tom --version
296306
297307
if [ $? -eq 0 ]; then
298308
echo "✅ Smoke test passed: executable runs successfully"
@@ -317,12 +327,12 @@ jobs:
317327
path: ./artifacts
318328

319329
- name: Set executable permissions
320-
run: chmod +x ./artifacts/TenSecondTom
330+
run: chmod +x ./artifacts/tom
321331

322332
- name: Run smoke test (--version)
323333
run: |
324334
echo "🧪 Running smoke test: --version"
325-
./artifacts/TenSecondTom --version
335+
./artifacts/tom --version
326336
327337
if [ $? -eq 0 ]; then
328338
echo "✅ Smoke test passed: executable runs successfully"

.github/workflows/release.yml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,22 @@
99
# Triggers: Push of semantic version tag (e.g., v1.2.3)
1010
# Performance Target: ≤10 minutes total (excluding manual approval)
1111
# Artifacts: Reuses build artifacts, creates release packages
12+
#
13+
# Manual Testing on PR:
14+
# 1. Run Build workflow manually on your PR branch first
15+
# 2. Note the commit SHA from the build run
16+
# 3. Use Actions tab → Release → Run workflow
17+
# - Select your PR branch
18+
# - Enter test version (e.g., v0.0.1-test)
19+
# - Check 'Skip Homebrew' to avoid tap updates
20+
# - Check 'Dry run' to skip actual release creation
21+
# 4. Review logs to verify workflow logic
22+
#
23+
# Production Release:
24+
# 1. Merge PR to main → triggers build.yml automatically
25+
# 2. Wait for build to complete successfully
26+
# 3. Tag the merge commit: git tag v1.0.0 && git push origin v1.0.0
27+
# 4. Release workflow triggers automatically
1228

1329
name: Release
1430

@@ -19,9 +35,19 @@ on:
1935
workflow_dispatch: # Allow manual triggering for testing
2036
inputs:
2137
tag:
22-
description: 'Version tag to release (e.g., v1.2.3)'
38+
description: 'Version tag to release (e.g., v0.0.1-test for testing)'
2339
required: true
2440
type: string
41+
skip_homebrew:
42+
description: 'Skip Homebrew publication (for PR testing)'
43+
required: false
44+
type: boolean
45+
default: false
46+
dry_run:
47+
description: 'Dry run - skip release creation (logs only)'
48+
required: false
49+
type: boolean
50+
default: false
2551

2652
# Prevent concurrent releases to avoid conflicts
2753
# Do not cancel in-progress releases as they involve publishing to external services
@@ -269,6 +295,15 @@ jobs:
269295
run: |
270296
VERSION="v${{ needs.validate-version.outputs.version }}"
271297
298+
# Check if this is a dry run
299+
if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
300+
echo "🧪 DRY RUN - Would create release $VERSION"
301+
echo "📝 Release notes:"
302+
cat release-notes.md
303+
echo "⏭️ Skipping actual release creation"
304+
exit 0
305+
fi
306+
272307
# Create release with notes
273308
gh release create "$VERSION" \
274309
--title "Release $VERSION" \
@@ -278,6 +313,12 @@ jobs:
278313
279314
echo "✅ GitHub release created: $VERSION"
280315
316+
# Check if this is a dry run
317+
if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
318+
echo "🧪 DRY RUN - Skipping artifact uploads"
319+
exit 0
320+
fi
321+
281322
# Upload all artifacts
282323
echo "📤 Uploading artifacts..."
283324
@@ -303,10 +344,12 @@ jobs:
303344
# Performance Target: ≤7 minutes
304345
# Requires: HOMEBREW_TAP_TOKEN secret configured in 'production' environment
305346
# Note: VS Code may show "'production' is not valid" - this is a false positive
347+
# Can be skipped with workflow_dispatch skip_homebrew input for PR testing
306348
publish-homebrew:
307349
name: Publish to Homebrew
308350
runs-on: macos-latest # Changed to macOS for bottle creation
309351
needs: [validate-version, create-github-release]
352+
if: ${{ github.event.inputs.skip_homebrew != 'true' && github.event.inputs.dry_run != 'true' }}
310353
environment:
311354
name: production # Configured in GitHub repository settings
312355
permissions:

0 commit comments

Comments
 (0)