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 a new convert workflow that will supplant the docs build #80

Merged
merged 33 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
085d644
add a new convert workflow that will supplant the docs build
tonyfast Nov 9, 2023
fb74289
add the docs build that we can push to github pages
tonyfast Nov 9, 2023
65cc8aa
include changes to workflow files
tonyfast Nov 9, 2023
a66a955
clean test warnings, intregrate playwright into test, use xdist.
tonyfast Nov 9, 2023
dba8cf5
update test ci
tonyfast Nov 9, 2023
4a51169
preheat test env
tonyfast Nov 9, 2023
9e21c84
test playwirght from notebooks
tonyfast Nov 9, 2023
568f687
chrome
tonyfast Nov 9, 2023
60fb1e2
test action uses conda
tonyfast Nov 10, 2023
d6c1de1
update tests and env
tonyfast Nov 10, 2023
75ab8e0
use mamba
tonyfast Nov 10, 2023
d2af1cd
auto activate env in ci
tonyfast Nov 10, 2023
b0ca844
use conda playwright
tonyfast Nov 10, 2023
e74248c
gross solve on microsoft channel to get playwirght
tonyfast Nov 10, 2023
1784442
explicit mamba activate
tonyfast Nov 11, 2023
d28111c
mamba init
tonyfast Nov 11, 2023
bcc5cf6
init in separate step
tonyfast Nov 11, 2023
93e2c7a
conda ugh
tonyfast Nov 11, 2023
1e4323e
update work and environment based on @bollwyvl review
tonyfast Nov 13, 2023
f96644f
remove env activation
tonyfast Nov 13, 2023
327a417
different browser5
tonyfast Nov 13, 2023
4b6b074
update pw test
tonyfast Nov 14, 2023
5c78f87
mkdir parent
tonyfast Nov 14, 2023
9580ad7
use mamba action instead
tonyfast Nov 14, 2023
541493c
finally add an assertion to the tests
tonyfast Nov 14, 2023
ab4f78b
a font size to css variables and include 2.5.8 and 2.5.5 targets
tonyfast Nov 14, 2023
2b30958
place wcag priorty classes in the body
tonyfast Nov 14, 2023
c7cb8e8
exclude mathjax objects in audit
tonyfast Nov 14, 2023
76cd409
use exceptiongroups to collect axe reults
tonyfast Nov 14, 2023
79aecd9
add doit to the test environment and use the copy action to get start…
tonyfast Nov 14, 2023
2bcd827
only test AA priority
tonyfast Nov 14, 2023
854a2c6
align checkbox
tonyfast Nov 14, 2023
4f5bfe1
styling typo
tonyfast Nov 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/convert.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: build nbconvert_html5 and export samples

