fix(ci): address critical workflow and validation issues
Addresses code review feedback on PR #418: CRITICAL FIXES: 1. Workflow trigger: Changed from release:published to push:tags - Enables "tag and publish in one step" workflow as intended - Automatically creates GitHub release on tag push - Removed redundant if condition (filtering now via trigger) - Added prerelease detection based on tag (-alpha, -beta, -rc) 2. Server path: Explicitly pass server_dir to make command - Fixes path mismatch between local (../../server) and CI - Uses absolute path: server_dir=${{ github.workspace }}/server - Prevents signing failures in GitHub Actions 3. Regex validation: Added test script for commitizen patterns - Validates scope filtering works correctly - Tests all three components: mcp, helm, astrolabe - Tests unscoped commits (default to mcp) - Tests breaking changes and invalid commits - Location: scripts/test-commitizen-scopes.sh WORKFLOW IMPROVEMENTS: - Release creation now automatic on tag push - Better step naming for clarity - Consistent prerelease handling across GitHub and App Store - Explicit server_dir prevents reliance on fragile relative paths All 16 test cases pass for scope filtering patterns.
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
name: Build and Publish Astrolabe App Release
|
name: Build and Publish Astrolabe App Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
push:
|
||||||
types: [published]
|
tags:
|
||||||
|
- 'astrolabe-v*'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
APP_NAME: astrolabe
|
APP_NAME: astrolabe
|
||||||
@@ -11,8 +12,6 @@ env:
|
|||||||
jobs:
|
jobs:
|
||||||
build-and-publish:
|
build-and-publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# Only run on Astrolabe releases
|
|
||||||
if: startsWith(github.ref, 'refs/tags/astrolabe-v')
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
@@ -66,15 +65,17 @@ jobs:
|
|||||||
|
|
||||||
- name: Build app store package
|
- name: Build app store package
|
||||||
working-directory: ${{ env.APP_DIR }}
|
working-directory: ${{ env.APP_DIR }}
|
||||||
run: make appstore
|
run: make appstore server_dir=${{ github.workspace }}/server
|
||||||
|
|
||||||
- name: Attach tarball to GitHub release
|
- name: Create GitHub release and attach tarball
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: ${{ env.APP_DIR }}/build/artifacts/${{ env.APP_NAME }}.tar.gz
|
file: ${{ env.APP_DIR }}/build/artifacts/${{ env.APP_NAME }}.tar.gz
|
||||||
asset_name: ${{ env.APP_NAME }}-${{ steps.tag.outputs.TAG }}.tar.gz
|
asset_name: ${{ env.APP_NAME }}-${{ steps.tag.outputs.TAG }}.tar.gz
|
||||||
tag: ${{ github.ref }}
|
tag: ${{ github.ref }}
|
||||||
|
release_name: Astrolabe ${{ steps.tag.outputs.TAG }}
|
||||||
|
prerelease: ${{ contains(steps.tag.outputs.TAG, '-alpha') || contains(steps.tag.outputs.TAG, '-beta') || contains(steps.tag.outputs.TAG, '-rc') }}
|
||||||
|
|
||||||
- name: Upload to Nextcloud App Store
|
- name: Upload to Nextcloud App Store
|
||||||
uses: R0Wi/nextcloud-appstore-push-action@v1.0.6
|
uses: R0Wi/nextcloud-appstore-push-action@v1.0.6
|
||||||
@@ -83,4 +84,4 @@ jobs:
|
|||||||
appstore_token: ${{ secrets.APPSTORE_TOKEN }}
|
appstore_token: ${{ secrets.APPSTORE_TOKEN }}
|
||||||
download_url: ${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.ref_name }}/${{ env.APP_NAME }}-${{ steps.tag.outputs.TAG }}.tar.gz
|
download_url: ${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.ref_name }}/${{ env.APP_NAME }}-${{ steps.tag.outputs.TAG }}.tar.gz
|
||||||
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
|
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
|
||||||
nightly: ${{ github.event.release.prerelease }}
|
nightly: ${{ contains(steps.tag.outputs.TAG, '-alpha') || contains(steps.tag.outputs.TAG, '-beta') || contains(steps.tag.outputs.TAG, '-rc') }}
|
||||||
|
|||||||
Executable
+102
@@ -0,0 +1,102 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Test commitizen scope filtering patterns
|
||||||
|
set -uo pipefail
|
||||||
|
|
||||||
|
echo "Testing commitizen scope filtering patterns..."
|
||||||
|
echo
|
||||||
|
|
||||||
|
# Regex patterns from configs
|
||||||
|
MCP_PATTERN='^(feat|fix|docs|refactor|perf|test|build|ci|chore)(\(mcp\))?(!)?:'
|
||||||
|
HELM_PATTERN='^(feat|fix|docs|refactor|perf|test|build|ci|chore)\(helm\)(!)?:'
|
||||||
|
ASTROLABE_PATTERN='^(feat|fix|docs|refactor|perf|test|build|ci|chore)\(astrolabe\)(!)?:'
|
||||||
|
|
||||||
|
test_pattern() {
|
||||||
|
local message="$1"
|
||||||
|
local pattern="$2"
|
||||||
|
|
||||||
|
if echo "$message" | grep -qE "$pattern"; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
run_test() {
|
||||||
|
local message="$1"
|
||||||
|
local expected="$2"
|
||||||
|
local matched_components=()
|
||||||
|
|
||||||
|
# Check which components match
|
||||||
|
if test_pattern "$message" "$MCP_PATTERN"; then
|
||||||
|
matched_components+=("mcp")
|
||||||
|
fi
|
||||||
|
if test_pattern "$message" "$HELM_PATTERN"; then
|
||||||
|
matched_components+=("helm")
|
||||||
|
fi
|
||||||
|
if test_pattern "$message" "$ASTROLABE_PATTERN"; then
|
||||||
|
matched_components+=("astrolabe")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Convert array to space-separated string, or "none" if empty
|
||||||
|
local matched
|
||||||
|
if [ ${#matched_components[@]} -eq 0 ]; then
|
||||||
|
matched="none"
|
||||||
|
else
|
||||||
|
matched="${matched_components[*]}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Validate expectation
|
||||||
|
if [ "$matched" = "$expected" ]; then
|
||||||
|
echo "✓ PASS: '$message'"
|
||||||
|
echo " → Matched: $matched"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
echo "✗ FAIL: '$message'"
|
||||||
|
echo " → Matched: $matched (expected: $expected)"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run all test cases
|
||||||
|
failed=0
|
||||||
|
passed=0
|
||||||
|
|
||||||
|
# MCP server commits (scope=mcp or unscoped)
|
||||||
|
run_test "feat: add new feature" "mcp" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
run_test "feat(mcp): add API endpoint" "mcp" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
run_test "fix(mcp): resolve authentication bug" "mcp" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
run_test "docs: update README" "mcp" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
|
||||||
|
# Helm chart commits
|
||||||
|
run_test "feat(helm): add resource limits" "helm" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
run_test "fix(helm): correct values schema" "helm" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
run_test "docs(helm): update deployment guide" "helm" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
|
||||||
|
# Astrolabe commits
|
||||||
|
run_test "feat(astrolabe): add dark mode" "astrolabe" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
run_test "fix(astrolabe): resolve UI bug" "astrolabe" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
run_test "perf(astrolabe): optimize rendering" "astrolabe" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
|
||||||
|
# Breaking changes
|
||||||
|
run_test "feat(mcp)!: breaking API change" "mcp" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
run_test "feat(helm)!: rename values" "helm" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
run_test "feat(astrolabe)!: remove deprecated feature" "astrolabe" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
|
||||||
|
# Invalid commits (should not match any)
|
||||||
|
run_test "feat(invalid): test" "none" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
run_test "random commit message" "none" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
run_test "feat (mcp): space before scope" "none" && passed=$((passed+1)) || failed=$((failed+1))
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
echo
|
||||||
|
echo "=========================================="
|
||||||
|
echo "Results: $passed passed, $failed failed"
|
||||||
|
echo "=========================================="
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
echo "❌ Some tests failed - scope patterns may need adjustment"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "✅ All tests passed - scope patterns working correctly"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user