Skip to content

Commit

Permalink
Set up volume to upload test assets
Browse files Browse the repository at this point in the history
  • Loading branch information
fcollonval committed Mar 25, 2024
1 parent 48d3b49 commit dd4b665
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 15 deletions.
77 changes: 64 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ jobs:
fail-fast: false
timeout-minutes: 45
runs-on: ubuntu-22.04
env:
DOCKER_VOLUME: ${{ github.workspace }}/shared-volume
steps:
- name: Download artifact
uses: actions/download-artifact@v4
Expand All @@ -174,8 +176,19 @@ jobs:
docker image ls -a
- name: Run test ${{ matrix.group }}
run: |
docker run --env CI=1 --env GROUP=${{ matrix.group }} ${{ env.IMAGE }} bash ./scripts/ci_script.sh
# FIXME upload artifacts
mkdir -p ${DOCKER_VOLUME}
docker run \
-v ${DOCKER_VOLUME}:/shared-volume \
--env CI=1 --env GROUP=${{ matrix.group }} \
${{ env.IMAGE }} \
bash ./scripts/ci_script.sh
- name: Upload Test assets
if: ${{ matrix.upload-output && always() }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.group }} ${{ github.run_number }}
path: ${DOCKER_VOLUME}

js-tests:
name: Test ${{ matrix.group }}
Expand Down Expand Up @@ -259,6 +272,8 @@ jobs:
matrix:
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8]
shardTotal: [8]
env:
DOCKER_VOLUME: ${{ github.workspace }}/shared-volume
steps:
- name: Download artifact
uses: actions/download-artifact@v4
Expand All @@ -280,18 +295,22 @@ jobs:

- name: Run test galata integration test
run: |
docker run --env CI=1 --env GROUP=e2e-galata ${{ env.IMAGE }} bash ./scripts/ci_script.sh --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
mkdir -p ${DOCKER_VOLUME}
docker run \
-v ${DOCKER_VOLUME}:/shared-volume \
--env CI=1 --env GROUP=e2e-galata --env DOCKER_VOLUME=/shared-volume \
${{ env.IMAGE }} \
bash ./scripts/ci_script.sh --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
# FIXME
# - name: Upload Galata Test assets
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: jupyterlab-galata-test-assets
# path: |
# galata/test-jupyterlab-results
# galata/test-results
- name: Upload Galata Test assets
if: always()
uses: actions/upload-artifact@v4
with:
name: jupyterlab-galata-test-assets-${{ matrix.shardIndex }}
path: ${DOCKER_VOLUME}
# galata/test-jupyterlab-results
# galata/test-results
retention-days: 1

# - name: Upload Galata Test report
# if: always()
Expand All @@ -306,6 +325,38 @@ jobs:
# run: |
# cat /tmp/jupyterlab_server.log

e2e-base-report:
name: Merge integration tests reports
if: always()
needs: [e2e-base]

runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci

- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
with:
path: pw-assets
pattern: jupyterlab-galata-test-assets-*
merge-multiple: true

- name: Merge into HTML Report
run: npx playwright merge-reports --reporter html ./pw-assets/pw-blob-report

- name: Upload HTML report
uses: actions/upload-artifact@v4
with:
name: jupyterlab-galata-test-assets-${{ github.run_attempt }}
path: |
playwright-report
pw-assets
retention-days: 14

check_links:
# FIXME we should use the docker image as it builds the JS assets
runs-on: ubuntu-latest
Expand Down
7 changes: 6 additions & 1 deletion examples/example_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,13 @@ async def run_browser(url):
current_env = os.environ.copy()
current_env["BASE_URL"] = url
current_env["TEST_SNAPSHOT"] = "1" if has_snapshot else "0"
cmd = ["npx", "playwright", "test"]
if os.environ.get("CI") is not None:
cmd.extend(
["--output", str(Path(os.environ.get("DOCKER_VOLUME", "")).joinpath("pw-test-results"))]
)
try:
await run_async_process(["npx", "playwright", "test"], env=current_env, cwd=str(target))
await run_async_process(cmd, env=current_env, cwd=str(target))
finally:
# Copy back test-results folder to analyze snapshot error
if results_target.exists():
Expand Down
7 changes: 7 additions & 0 deletions galata/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var baseConfig = require('@jupyterlab/galata/lib/playwright-config');

module.exports = {
...baseConfig,
outputDir: process.env.CI ? `${process.env.DOCKER_VOLUME}pw-test-results` : undefined,
projects: [
{
name: 'documentation',
Expand Down Expand Up @@ -40,6 +41,12 @@ module.exports = {
],
// Switch to 'always' to keep raw assets for all tests
preserveOutput: 'failures-only', // Breaks HTML report if use.video == 'on'
reporter: [
[process.env.CI ? 'github' : 'list'],
process.env.CI
? ['blob', { outputDir: `${process.env.DOCKER_VOLUME}pw-blob-report` }]
: ['html', { open: 'on-failure' }]
],
// Try one retry as some tests are flaky
retries: process.env.CI ? 1 : 0
};
2 changes: 1 addition & 1 deletion scripts/ci_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ fi

if [[ $GROUP == e2e* ]]; then
pushd galata
jlpm start 2>&1 > /tmp/jupyterlab_server.log &
jlpm start &
# Install only Chromium browser
jlpm playwright install chromium
jlpm run build
Expand Down

0 comments on commit dd4b665

Please sign in to comment.