Add test workflow for nightly releases

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Lea Anthony 2025-07-06 07:00:18 +10:00
commit 6b35e06780

View file

@ -0,0 +1,216 @@
name: Test Nightly Releases (Dry Run)
on:
workflow_dispatch:
inputs:
dry_run:
description: 'Run in dry-run mode (no actual releases)'
required: false
default: true
type: boolean
test_branch:
description: 'Branch to test against'
required: false
default: 'master'
type: string
env:
GO_VERSION: '1.24'
jobs:
test-permissions:
name: Test Release Permissions
runs-on: ubuntu-latest
outputs:
authorized: ${{ steps.check.outputs.authorized }}
steps:
- name: Check if user is authorized
id: check
run: |
# Test authorization logic
AUTHORIZED_USERS="leaanthony"
if [[ "$AUTHORIZED_USERS" == *"${{ github.actor }}"* ]]; then
echo "✅ User ${{ github.actor }} is authorized"
echo "authorized=true" >> $GITHUB_OUTPUT
else
echo "❌ User ${{ github.actor }} is not authorized"
echo "authorized=false" >> $GITHUB_OUTPUT
fi
test-changelog-extraction:
name: Test Changelog Extraction
runs-on: ubuntu-latest
needs: test-permissions
if: needs.test-permissions.outputs.authorized == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.test_branch }}
fetch-depth: 0
- name: Test v2 changelog extraction
run: |
echo "🧪 Testing v2 changelog extraction..."
CHANGELOG_FILE="website/src/pages/changelog.mdx"
if [ ! -f "$CHANGELOG_FILE" ]; then
echo "❌ v2 changelog file not found"
exit 1
fi
# Extract unreleased section
awk '
/^## \[Unreleased\]/ { found=1; next }
found && /^## / { exit }
found && !/^$/ { print }
' $CHANGELOG_FILE > v2_release_notes.md
echo "📝 v2 changelog content (first 10 lines):"
head -10 v2_release_notes.md || echo "No content found"
echo "Total lines: $(wc -l < v2_release_notes.md)"
- name: Test v3 changelog extraction (if accessible)
run: |
echo "🧪 Testing v3 changelog extraction..."
if git show v3-alpha:docs/src/content/docs/changelog.mdx > /dev/null 2>&1; then
echo "✅ v3 changelog accessible"
git show v3-alpha:docs/src/content/docs/changelog.mdx | awk '
/^## \[Unreleased\]/ { found=1; next }
found && /^## / { exit }
found && !/^$/ { print }
' > v3_release_notes.md
echo "📝 v3 changelog content (first 10 lines):"
head -10 v3_release_notes.md || echo "No content found"
echo "Total lines: $(wc -l < v3_release_notes.md)"
else
echo "⚠️ v3 changelog not accessible from current context"
fi
test-version-detection:
name: Test Version Detection
runs-on: ubuntu-latest
needs: test-permissions
if: needs.test-permissions.outputs.authorized == 'true'
outputs:
v2_current_version: ${{ steps.versions.outputs.v2_current }}
v2_next_patch: ${{ steps.versions.outputs.v2_next_patch }}
v2_next_minor: ${{ steps.versions.outputs.v2_next_minor }}
v2_next_major: ${{ steps.versions.outputs.v2_next_major }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Test version detection logic
id: versions
run: |
echo "🧪 Testing version detection..."
# Test v2 version parsing
if [ -f "v2/cmd/wails/internal/version.txt" ]; then
CURRENT_V2=$(cat v2/cmd/wails/internal/version.txt | sed 's/^v//')
echo "Current v2 version: v$CURRENT_V2"
echo "v2_current=v$CURRENT_V2" >> $GITHUB_OUTPUT
# Parse and increment
IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_V2"
MAJOR=${VERSION_PARTS[0]}
MINOR=${VERSION_PARTS[1]}
PATCH=${VERSION_PARTS[2]}
PATCH_VERSION="v$MAJOR.$MINOR.$((PATCH + 1))"
MINOR_VERSION="v$MAJOR.$((MINOR + 1)).0"
MAJOR_VERSION="v$((MAJOR + 1)).0.0"
echo "v2_next_patch=$PATCH_VERSION" >> $GITHUB_OUTPUT
echo "v2_next_minor=$MINOR_VERSION" >> $GITHUB_OUTPUT
echo "v2_next_major=$MAJOR_VERSION" >> $GITHUB_OUTPUT
echo "✅ Patch: v$CURRENT_V2 → $PATCH_VERSION"
echo "✅ Minor: v$CURRENT_V2 → $MINOR_VERSION"
echo "✅ Major: v$CURRENT_V2 → $MAJOR_VERSION"
else
echo "❌ v2 version file not found"
fi
test-commit-analysis:
name: Test Commit Analysis
runs-on: ubuntu-latest
needs: test-permissions
if: needs.test-permissions.outputs.authorized == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Test commit analysis
run: |
echo "🧪 Testing commit analysis..."
# Get recent commits for testing
echo "Recent commits:"
git log --oneline -10
# Test conventional commit detection
RECENT_COMMITS=$(git log --oneline --since="7 days ago")
echo "Commits from last 7 days:"
echo "$RECENT_COMMITS"
# Analyze for release type
RELEASE_TYPE="patch"
if echo "$RECENT_COMMITS" | grep -q "feat!\|fix!\|BREAKING CHANGE:"; then
RELEASE_TYPE="major"
elif echo "$RECENT_COMMITS" | grep -q "feat\|BREAKING CHANGE"; then
RELEASE_TYPE="minor"
fi
echo "✅ Detected release type: $RELEASE_TYPE"
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [test-permissions, test-changelog-extraction, test-version-detection, test-commit-analysis]
if: always()
steps:
- name: Print test results
run: |
echo "# 🧪 Nightly Release Workflow Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "${{ needs.test-permissions.result }}" == "success" ]; then
echo "✅ **Permissions Test**: Passed" >> $GITHUB_STEP_SUMMARY
else
echo "❌ **Permissions Test**: Failed" >> $GITHUB_STEP_SUMMARY
fi
if [ "${{ needs.test-changelog-extraction.result }}" == "success" ]; then
echo "✅ **Changelog Extraction**: Passed" >> $GITHUB_STEP_SUMMARY
else
echo "❌ **Changelog Extraction**: Failed" >> $GITHUB_STEP_SUMMARY
fi
if [ "${{ needs.test-version-detection.result }}" == "success" ]; then
echo "✅ **Version Detection**: Passed" >> $GITHUB_STEP_SUMMARY
echo " - Current v2: ${{ needs.test-version-detection.outputs.v2_current_version }}" >> $GITHUB_STEP_SUMMARY
echo " - Next patch: ${{ needs.test-version-detection.outputs.v2_next_patch }}" >> $GITHUB_STEP_SUMMARY
echo " - Next minor: ${{ needs.test-version-detection.outputs.v2_next_minor }}" >> $GITHUB_STEP_SUMMARY
echo " - Next major: ${{ needs.test-version-detection.outputs.v2_next_major }}" >> $GITHUB_STEP_SUMMARY
else
echo "❌ **Version Detection**: Failed" >> $GITHUB_STEP_SUMMARY
fi
if [ "${{ needs.test-commit-analysis.result }}" == "success" ]; then
echo "✅ **Commit Analysis**: Passed" >> $GITHUB_STEP_SUMMARY
else
echo "❌ **Commit Analysis**: Failed" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Note**: This was a dry-run test. No actual releases were created." >> $GITHUB_STEP_SUMMARY