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

rename and release the project #92

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8abc6ea
build wheel and upload artifact
tonyfast Nov 22, 2023
883774d
xx
tonyfast Nov 22, 2023
63a9919
activate on tags, separate release publish tasks
tonyfast Nov 22, 2023
adb51d8
fix trigger
tonyfast Nov 22, 2023
a54db6e
revert triugger
tonyfast Nov 22, 2023
f5c73cd
use correwct artifact
tonyfast Nov 22, 2023
3cd12b2
complete rename of package
tonyfast Nov 22, 2023
59c31db
increment cache
tonyfast Nov 22, 2023
7e20424
specify download artifact path
tonyfast Nov 22, 2023
d0f1cb1
split installation jobs in ci
tonyfast Nov 22, 2023
cbcbced
add old dep
tonyfast Nov 22, 2023
353f6ff
rename package
tonyfast Nov 22, 2023
07cefa8
bootstrap css
tonyfast Nov 22, 2023
7456e2e
reuse correct artifact
tonyfast Nov 22, 2023
1486368
add checkout to pages
tonyfast Nov 22, 2023
3a7a1f4
update checkout
tonyfast Nov 22, 2023
ef868f5
add permissions to python release
tonyfast Nov 22, 2023
1fb8884
use hatch for publishing
tonyfast Nov 22, 2023
5360832
dial in test release
tonyfast Nov 22, 2023
162499f
rm ipython dep
tonyfast Nov 22, 2023
b22768b
drop 3.7
tonyfast Nov 22, 2023
7640c6d
add exception dependency
tonyfast Nov 22, 2023
9090790
change project url in config
tonyfast Nov 22, 2023
4e7068c
move xdist and report params to ci
tonyfast Nov 22, 2023
2b6bf8c
use twine for release
tonyfast Nov 22, 2023
839902b
draft a github release on sucess
tonyfast Nov 22, 2023
857eea9
bad yml
tonyfast Nov 22, 2023
24abb38
distribution folder for twine
tonyfast Nov 22, 2023
02a1605
use jupyter paths
tonyfast Nov 23, 2023
c01e5ce
change how smoke creates static assets
tonyfast Nov 23, 2023
46113f4
create directory on smoke test
tonyfast Nov 23, 2023
f47b530
add release to pypi workflow
tonyfast Nov 23, 2023
2895a15
Merge remote-tracking branch 'db/main' into releases-attempt-2
tonyfast Nov 23, 2023
eb02417
remove old variable
tonyfast Nov 23, 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
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: release the package to pypi
on:
release:
types:
- created
jobs:
release:
name: draft release when tagged
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"
- name: install twine and pytest
run: |
pip install twine pytest
- name: Publish package distributions to TestPyPI
run: |
twine upload --user __token__ --password ${{secrets.HATCH_PYPI_AUTH}} dist/*
- name: install nbconvert-a11y dependencies from test pip
run: |
pip install nbconvert-a11y
- name: test test release
run: |
pytest tests/test_smoke.py
76 changes: 72 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
uses: actions/cache@v2
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
CACHE_NUMBER: 1
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
Expand All @@ -54,12 +54,16 @@ jobs:
with:
environment-file: test-environment.yml
cache-environment: true
- name: init playwright nbconvert-a11y
- name: init plawright
run: |
playwright install --with-deps chromium
- name: init node & files
run: |
npm install vnu-jar axe-core
pip install -e.
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.
Expand All @@ -70,10 +74,33 @@ jobs:
# always build the docs to see what the new versions look like.
continue-on-error: true
run: |
pytest --deselect tests/test_smoke.py
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' }}
Expand All @@ -87,3 +114,44 @@ jobs:
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
9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ requires = ["hatch-vcs", "hatchling"]
name = "nbconvert-a11y"
description = "nbconvert templates using modern standards"
readme = "README.md"
url = "https://github.com/Iota-School/notebooks-for-all"
requires-python = ">=3.7"
url = "https://github.com/deathbeds/nbconvert-a11y"
requires-python = ">=3.8"
license = "BSD-3-Clause"
keywords = []
authors = [{ name = "tonyfast", email = "tony.fast@gmail.com" }]
Expand All @@ -22,7 +22,6 @@ classifiers = [
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand All @@ -32,10 +31,10 @@ classifiers = [
dependencies = [
"accessible-pygments",
"html5lib",
"IPython",
"markdown-it-py[linkify,plugins]",
"nbconvert",
"python-slugify",
"exceptiongroup; python_version < '3.12'"
]
dynamic = ["version"]

Expand Down Expand Up @@ -93,7 +92,7 @@ run = "pytest"

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-vvv -pno:importnb -n auto --self-contained-html --html=tests/exports/pytest/report.html"
addopts = "-vvv -pno:importnb"
testpaths = ["tests", "test_playwright.py"]
norecursedirs = ["tests/exports", "tests/notebooks", "*checkpoints"]

Expand Down
1 change: 1 addition & 0 deletions test-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies:
- markdown-it-py[plugins,linkify]
- python-slugify
- html5lib
- build
- nodejs
- playwright
- nbconvert
Expand Down
19 changes: 10 additions & 9 deletions tests/test_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
from pytest import mark, param

import nbconvert_a11y
import jupyter_core.paths

TEMPLATES = Path(nbconvert_a11y.__file__).parent / "templates/a11y"
SKIP_BASELINE = "baseline tests skipped locally"
LOGGER = getLogger(__name__)
HERE = Path(__file__).parent
Expand Down Expand Up @@ -64,7 +64,7 @@ def get_target_html(config, notebook):
)


assets = mark.parametrize("assets", [TEMPLATES / "settings.js", TEMPLATES / "style.css"])
assets = mark.parametrize("asset", ["settings.js", "style.css"])


@configs
Expand All @@ -74,14 +74,15 @@ def test_config_loading(config):


@assets
def test_static_assets(assets):
def test_static_assets(asset):
"""This is a bad test. it won't fail, but needs to run to collect testing assets."""
target = HTML / assets.name
try:
assert target.exists(), f"{assets.name} doesn't exist."
except AssertionError:
copyfile(assets, target)
assert target.exists(), f"{assets.name} couldn't be created"
target = HTML / asset
target.parent.mkdir(exist_ok=True, parents=True)
for path in map(Path, jupyter_core.paths.jupyter_path("nbconvert", "templates", "a11y", asset)):
if path.exists():
copyfile(path, target)
break
assert target.exists(), f"{asset} couldn't be created"


@configs
Expand Down