-
Notifications
You must be signed in to change notification settings - Fork 6
169 lines (163 loc) · 4.92 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: pytest nbconvert-a11y, axe test exports, build docs.
on:
push:
branches: [main]
pull_request:
branches: ['*']
workflow_dispatch:
env:
# Increase this value to reset cache if environments have not changed
CACHE_NUMBER: 2
# squash some known warnings
JUPYTER_PLATFORM_DIRS: 1
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@v3
with:
fetch-depth: 0
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: .github/test-environment.yml
- name: init plawright
run: |
playwright install --with-deps chromium
- name: init node & files
run: |
yarn
doit copy
- name: init dev module
run: |
python3 -m pip install -e . --no-deps --no-build-isolation --ignore-installed
- name: check pip env
run: |
python3 -m pip check
- 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 --color=yes tests/test_smoke.py
- name: build wheel and sdist
run: |
pyproject-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
- name: a11y tests
# always build the docs to see what the new versions look like.
# continue-on-error: true
run: |
pytest \
--color=yes \
-n auto \
--deselect tests/test_smoke.py \
--self-contained-html \
--html=tests/exports/pytest/report.html
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