|
| 1 | +name: Hosted player check |
| 2 | + |
| 3 | +# Opens trace zips through the deployed trace player (vars.HOSTED_PLAYER_URL) |
| 4 | +# with the same check ci.yml's hosted-player job runs against a local build, |
| 5 | +# so a deploy that builds but fails in the browser is caught before a user |
| 6 | +# reports it. Skipped while the variable is unset. A failure opens one issue |
| 7 | +# and comments on it while it stays open; a pass closes it. The page itself |
| 8 | +# gains nothing: no analytics, no tracking. |
| 9 | + |
| 10 | +on: |
| 11 | + schedule: |
| 12 | + - cron: '23 */6 * * *' |
| 13 | + workflow_dispatch: |
| 14 | + # Vercel's Git integration reports each deploy as a GitHub deployment. |
| 15 | + deployment_status: |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | + |
| 20 | +# One run at a time, so two failures cannot each open an issue. |
| 21 | +concurrency: |
| 22 | + group: scheduled-hosted-player |
| 23 | + cancel-in-progress: false |
| 24 | + |
| 25 | +env: |
| 26 | + ISSUE_TITLE: Hosted trace player check is failing |
| 27 | + |
| 28 | +jobs: |
| 29 | + check: |
| 30 | + if: >- |
| 31 | + vars.HOSTED_PLAYER_URL != '' && |
| 32 | + (github.event_name != 'deployment_status' || |
| 33 | + (github.event.deployment_status.state == 'success' && |
| 34 | + github.event.deployment.environment == 'Production')) |
| 35 | + runs-on: ubuntu-latest |
| 36 | + timeout-minutes: 15 |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 39 | + - name: Use Node.js |
| 40 | + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 |
| 41 | + with: |
| 42 | + node-version-file: .nvmrc |
| 43 | + # the runner cache can hold a 24.x below the engines floor |
| 44 | + check-latest: true |
| 45 | + - name: Cache pnpm modules |
| 46 | + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
| 47 | + env: |
| 48 | + cache-name: cache-pnpm-modules |
| 49 | + with: |
| 50 | + path: ~/.pnpm-store |
| 51 | + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 52 | + restore-keys: | |
| 53 | + ${{ runner.os }}-build-${{ env.cache-name }}- |
| 54 | + - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10 |
| 55 | + with: |
| 56 | + version: 10.26.1 |
| 57 | + run_install: false |
| 58 | + - name: Install dependencies |
| 59 | + run: pnpm install --frozen-lockfile |
| 60 | + - name: Chrome version |
| 61 | + run: google-chrome --version |
| 62 | + - name: 🎞️ Open traces in ${{ vars.HOSTED_PLAYER_URL }} |
| 63 | + env: |
| 64 | + HOSTED_PLAYER_URL: ${{ vars.HOSTED_PLAYER_URL }} |
| 65 | + run: pnpm exec tsx packages/conformance/hosted-player/run.ts --url "$HOSTED_PLAYER_URL" |
| 66 | + |
| 67 | + report: |
| 68 | + needs: check |
| 69 | + if: ${{ always() && (needs.check.result == 'failure' || needs.check.result == 'success') }} |
| 70 | + runs-on: ubuntu-latest |
| 71 | + permissions: |
| 72 | + issues: write |
| 73 | + env: |
| 74 | + GH_TOKEN: ${{ github.token }} |
| 75 | + GH_REPO: ${{ github.repository }} |
| 76 | + OUTCOME: ${{ needs.check.result }} |
| 77 | + HOSTED_PLAYER_URL: ${{ vars.HOSTED_PLAYER_URL }} |
| 78 | + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
| 79 | + TRIGGER: ${{ github.event_name }} |
| 80 | + steps: |
| 81 | + # Listed rather than searched: the search index lags, and a just-opened issue would be missed. |
| 82 | + - name: Open, update or close the tracking issue |
| 83 | + run: | |
| 84 | + set -o pipefail |
| 85 | + OPEN=$(gh issue list --state open --limit 500 --json number,title | |
| 86 | + jq -r --arg title "$ISSUE_TITLE" 'map(select(.title == $title)) | .[0].number // empty') |
| 87 | + if [ "$OUTCOME" = failure ]; then |
| 88 | + if [ -n "$OPEN" ]; then |
| 89 | + gh issue comment "$OPEN" --body "Still failing ($TRIGGER): $RUN_URL" |
| 90 | + else |
| 91 | + gh issue create --title "$ISSUE_TITLE" --body "The hosted player check against $HOSTED_PLAYER_URL failed ($TRIGGER): $RUN_URL |
| 92 | +
|
| 93 | + It opens the committed trace fixtures through the deployed page in headless Chrome. The run log names the step and the error; \`pnpm exec tsx packages/conformance/hosted-player/run.ts --url $HOSTED_PLAYER_URL\` reproduces it locally. This issue is commented on while the check keeps failing and closed when it passes." |
| 94 | + fi |
| 95 | + elif [ -n "$OPEN" ]; then |
| 96 | + gh issue close "$OPEN" --comment "Passing again: $RUN_URL" |
| 97 | + fi |
0 commit comments