Verify Build — PR #0 #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Verify Build (Cross-Platform) | |
| run-name: "Verify Build${{ inputs.pr_number && format(' — PR #{0}', inputs.pr_number) || '' }}" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| pr_number: | |
| description: 'PR number to verify' | |
| required: true | |
| type: number | |
| ref: | |
| description: 'Git ref to build (branch or SHA)' | |
| required: true | |
| type: string | |
| env: | |
| DOTNET_NOLOGO: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| jobs: | |
| test: | |
| name: Tests | |
| runs-on: macos-26 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ inputs.ref }} | |
| - uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '10.0.x' | |
| dotnet-quality: 'preview' | |
| - name: Run tests | |
| run: dotnet test PolyPilot.Tests --configuration Release --verbosity normal | |
| build-catalyst: | |
| name: Build Mac Catalyst | |
| runs-on: macos-26 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ inputs.ref }} | |
| - name: Select Xcode | |
| run: | | |
| # Pin to Xcode 26.2 or 26.3 — newer versions have SDK path issues with .NET MAUI | |
| if [ -d "/Applications/Xcode_26.3.app" ]; then | |
| XCODE_PATH="/Applications/Xcode_26.3.app" | |
| elif [ -d "/Applications/Xcode_26.3.0.app" ]; then | |
| XCODE_PATH="/Applications/Xcode_26.3.0.app" | |
| elif [ -d "/Applications/Xcode_26.2.app" ]; then | |
| XCODE_PATH="/Applications/Xcode_26.2.app" | |
| elif [ -d "/Applications/Xcode_26.2.0.app" ]; then | |
| XCODE_PATH="/Applications/Xcode_26.2.0.app" | |
| else | |
| XCODE_PATH=$(ls -d /Applications/Xcode_26*.app 2>/dev/null | grep -v beta | sort -V | head -1) | |
| fi | |
| echo "Selected Xcode: $XCODE_PATH" | |
| sudo xcode-select -s "$XCODE_PATH" | |
| xcodebuild -version | |
| - uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '10.0.x' | |
| dotnet-quality: 'preview' | |
| - name: Install MAUI workload | |
| run: dotnet workload install maui | |
| - name: Build Mac Catalyst | |
| run: dotnet build PolyPilot -f net10.0-maccatalyst -c Release | |
| build-windows: | |
| name: Build Windows | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ inputs.ref }} | |
| - uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '10.0.x' | |
| dotnet-quality: 'preview' | |
| - name: Install MAUI workload | |
| run: dotnet workload install maui | |
| - name: Build Windows | |
| run: dotnet build PolyPilot -f net10.0-windows10.0.19041.0 -c Release | |
| report: | |
| name: Report Results | |
| runs-on: ubuntu-latest | |
| needs: [test, build-catalyst, build-windows] | |
| if: always() && inputs.pr_number > 0 | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ inputs.ref }} | |
| - name: Gather build context | |
| id: context | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| PR=${{ inputs.pr_number }} | |
| # Get previous review comments from gh-aw bot | |
| gh api repos/${{ github.repository }}/pulls/${PR}/reviews \ | |
| --jq '.[] | select(.user.login == "github-actions[bot]") | .body' \ | |
| > /tmp/previous-reviews.txt 2>/dev/null || true | |
| # Get the full diff | |
| gh pr diff "$PR" > /tmp/pr-diff.txt 2>/dev/null || true | |
| # Get PR description | |
| gh pr view "$PR" --json title,body --jq '.title + "\n\n" + .body' > /tmp/pr-desc.txt 2>/dev/null || true | |
| # Get changed files | |
| gh pr diff "$PR" --name-only > /tmp/changed-files.txt 2>/dev/null || true | |
| # Collect build results | |
| echo "test=${{ needs.test.result }}" >> "$GITHUB_OUTPUT" | |
| echo "catalyst=${{ needs.build-catalyst.result }}" >> "$GITHUB_OUTPUT" | |
| echo "windows=${{ needs.build-windows.result }}" >> "$GITHUB_OUTPUT" | |
| - name: Post verification report | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| TEST_RESULT: ${{ steps.context.outputs.test }} | |
| CATALYST_RESULT: ${{ steps.context.outputs.catalyst }} | |
| WINDOWS_RESULT: ${{ steps.context.outputs.windows }} | |
| run: | | |
| PR=${{ inputs.pr_number }} | |
| if [ "$TEST_RESULT" = "success" ] && [ "$CATALYST_RESULT" = "success" ] && [ "$WINDOWS_RESULT" = "success" ]; then | |
| STATUS="✅ All platforms verified" | |
| else | |
| STATUS="❌ Platform verification failed" | |
| fi | |
| # Build the report | |
| cat > /tmp/report.md << 'REPORT_HEADER' | |
| ## Cross-Platform Verification — PR #PRNUM | |
| ### Build Results | |
| | Platform | Status | | |
| |----------|--------| | |
| REPORT_HEADER | |
| sed -i "s/PRNUM/$PR/" /tmp/report.md | |
| echo "| Tests (macOS) | $([ "$TEST_RESULT" = 'success' ] && echo '✅' || echo '❌') $TEST_RESULT |" >> /tmp/report.md | |
| echo "| Mac Catalyst build | $([ "$CATALYST_RESULT" = 'success' ] && echo '✅' || echo '❌') $CATALYST_RESULT |" >> /tmp/report.md | |
| echo "| Windows build | $([ "$WINDOWS_RESULT" = 'success' ] && echo '✅' || echo '❌') $WINDOWS_RESULT |" >> /tmp/report.md | |
| echo "" >> /tmp/report.md | |
| echo "**${STATUS}**" >> /tmp/report.md | |
| echo "" >> /tmp/report.md | |
| # If any build failed, include diagnostic info | |
| if [ "$STATUS" != "✅ All platforms verified" ]; then | |
| echo "### ⚠️ Failed Platforms Need Investigation" >> /tmp/report.md | |
| echo "" >> /tmp/report.md | |
| echo "Check the [workflow run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) for build logs." >> /tmp/report.md | |
| echo "" >> /tmp/report.md | |
| fi | |
| # Include previous review context summary | |
| if [ -s /tmp/previous-reviews.txt ]; then | |
| REVIEW_COUNT=$(grep -c "^##" /tmp/previous-reviews.txt 2>/dev/null || echo "0") | |
| echo "### Previous Review History" >> /tmp/report.md | |
| echo "" >> /tmp/report.md | |
| echo "Found $REVIEW_COUNT automated review(s) on this PR. Build verification validates that all review-driven fixes compile and pass tests across platforms." >> /tmp/report.md | |
| echo "" >> /tmp/report.md | |
| fi | |
| echo "---" >> /tmp/report.md | |
| echo "Triggered by: [verify-build run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> /tmp/report.md | |
| gh pr comment "$PR" --body "$(cat /tmp/report.md)" |