fix markdown #415
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: pytest nbconvert-a11y, axe test exports, build docs. | |
on: | |
- push | |
jobs: | |
format: | |
name: format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: install dev dependencies | |
run: python -m pip install --upgrade pip hatch | |
- name: run formatters | |
run: | | |
echo "~~~bash" > "${GITHUB_STEP_SUMMARY}" | |
hatch run format:code 2>&1 | tee --append "${GITHUB_STEP_SUMMARY}" | |
echo "~~~" >> "${GITHUB_STEP_SUMMARY}" | |
- name: print diff | |
run: | | |
echo "~~~diff" >> "${GITHUB_STEP_SUMMARY}" | |
git diff | tee --append "${GITHUB_STEP_SUMMARY}" | |
echo "~~~" >> "${GITHUB_STEP_SUMMARY}" | |
test: | |
name: test package and accessibility | |
defaults: | |
run: | |
shell: bash -el {0} | |
strategy: | |
matrix: | |
python-version: | |
- "3.10" | |
runs-on: ubuntu-latest | |
steps: | |
- name: fetch all history and tags | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Cache conda | |
uses: actions/cache@v2 | |
env: | |
# Increase this value to reset cache if etc/example-environment.yml has not changed | |
CACHE_NUMBER: 1 | |
with: | |
path: ~/conda_pkgs_dir | |
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ | |
hashFiles('test-environment.yml') }} | |
- uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: test-environment.yml | |
cache-environment: true | |
- name: init plawright | |
run: | | |
playwright install --with-deps chromium | |
- name: init node & files | |
run: | | |
npm install vnu-jar axe-core | |
doit copy | |
- name: init dev module | |
run: | | |
pip install -e. | |
- name: smoke test | |
run: | | |
# the smoke generate html assets that are used in the accessibility testing. | |
# we run this script to generate assets and test the nbconvert-a11y module. | |
# failures here will stop any docs builds | |
pytest tests/test_smoke.py | |
- name: a11y tests | |
# always build the docs to see what the new versions look like. | |
continue-on-error: true | |
run: | | |
pytest --deselect tests/test_smoke.py \ | |
-n auto --self-contained-html --html=tests/exports/pytest/report.html | |
- name: build wheel and sdist | |
run: | | |
python -m build | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- name: mkdocs | |
run: | | |
mkdocs build -v | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: site | |
path: site | |
publish: | |
name: publish the mkdocs build to github pages | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repo | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: site | |
path: site | |
- name: Deploy 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 | |
- 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 }} | |
release: | |
name: draft release when tagged | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [test] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- name: fetch contents | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: install twine and pytest | |
run: | | |
pip install twine pytest | |
- name: Publish package distributions to TestPyPI | |
run: | | |
twine upload --repository testpypi \ | |
--user __token__ --password ${{secrets.HATCH_TEST_INDEX_AUTH}} \ | |
dist/* | |
- name: install nbconvert-a11y dependencies from test pip | |
run: | | |
pip install \ | |
--index-url 'https://test.pypi.org/simple/' \ | |
--extra-index-url 'https://pypi.org/simple/' \ | |
nbconvert-a11y | |
- name: test test release | |
run: | | |
pytest tests/test_smoke.py | |
- uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "dist/.*" | |
draft: true # does not trigger a created event |