Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bootstrap script to template #41

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
48 changes: 28 additions & 20 deletions .github/workflows/check-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,25 @@ jobs:
run: python -m pip install -U "copier>=8.0.0" jinja2-time "jupyterlab>=4.0.0,<5" "pydantic<2.0.0"

- name: Create the extension
id: create-extension
env:
COPIER_SKIP_INSTALL_TASK: '1'
run: |
set -eux
mkdir myextension
python -m copier copy -l -d author_name="My Name" -d repository="https://github.com/test/lab-extension" --vcs-ref HEAD --UNSAFE . myextension
cat myextension/pyproject.toml
tmpfolder=$(mktemp -d)
echo "extension_folder=${tmpfolder}" >> "$GITHUB_OUTPUT"
python -m copier copy -l -d author_name="My Name" -d repository="https://github.com/test/lab-extension" -d venv="none" --vcs-ref HEAD --UNSAFE . ${tmpfolder}
cat ${tmpfolder}/pyproject.toml

- name: Test the extension
working-directory: myextension
working-directory: ${{ steps.create-extension.outputs.extension_folder }}
run: |
set -eux
YARN_ENABLE_IMMUTABLE_INSTALLS=false jlpm
jlpm test

- name: Install the extension
working-directory: myextension
working-directory: ${{ steps.create-extension.outputs.extension_folder }}
run: |
set -eux
python -m pip install -v .
Expand All @@ -48,7 +52,7 @@ jobs:
jupyter labextension list

- name: Install UI tests dependencies
working-directory: myextension/ui-tests
working-directory: ${{ steps.create-extension.outputs.extension_folder }}/ui-tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
YARN_ENABLE_IMMUTABLE_INSTALLS: false
Expand All @@ -59,14 +63,14 @@ jobs:
with:
path: |
${{ github.workspace }}/pw-browsers
key: ${{ runner.os }}-${{ hashFiles('myextension/ui-tests/yarn.lock') }}
key: ${{ runner.os }}-${{ hashFiles('${{ steps.create-extension.outputs.extension_folder }}/ui-tests/yarn.lock') }}

- name: Install browser
run: jlpm playwright install chromium
working-directory: myextension/ui-tests
working-directory: ${{ steps.create-extension.outputs.extension_folder }}/ui-tests

- name: Execute integration tests
working-directory: myextension/ui-tests
working-directory: ${{ steps.create-extension.outputs.extension_folder }}/ui-tests
run: |
jlpm playwright test

Expand All @@ -76,8 +80,8 @@ jobs:
with:
name: extension-playwright-tests
path: |
myextension/ui-tests/test-results
myextension/ui-tests/playwright-report
${{ steps.create-extension.outputs.extension_folder }}/ui-tests/test-results
${{ steps.create-extension.outputs.extension_folder }}/ui-tests/playwright-report

test-mimerenderer:
runs-on: ubuntu-latest
Expand All @@ -92,13 +96,17 @@ jobs:
run: python -m pip install -U "copier>=8.0.0" jinja2-time "jupyterlab>=4.0.0,<5" "pydantic<2.0.0"

- name: Create the extension
id: create-extension
env:
COPIER_SKIP_INSTALL_TASK: '1'
run: |
set -eux
mkdir myextension
python -m copier copy -l -d kind=mimerenderer -d viewer_name="My Viewer" -d mimetype="application/vnd.my_org.my_type" -d mimetype_name="my_type" -d file_extension=".my_type" -d author_name="My Name" -d repository="https://github.com/test/lab-extension" --vcs-ref HEAD --UNSAFE . myextension
tmpfolder=$(mktemp -d)
echo "extension_folder=${tmpfolder}" >> "$GITHUB_OUTPUT"
python -m copier copy -l -d kind=mimerenderer -d viewer_name="My Viewer" -d mimetype="application/vnd.my_org.my_type" -d mimetype_name="my_type" -d file_extension=".my_type" -d author_name="My Name" -d repository="https://github.com/test/lab-extension" -d venv="none" --vcs-ref HEAD --UNSAFE . ${tmpfolder}

- name: Install the extension
working-directory: myextension
working-directory: ${{ steps.create-extension.outputs.extension_folder }}
run: |
set -eux
YARN_ENABLE_IMMUTABLE_INSTALLS=false python -m pip install -v .
Expand All @@ -108,7 +116,7 @@ jobs:
jupyter labextension list

- name: Install UI tests dependencies
working-directory: myextension/ui-tests
working-directory: ${{ steps.create-extension.outputs.extension_folder }}/ui-tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
YARN_ENABLE_IMMUTABLE_INSTALLS: false
Expand All @@ -119,14 +127,14 @@ jobs:
with:
path: |
${{ github.workspace }}/pw-browsers
key: ${{ runner.os }}-${{ hashFiles('myextension/ui-tests/yarn.lock') }}
key: ${{ runner.os }}-${{ hashFiles('${{ steps.create-extension.outputs.extension_folder }}/ui-tests/yarn.lock') }}

- name: Install browser
run: jlpm playwright install chromium
working-directory: myextension/ui-tests
working-directory: ${{ steps.create-extension.outputs.extension_folder }}/ui-tests

- name: Execute integration tests
working-directory: myextension/ui-tests
working-directory: ${{ steps.create-extension.outputs.extension_folder }}/ui-tests
run: |
# Generate reference snapshot first
jlpm playwright test -u
Expand All @@ -138,5 +146,5 @@ jobs:
with:
name: mimerenderer-playwright-tests
path: |
myextension/ui-tests/test-results
myextension/ui-tests/playwright-report
${{ steps.create-extension.outputs.extension_folder }}/ui-tests/test-results
${{ steps.create-extension.outputs.extension_folder }}/ui-tests/playwright-report
Loading