Add UI tests #404
Workflow file for this run
This file contains 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: Test | |
on: | |
push: | |
branches: | |
- main | |
- 0.1.x | |
pull_request: | |
branches: | |
- '*' | |
env: | |
EXPECT_BUILD: |- | |
_output/extensions/@jupyterlite/pyodide-kernel-extension/static/pypi/all.json | |
JUPYTERLITE_NO_LIBARCHIVE: 1 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Base Setup | |
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 | |
with: | |
node_version: '20.x' | |
python_version: '3.11' | |
- name: Install dependencies | |
run: python -m pip install -U pip | |
- name: Install Python dependencies | |
run: python -m pip install -v -e ".[dev,lint]" | |
- name: Install JS dependencies | |
run: jlpm --immutable | |
- name: Lint the JS | |
run: jlpm lint:js:check | |
- name: Lint the Python | |
run: jlpm lint:py:check | |
- name: Build the JS extension | |
run: jlpm build | |
- name: Package the extension | |
run: jlpm dist:pypi | |
- name: Hash distributions | |
run: |- | |
set -eux | |
cd dist | |
sha256sum * > SHA256SUMS | |
cat SHA256SUMS | |
- name: Build requirements files | |
run: |- | |
set -eux | |
cd dist | |
echo "./dist/$(ls *.whl)" >> requirements-wheel.txt | |
echo "./dist/$(ls *.tar.gz)" >> requirements-sdist.txt | |
cat *.txt | |
- name: Upload extension packages | |
uses: actions/upload-artifact@v3 | |
with: | |
name: jupyterlite-pyodide-kernel-dist-${{ github.run_number }} | |
path: dist | |
if-no-files-found: error | |
- name: Upload test config | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pyproject-toml | |
path: pyproject.toml | |
if-no-files-found: error | |
test: | |
needs: build | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu, windows, macos] | |
python-version: ['3.8', '3.11'] | |
steps: | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/download-artifact@v3 | |
with: | |
path: dist | |
name: jupyterlite-pyodide-kernel-dist-${{ github.run_number }} | |
# Remove NodeJS, twice to take care of system and locally installed node versions. | |
- name: Clean out nodejs | |
if: matrix.os != 'windows' | |
run: | | |
set -eux | |
sudo rm -rf $(which node) | |
sudo rm -rf $(which node) | |
- name: Install Built Package (wheel) | |
if: matrix.python-version == '3.11' | |
run: |- | |
python -m pip install -v -r dist/requirements-wheel.txt | |
- name: Install Built Package (sdist) | |
if: matrix.python-version == '3.8' | |
run: |- | |
python -m pip install -v -r dist/requirements-sdist.txt | |
- name: Make temp dir | |
run: |- | |
mkdir tmp || md tmp | |
- name: Smoke test (CLI) | |
run: |- | |
cd tmp | |
jupyter piplite --version || exit 1 | |
jupyter piplite --help || exit 1 | |
- name: Smoke test (status) | |
run: |- | |
cd tmp | |
jupyter lite status || exit 1 | |
- name: Smoke test (build) | |
run: |- | |
cd tmp | |
jupyter lite build | |
ls ${{ env.EXPECT_BUILD }} || dir ${{ env.EXPECT_BUILD }} || exit 1 | |
- name: Smoke test archive | |
run: |- | |
cd tmp | |
jupyter lite archive || exit 1 | |
- name: Smoke test (check) | |
run: |- | |
cd tmp | |
jupyter lite check || exit 1 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: pyproject-toml | |
- name: Install test deps | |
run: |- | |
python -m pip install jupyterlite-pyodide-kernel[test] jupyterlite-core[lab] --upgrade-strategy only-if-needed | |
- name: Check extension | |
run: |- | |
jupyter labextension list | |
jupyter labextension list 2>&1 | grep -ie "@jupyterlite/pyodide-kernel.*OK" | |
- name: Run the tests | |
run: pytest | |
- name: Upload reports | |
if: always() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: |- | |
jupyterlite-pyodide-kernel-pytest-${{ github.run_number }}-${{ matrix.os }}-${{ matrix.python-version}} | |
path: build/reports | |
if-no-files-found: error | |
integration-tests: | |
name: Integration tests | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
project: ["default", "crossoriginisolated"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Base Setup | |
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 | |
- uses: actions/download-artifact@v3 | |
with: | |
path: dist | |
name: jupyterlite-pyodide-kernel-dist-${{ github.run_number }} | |
- name: Install the extension | |
run: | | |
set -eux | |
python -m pip install "jupyterlab>=4.0.0,<5" dist/jupyterlite_pyodide_kernel*.whl | |
- name: Install dependencies | |
working-directory: ui-tests | |
env: | |
YARN_ENABLE_IMMUTABLE_INSTALLS: 0 | |
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 | |
run: | | |
python -m pip install -r requirements.txt | |
jlpm install | |
jlpm run build | |
- name: Install browser | |
run: jlpm playwright install chromium | |
working-directory: ui-tests | |
- name: Execute integration tests | |
working-directory: ui-tests | |
run: | | |
jlpm playwright test --project ${{ matrix.project }} | |
- name: Upload Playwright Test report | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: jupyterlite-xeus-playwright-tests | |
path: | | |
ui-tests/test-results | |
ui-tests/playwright-report |