Skip to content

Commit 0f789e4

Browse files
authored
Add UI tests (#73)
* pixi * pixi build on RTD * fix tasks * update lock file * more cleanups * more fixes * fix rtd link * fix dist * add tests * sqlite and other fixes * cleanup * upload videos on failure * add retries * only deploy if tests pass * cleanup * test task
1 parent 1f6bcd0 commit 0f789e4

22 files changed

+9802
-2106
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SCM syntax highlighting & preventing 3-way merges
2+
pixi.lock merge=binary linguist-language=YAML linguist-generated=true

.github/workflows/deploy.yml

Lines changed: 65 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and Deploy
1+
name: Build, Test, and Deploy
22

33
on:
44
push:
@@ -20,25 +20,80 @@ jobs:
2020
steps:
2121
- name: Checkout
2222
uses: actions/checkout@v4
23-
- name: Install micromamba
24-
uses: mamba-org/setup-micromamba@v1
23+
- uses: prefix-dev/setup-pixi@v0.9.3
2524
with:
26-
micromamba-version: '2.0.5-0'
27-
environment-file: build-environment.yml
28-
cache-environment: true
25+
pixi-version: v0.59.0
26+
cache: true
2927
- name: Build the JupyterLite site
3028
shell: bash -l {0}
3129
run: |
3230
cp README.md content
33-
jupyter lite build --contents content --output-dir dist
31+
pixi run build
3432
35-
- name: Upload dist
36-
uses: actions/upload-pages-artifact@v3
33+
- name: Upload dist artifact for testing
34+
uses: actions/upload-artifact@v4
3735
with:
36+
name: jupyterlite-dist
3837
path: ./dist
3938

40-
deploy:
39+
- name: Upload dist for GitHub Pages
40+
uses: actions/upload-pages-artifact@v4
41+
with:
42+
path: ./dist
43+
44+
test:
4145
needs: build
46+
runs-on: ubuntu-latest
47+
timeout-minutes: 30
48+
49+
steps:
50+
- name: Checkout
51+
uses: actions/checkout@v4
52+
53+
- name: Setup pixi
54+
uses: prefix-dev/setup-pixi@v0.9.3
55+
with:
56+
pixi-version: v0.59.0
57+
cache: true
58+
59+
- name: Download built site
60+
uses: actions/download-artifact@v4
61+
with:
62+
name: jupyterlite-dist
63+
path: ./dist
64+
65+
- name: Install Playwright browsers
66+
shell: bash -l {0}
67+
run: |
68+
pixi run playwright install --with-deps chromium
69+
70+
- name: Run notebook tests
71+
shell: bash -l {0}
72+
run: |
73+
pixi run test
74+
75+
- name: Upload screenshots on failure
76+
if: failure()
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: test-screenshots
80+
path: |
81+
ui-tests/screenshot_*.png
82+
ui-tests/videos
83+
if-no-files-found: ignore
84+
85+
- name: Upload test results
86+
if: always()
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: pytest-results
90+
path: |
91+
ui-tests/report.html
92+
ui-tests/test-results
93+
if-no-files-found: ignore
94+
95+
deploy:
96+
needs: test
4297
if: github.ref == 'refs/heads/main'
4398
permissions:
4499
pages: write

.github/workflows/rtd-preview.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ jobs:
2020
issue_number: context.issue.number,
2121
owner: context.repo.owner,
2222
repo: context.repo.repo,
23-
body: `[![lite-badge](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)](https://try-jupyter--${PR_NUMBER}.org.readthedocs.build/en/${PR_NUMBER}/lite/lab/index.html) :point_left: Try it on ReadTheDocs`
23+
body: `[![lite-badge](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)](https://try-jupyter--${PR_NUMBER}.org.readthedocs.build/en/${PR_NUMBER}) :point_left: Try it on ReadTheDocs`
2424
})

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,17 @@ dmypy.json
114114
# jupyterlite
115115
*.doit.db
116116
_output
117+
# pixi environments
118+
.pixi/*
119+
!.pixi/config.toml
120+
121+
# JupyterLite terminal
122+
cockle-config.json
123+
.cockle_temp/
124+
cockle_wasm_env/
125+
126+
# UI tests
127+
ui-tests/*.png
128+
ui-tests/report.html
129+
ui-tests/.pytest_cache/
130+
ui-tests/videos/

.readthedocs.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
version: 2
2-
32
build:
4-
os: "ubuntu-20.04"
3+
os: ubuntu-22.04
54
tools:
6-
python: "miniconda-latest"
7-
8-
conda:
9-
environment: build-environment.yml
10-
11-
sphinx:
12-
configuration: conf.py
5+
# this ensures a viable `mamba` is on `$PATH``
6+
python: mambaforge-latest
7+
commands:
8+
- mamba install -c conda-forge -c nodefaults pixi
9+
- pixi install
10+
- pixi run build
11+
- pixi run readthedocs

build-environment.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

conf.py

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)