Repository navigation
tests BiDi #115
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: tests BiDi | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| ref: | |
| description: Playwright SHA / ref to test. Use 'refs/pull/PULL_REQUEST_ID/head' to test a PR. Defaults to the current branch. | |
| required: false | |
| default: '' | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - .github/workflows/tests_bidi.yml | |
| - packages/playwright-core/src/server/bidi/** | |
| - tests/bidi/** | |
| schedule: | |
| # Run every day at midnight | |
| - cron: '0 0 * * *' | |
| env: | |
| FORCE_COLOR: 1 | |
| jobs: | |
| test_bidi: | |
| name: BiDi | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read # This is required for actions/checkout to succeed | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| channel: [bidi-chromium, moz-firefox-nightly] | |
| isPullRequest: | |
| - ${{ github.event_name == 'pull_request' }} | |
| exclude: | |
| - isPullRequest: true | |
| channel: bidi-chromium | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| if: github.event_name != 'workflow_dispatch' | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| if: github.event_name == 'workflow_dispatch' | |
| with: | |
| ref: ${{ github.event.inputs.ref }} | |
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: 20 | |
| - run: npm ci | |
| - run: npm run build | |
| # Needed for video tests | |
| - run: npx playwright install ffmpeg | |
| - run: npx playwright install --with-deps chromium | |
| - if: matrix.channel == 'moz-firefox-nightly' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libavcodec60 | |
| echo "BIDI_FFPATH=$(npx -y @puppeteer/browsers install firefox@nightly | tail -n1 | sed 's/^[^ ]* *//')" >> "$GITHUB_ENV" | |
| - name: Run tests | |
| run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run biditest -- --retries=${{ matrix.isPullRequest && 2 || 0 }} --project=${{ matrix.channel }}* | |
| env: | |
| PWTEST_USE_BIDI_EXPECTATIONS: ${{ matrix.isPullRequest && '1' || '' }} | |
| # Name the report after the channel so that the publish job can merge all of | |
| # them into one directory without collisions. | |
| - name: Name the csv report after the channel | |
| if: ${{ !cancelled() && hashFiles('test-results/report.csv') != '' }} | |
| run: cp test-results/report.csv "$RUNNER_TEMP/${{ matrix.channel }}.csv" | |
| - name: Upload csv report to GitHub | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: csv-report-${{ matrix.channel }} | |
| path: ${{ runner.temp }}/${{ matrix.channel }}.csv | |
| retention-days: 7 | |
| - name: Upload json report to GitHub | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: json-report-${{ matrix.channel }} | |
| path: test-results/report.json | |
| retention-days: 7 | |
| - name: Upload parquet report | |
| if: ${{ !cancelled() }} | |
| uses: ./.github/actions/upload-parquet-report | |
| with: | |
| job_name: ${{ matrix.channel }} | |
| - name: Add report to the job summary | |
| if: ${{ !cancelled() && hashFiles('test-results/report.md') != '' }} | |
| run: cat test-results/report.md >> "$GITHUB_STEP_SUMMARY" | |
| publish_reports: | |
| name: Publish reports | |
| needs: test_bidi | |
| if: ${{ !cancelled() && github.ref == 'refs/heads/main' && github.repository == 'microsoft/playwright' }} | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: write # This is required to push to the bidi-reports branch | |
| steps: | |
| - name: Download csv reports | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| pattern: csv-report-* | |
| merge-multiple: true | |
| path: csv-reports | |
| - name: Publish the reports to the bidi-reports branch | |
| run: | | |
| git init -q "$RUNNER_TEMP/reports" | |
| cd "$RUNNER_TEMP/reports" | |
| git remote add origin "https://x-access-token:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" | |
| git fetch --depth=1 origin bidi-reports | |
| git reset --hard FETCH_HEAD | |
| channels=() | |
| for file in "$GITHUB_WORKSPACE"/csv-reports/*.csv; do | |
| channel=$(basename "$file" .csv) | |
| cp "$file" "$channel.csv" | |
| channels+=("$channel") | |
| done | |
| git add -A | |
| if git diff --cached --quiet; then | |
| echo "No changes since the last run." | |
| exit 0 | |
| fi | |
| git commit -q -m "bidi: results for ${GITHUB_SHA:0:9}" | |
| git push origin HEAD:bidi-reports | |
| for channel in "${channels[@]}"; do | |
| echo "Report url: https://github.com/$GITHUB_REPOSITORY/blob/bidi-reports/$channel.csv" | |
| echo "Raw report url: https://raw.githubusercontent.com/$GITHUB_REPOSITORY/bidi-reports/$channel.csv" | |
| done | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GIT_AUTHOR_NAME: microsoft-playwright-automation[bot] | |
| GIT_AUTHOR_EMAIL: 203992400+microsoft-playwright-automation[bot]@users.noreply.github.com | |
| GIT_COMMITTER_NAME: microsoft-playwright-automation[bot] | |
| GIT_COMMITTER_EMAIL: 203992400+microsoft-playwright-automation[bot]@users.noreply.github.com |