on:
push:
branches-ignore:
- gh-pages
paths:
- .github/workflows/**
- nbconvert_html5/**
- "pyproject.toml"

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]

steps:
- uses: actions/checkout@v3
name: Fetch all history for all tags and branches
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
tonyfast marked this conversation as resolved.
Show resolved Hide resolved
cache-dependency-path: |
pyproject.toml
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install hatch
- name: Convert
run: |
python -m hatch run task:convert
- name: Build the docs
run: |
python -m hatch run docs:build
- name: Deploy main 🚀
uses: JamesIves/github-pages-deploy-action@v4

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recall you can do all of this with the built-in GHA options, not... whatever this is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay. cool. been using this for a real long. ill find the more appropirate action

if: ${{ github.ref_name == 'main' }}
with:
folder: site # The folder the action should deploy.
single-commit: true
- name: Deploy non-main 🚀
uses: JamesIves/github-pages-deploy-action@v4
if: ${{ github.ref_name != 'main' }}
with:
folder: site # The folder the action should deploy.
single-commit: true
target-folder: branch/${{ github.ref_name }}
35 changes: 25 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,31 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: setup python
uses: actions/setup-python@v4
- name: Cache conda
uses: actions/cache@v2
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
with:
cache: pip
cache-dependency-path: pyproject.toml
python-version: "${{ matrix.python-version}}"
- name: upgrade dependencies
run: |-
python -m pip install --upgrade pip hatch
pip install -e.[test]
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('test-environment.yml') }}
- uses: conda-incubator/setup-miniconda@v2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a greenfield project, you could also consider the smaller-scope https://github.com/mamba-org/setup-micromamba

with:
activate-environment: test-nbconvert-a11y
tonyfast marked this conversation as resolved.
Show resolved Hide resolved
channel-priority: strict
auto-activate-base: true
environment-file: test-environment.yml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to win CI, you really want to be solving this offline with conda-lock.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will start doing that. thanks! the solve does delay the action significantly

use-only-tar-bz2: true
miniforge-variant: Mambaforge
use-mamba: true
- name: init playwright nbconvert-a11y
run: |
conda activate test-nbconvert-a11y
playwright install --with-deps chrome

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an excellent candidate for caching, if it puts its downloaded files in a sensible, predictable place

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll add this to the to do list. i wanna get to this using the discussion in microsoft/playwright#7249

pip install -e.
- name: test with pytest
run: |
hatch run test:run
conda activate test-nbconvert-a11y
pytest
48 changes: 26 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,25 @@ dependencies = [
"IPython",
"markdown-it-py[plugins,linkify]",
"python-slugify",
"html5lib"
"html5lib",
]
dynamic = ["version"]

[project.optional-dependencies]
test = [
"pytest",
"pytest-xdist",
"pytest-sugar",
"pytest-playwright",
"nbval",
"matplotlib",
"numpy",
"ipywidgets",
"beautifulsoup4",
"scipy",
]
audit = [
"doit",
"tomli",
"requests",
"requests_cache",
"playwright",
"pandas",
"tabulate",
]
task = ["doit", "tomli", "pandas", "tabulate"]
audit = ["requests", "requests_cache", "playwright"]
docs = ["mkdocs-material", "mkdocstrings[python]"]


Expand All @@ -68,9 +64,7 @@ serve = "mkdocs serve -v"

[project.entry-points."nbconvert.exporters"]
html5_test = "nbconvert_html5.exporters:Html5Test"
# html5 = "nbconvert_html5.form_exporter:FormExporter"
a11y = "nbconvert_html5.form_exporter:A11yExporter"
# html_post = "nbconvert_html5.exporters:PostProcessExporter"

[tool.hatch.build.targets.wheel.shared-data]
"nbconvert_html5/templates" = "share/jupyter/nbconvert/templates"
Expand All @@ -86,18 +80,23 @@ version-file = "nbconvert_html5/_version.py"
source = "vcs"

# testing setttings
[tool.hatch.envs.test.scripts]
run = "pytest"

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "--nbval --current-env -pno:importnb --rootdir=tests --sanitize-with=sanitize.cfg"
testpaths = ["tests"]
norecursedirs = ["tests/notebooks", "*checkpoints"]
addopts = "--nbval --nbval-current-env -pno:importnb -n auto --nbval-sanitize-with=sanitize.cfg"
testpaths = ["tests", "test_playwright.py"]
norecursedirs = ["tests/exports", "tests/notebooks", "*checkpoints"]

[tool.hatch.envs.test]
features = ["test"]

[tool.hatch.envs.test.scripts]
run = "pytest "
features = ["test", "audit"]
post-install-commands = ["python -m playwright install chrome"]

[tool.hatch.envs.test.overrides]
env.CI.post-install-commands = [
"python -m playwright install --with-deps chrome",
]

# formatting settings
[tool.isort]
Expand All @@ -109,17 +108,22 @@ line_length = 100
# doit tasks
[tool.hatch.envs.task.scripts]
list = "doit list"
export = "doit copy convert audit report"
convert = "doit convert"
run = "doit run"

[tool.hatch.envs.task]
features = ["audit"]
features = ["task"]

[tool.hatch.envs.audit]
features = ["task", "audit"]
post-install-commands = ["- python -m playwright install chrome-beta"]

[tool.hatch.envs.task.overrides]
[tool.hatch.envs.audit.overrides]
env.CI.post-install-commands = [
"python -m playwright install --with-deps chrome-beta",
]
[tool.hatch.envs.audit.scripts]
axe = "doit audit"

[tool.doit.commands.list]
status = true
Expand Down
27 changes: 27 additions & 0 deletions test-environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: test-nbconvert-a11y
channels:
- conda-forge
- microsoft
dependencies:
- python=3.11
- openjdk
- pip
- pip:
- html5validator
- pytest-playwright
- nbval
- accessible-pygments
- requests-cache
- markdown-it-py[plugins,linkify]
- python-slugify
- html5lib
- playwright
- nbconvert
- pytest
- pytest-xdist
- pytest-sugar
- matplotlib
tonyfast marked this conversation as resolved.
Show resolved Hide resolved
- numpy
- ipywidgets
- beautifulsoup4
- scipy
Loading
Loading