Skip to content

Update Jupyter Releaser GitHub Actions #3084

Update Jupyter Releaser GitHub Actions

Update Jupyter Releaser GitHub Actions #3084

Workflow file for this run

name: UI Tests
on:
push:
branches: ['main']
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Build
uses: ./.github/actions/build-dist
ui-tests:
needs: [build]
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
browser: [firefox, chromium]
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@95d85449e4f3f352e261221f6529f8ed307f5728 # v1
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: notebook-dist-${{ github.run_number }}
path: ./dist
- name: Install the package
run: |
cd dist
python -m pip install -vv notebook*.whl
- name: Install the test dependencies
run: |
cd ui-tests
jlpm
jlpm playwright install
- name: Test
env:
# Tag every test with the browser so the merged report can attribute results (see playwright.config.ts).
PLAYWRIGHT_TEST_TAG: '@${{ matrix.browser }}'
# Unique blob filename per browser to avoid collisions when merging (see playwright.config.ts).
BLOB_FILENAME: report-${{ matrix.browser }}.zip
run: |
cd ui-tests
jlpm test --browser ${{ matrix.browser }}
- name: Upload Playwright Test assets
if: ${{ !cancelled() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: notebook-${{ matrix.browser }}-test-assets
path: |
ui-tests/test-results
- name: Upload blob report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: notebook-blobs-${{ matrix.browser }}
path: ui-tests/blob-report
retention-days: 1
compression-level: 1
- name: Update snapshots
if: failure()
run: |
cd ui-tests
# remove previous snapshots from other browser
jlpm rimraf "test/**/*-snapshots/*.png"
# generate new snapshots
jlpm run test:update --browser ${{ matrix.browser }}
- name: Upload updated snapshots
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: notebook-${{ matrix.browser }}-updated-snapshots
path: ui-tests/test
merge-reports:
name: Merge UI Test Reports
if: ${{ !cancelled() }}
needs: ui-tests
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout lockfile
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
sparse-checkout: ui-tests/yarn.lock
sparse-checkout-cone-mode: false
persist-credentials: false
- name: Find out Playwright version
id: pw-version
run: |
set -e
PW_VERSION=$(grep -m1 '^"playwright@npm:' ui-tests/yarn.lock | sed -E 's/^"playwright@npm:([^"]+)":/\1/')
if ! [[ "$PW_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "Could not extract Playwright version from ui-tests/yarn.lock (got: '$PW_VERSION')" >&2
exit 1
fi
echo "Playwright version: $PW_VERSION"
echo "version=$PW_VERSION" >> $GITHUB_OUTPUT
- name: Download blob artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
path: blob-reports
pattern: notebook-blobs-*
merge-multiple: true
- name: Merge Playwright reports
env:
PW_VERSION: ${{ steps.pw-version.outputs.version }}
run: |
npx "playwright@$PW_VERSION" merge-reports --reporter html,github ./blob-reports/
- name: Upload merged report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: notebook-test-report
path: playwright-report
- name: Inline the report
uses: jupyterlab/maintainer-tools/.github/actions/inline-playwright-report@95d85449e4f3f352e261221f6529f8ed307f5728 # v1
with:
path: playwright-report
- name: Upload inlined report
id: upload-report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
archive: false
name: notebook-test-report-standalone
path: playwright-report/output.html
- name: Add report link to job summary
env:
REPORT_URL: ${{ steps.upload-report.outputs.artifact-url }}
run: |
echo "**[View UI Test Report]($REPORT_URL)**" >> $GITHUB_STEP_SUMMARY