@@ -2,6 +2,10 @@ name: Unit Testing, Coverage Collection, Package, Release, Documentation and Pub
22
33on : [ push ]
44
5+ defaults :
6+ run :
7+ shell : bash
8+
59jobs :
610 UnitTesting :
711 name : ${{ matrix.icon }} Unit Tests using Python ${{ matrix.python }}
2226 python : ${{ env.PYTHON }}
2327
2428 steps :
25- - name : Checkout repository
29+ - name : ⏬ Checkout repository
2630 uses : actions/checkout@v2
2731
2832 - name : 🐍 Setup Python ${{ matrix.python }}
3539 python -m pip install --upgrade pip
3640 pip install -r tests/requirements.txt
3741
38- - name : Run unit tests
42+ - name : ☑ Run unit tests
3943 run : |
4044 python -m pytest -rA tests/unit
4145
4953 python : ${{ env.PYTHON }}
5054
5155 steps :
52- - name : 🔋 Checkout repository
56+ - name : ⏬ Checkout repository
5357 uses : actions/checkout@v2
5458
5559 - name : 🐍 Setup Python ${{ env.PYTHON }}
8791 coverage-reports : ./coverage.xml
8892
8993 Release :
90- name : Release Page on GitHub
94+ name : 📝 Create ' Release Page' on GitHub
9195 runs-on : ubuntu-latest
9296
9397 if : startsWith(github.ref, 'refs/tags')
@@ -184,7 +188,7 @@ jobs:
184188 retention-days : 1
185189
186190 PublishOnPyPI :
187- name : Publish to PyPI
191+ name : 🚀 Publish to PyPI
188192 runs-on : ubuntu-latest
189193
190194 if : startsWith(github.ref, 'refs/tags')
@@ -199,7 +203,7 @@ jobs:
199203 artifact : ${{ env.ARTIFACT }}
200204
201205 steps :
202- - name : Download artifacts '${{ env.ARTIFACT }}' from 'Package' job
206+ - name : 📥 Download artifacts '${{ env.ARTIFACT }}' from 'Package' job
203207 uses : actions/download-artifact@v2
204208 with :
205209 name : ${{ env.ARTIFACT }}
@@ -222,31 +226,87 @@ jobs:
222226 run : |
223227 twine upload dist/*
224228
229+ VerifyDocs :
230+ name : 👍 Verify example snippets using Python 3.9
231+ runs-on : ubuntu-latest
232+
233+ env :
234+ PYTHON : 3.9
235+ outputs :
236+ python : ${{ env.PYTHON }}
237+
238+ steps :
239+ - name : ⏬ Checkout repository
240+ uses : actions/checkout@v2
241+
242+ - name : ⚙ Setup GHDL
243+ uses : ghdl/setup-ghdl-ci@master
244+
245+ - name : 🐍 Setup Python
246+ uses : actions/setup-python@v2
247+ with :
248+ python-version : ${{ env.PYTHON }}
249+
250+ - name : 🐍 Install dependencies
251+ run : |
252+ pip3 install git+https://github.com/ghdl/ghdl.git@$(ghdl version hash)
253+
254+ - name : ✂ Extract code snippet from README
255+ shell : python
256+ run : |
257+ from pathlib import Path
258+ import re
259+
260+ ROOT = Path('.')
261+
262+ with (ROOT / 'README.md').open('r') as rptr:
263+ content = rptr.read()
264+
265+ m = re.search(r"```py(thon)?(?P<code>.*?)```", content, re.MULTILINE|re.DOTALL)
266+
267+ if m is None:
268+ raise Exception("Regular expression did not find the example in the README!")
269+
270+ with (ROOT / 'tests/docs/example.py').open('w') as wptr:
271+ wptr.write(m["code"])
272+
273+ # - name: Print example.py
274+ # run: cat tests/docs/example.py
275+
276+ - name : ☑ Run example snippet
277+ working-directory : tests/docs
278+ run : |
279+ python3 example.py
280+
281+
225282 BuildTheDocs :
226283 name : 📓 Run BuildTheDocs and publish to GH-Pages
227284 runs-on : ubuntu-latest
228- steps :
229285
230- - name : Checkout repository
231- uses : actions/checkout@v2
286+ needs :
287+ - VerifyDocs
288+
289+ steps :
290+ - name : Checkout repository
291+ uses : actions/checkout@v2
232292
233- - name : 🚢 Build documentation in 'pyVHDLModel /doc'
234- run : |
235- docker build -t vhdl/doc - <<-EOF
236- FROM btdi/sphinx:featured
237- RUN apk add -U --no-cache graphviz
238- EOF
293+ - name : 🚢 Build container image 'vhdl /doc'
294+ run : |
295+ docker build -t vhdl/doc - <<-EOF
296+ FROM btdi/sphinx:featured
297+ RUN apk add -U --no-cache graphviz
298+ EOF
239299
240- - name : 🛳️ Unknown
241- uses : buildthedocs/btd@v0
242- with :
243- token : ${{ github.token }}
300+ - name : 🛳️ Build documentation from './pyVHDLModel/doc'
301+ uses : buildthedocs/btd@v0
302+ with :
303+ token : ${{ github.token }}
244304
245- - name : Upload artifacts to GitHub Pages
246- uses : actions/upload-artifact@master
247- with :
248- name : doc
249- path : doc/_build/html
305+ - name : 📤 Upload artifacts to GitHub Pages
306+ uses : actions/upload-artifact@master
307+ with :
308+ name : doc
309+ path : doc/_build/html
250310
251311 ArtifactCleanUp :
252312 name : 🗑️ Artifact Cleanup
@@ -260,8 +320,8 @@ jobs:
260320 ARTIFACT : ${{ needs.Package.outputs.artifact }}
261321
262322 steps :
263- - name : 🗑️ Delete all Artifacts
264- uses : geekyeggo/delete-artifact@v1
265- with :
266- name : |
267- ${{ env.ARTIFACT }}
323+ - name : 🗑️ Delete all Artifacts
324+ uses : geekyeggo/delete-artifact@v1
325+ with :
326+ name : |
327+ ${{ env.ARTIFACT }}
0 commit comments