mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-08 17:10:07 +00:00
[fix] Add missing deployment-info artifact creation in playwright workflows
- Capture wrangler deployment URL output and save to GitHub outputs - Create deployment-info artifacts with test results and deployment URLs - Add test exit code tracking in test-ui.yaml workflow - Add PR number logging for debugging - Improve URL extraction with multiple patterns and fallback This fixes the issue where PR comments were missing deployment links because the deployment-info artifacts were never created.
This commit is contained in:
53
.github/workflows/pr-playwright-deploy.yaml
vendored
53
.github/workflows/pr-playwright-deploy.yaml
vendored
@@ -38,6 +38,7 @@ jobs:
|
||||
|
||||
const pr = pullRequests[0];
|
||||
console.log(`✅ Found PR #${pr.number} for branch: ${context.payload.workflow_run.head_branch}`);
|
||||
console.log(`PR number is: ${pr.number}`);
|
||||
const branchName = context.payload.workflow_run.head_branch;
|
||||
const sanitizedBranch = branchName.toLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/--+/g, '-').replace(/^-|-$/g, '');
|
||||
|
||||
@@ -79,14 +80,38 @@ jobs:
|
||||
RETRY_COUNT=0
|
||||
MAX_RETRIES=3
|
||||
SUCCESS=false
|
||||
DEPLOYMENT_URL=""
|
||||
|
||||
while [ $RETRY_COUNT -lt $MAX_RETRIES ] && [ $SUCCESS = false ]; do
|
||||
RETRY_COUNT=$((RETRY_COUNT + 1))
|
||||
echo "Deployment attempt $RETRY_COUNT of $MAX_RETRIES..."
|
||||
|
||||
if npx wrangler pages deploy playwright-report --project-name=${{ steps.project-name.outputs.name }} --branch=${{ steps.project-name.outputs.branch }}; then
|
||||
# Capture wrangler output to extract deployment URL
|
||||
OUTPUT=$(npx wrangler pages deploy playwright-report --project-name=${{ steps.project-name.outputs.name }} --branch=${{ steps.project-name.outputs.branch }} 2>&1)
|
||||
EXIT_CODE=$?
|
||||
|
||||
echo "$OUTPUT"
|
||||
|
||||
if [ $EXIT_CODE -eq 0 ]; then
|
||||
SUCCESS=true
|
||||
echo "Deployment successful on attempt $RETRY_COUNT"
|
||||
# Extract the deployment URL from wrangler output
|
||||
# Look for the URL in various formats that wrangler might output
|
||||
DEPLOYMENT_URL=$(echo "$OUTPUT" | grep -oE 'https://[a-z0-9.-]+\.pages\.dev(/[^[:space:]]*)?$' | head -1)
|
||||
if [ -z "$DEPLOYMENT_URL" ]; then
|
||||
# Try another pattern if the first one fails
|
||||
DEPLOYMENT_URL=$(echo "$OUTPUT" | grep -oE 'https://[^[:space:]]+\.pages\.dev' | head -1)
|
||||
fi
|
||||
if [ -n "$DEPLOYMENT_URL" ]; then
|
||||
echo "Deployment URL: $DEPLOYMENT_URL"
|
||||
echo "url=$DEPLOYMENT_URL" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "Warning: Could not extract deployment URL from wrangler output"
|
||||
# Construct expected URL as fallback
|
||||
FALLBACK_URL="https://${{ steps.project-name.outputs.name }}-${{ steps.project-name.outputs.branch }}.pages.dev"
|
||||
echo "Using fallback URL: $FALLBACK_URL"
|
||||
echo "url=$FALLBACK_URL" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
else
|
||||
echo "Deployment failed on attempt $RETRY_COUNT"
|
||||
if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then
|
||||
@@ -104,6 +129,32 @@ jobs:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
|
||||
- name: Save deployment info
|
||||
if: fromJSON(steps.pr-info.outputs.result).number != null && always()
|
||||
run: |
|
||||
# Read test exit code from the artifact
|
||||
TEST_EXIT_CODE="1"
|
||||
if [ -f "playwright-report/test-exit-code.txt" ]; then
|
||||
TEST_EXIT_CODE=$(cat playwright-report/test-exit-code.txt)
|
||||
fi
|
||||
|
||||
# Use deployment URL if available, otherwise use a fallback
|
||||
URL="${{ steps.cloudflare-deploy.outputs.url }}"
|
||||
if [ -z "$URL" ] || [ "${{ steps.cloudflare-deploy.outcome }}" != "success" ]; then
|
||||
URL="https://${{ steps.project-name.outputs.name }}-${{ steps.project-name.outputs.branch }}.pages.dev"
|
||||
fi
|
||||
|
||||
echo "${{ matrix.browser }}|$TEST_EXIT_CODE|$URL" > deployment-info.txt
|
||||
echo "Saved deployment info: ${{ matrix.browser }}|$TEST_EXIT_CODE|$URL"
|
||||
|
||||
- name: Upload deployment info
|
||||
if: fromJSON(steps.pr-info.outputs.result).number != null && always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: deployment-info-${{ matrix.browser }}
|
||||
path: deployment-info.txt
|
||||
retention-days: 1
|
||||
|
||||
comment-tests-starting:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'Comfy-Org/ComfyUI_frontend' && github.event.workflow_run.event == 'pull_request' && github.event.action == 'requested'
|
||||
|
||||
11
.github/workflows/test-ui.yaml
vendored
11
.github/workflows/test-ui.yaml
vendored
@@ -139,11 +139,20 @@ jobs:
|
||||
id: playwright
|
||||
run: npx playwright test --project=${{ matrix.browser }} --reporter=html
|
||||
working-directory: ComfyUI_frontend
|
||||
continue-on-error: true
|
||||
|
||||
- name: Save test exit code
|
||||
if: always()
|
||||
run: |
|
||||
echo "${{ steps.playwright.outcome == 'success' && '0' || '1' }}" > test-exit-code.txt
|
||||
echo "Test outcome: ${{ steps.playwright.outcome }}"
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always() # note: use always() to allow results to be upload/report even tests failed.
|
||||
with:
|
||||
name: playwright-report-${{ matrix.browser }}
|
||||
path: ComfyUI_frontend/playwright-report/
|
||||
path: |
|
||||
ComfyUI_frontend/playwright-report/
|
||||
test-exit-code.txt
|
||||
retention-days: 30
|
||||
|
||||
|
||||
Reference in New Issue
Block a user