@@ -222,31 +222,84 @@ jobs:
222222 run : |
223223 twine upload dist/*
224224
225+ VerifyDocs :
226+ name : 📓 Verify that example(s) is/are runnable
227+ runs-on : ubuntu-latest
228+ steps :
229+
230+ - name : 📥 Checkout repository
231+ uses : actions/checkout@v2
232+
233+ - name : ' ⚙️ Setup GHDL'
234+ uses : ghdl/setup-ghdl-ci@master
235+
236+ - name : ' 🐍 Setup Python'
237+ uses : actions/setup-python@v2
238+ with :
239+ python-version : 3.9
240+
241+ - name : ' 🐍 Install dependencies'
242+ run : |
243+ pip3 install pytest
244+ pip3 install git+https://github.com/ghdl/ghdl.git@$(ghdl version hash)
245+
246+ - name : ' Extract example from README'
247+ shell : python
248+ run : |
249+ from pathlib import Path
250+ import re
251+
252+ ROOT = Path('.')
253+
254+ with (ROOT / 'README.md').open('r') as rptr:
255+ content = rptr.read()
256+
257+ m = re.search(r"```py(thon)?(?P<code>.*?)```", content, re.MULTILINE|re.DOTALL)
258+
259+ if m is None:
260+ raise Exception("Regular expression did not find the example in the README!")
261+
262+ with (ROOT / 'tests/docs/example.py').open('w') as wptr:
263+ wptr.write(m["code"])
264+
265+ - name : ' Print example.py'
266+ run : cat tests/docs/example.py
267+
268+ - name : ' Run example.py'
269+ run : |
270+ cd tests/docs
271+ python3 example.py
272+
273+
225274 BuildTheDocs :
226275 name : 📓 Run BuildTheDocs and publish to GH-Pages
227276 runs-on : ubuntu-latest
277+
278+ needs :
279+ - VerifyDocs
280+
228281 steps :
229282
230- - name : Checkout repository
231- uses : actions/checkout@v2
283+ - name : Checkout repository
284+ uses : actions/checkout@v2
232285
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
286+ - name : 🚢 Build container image 'vhdl /doc'
287+ run : |
288+ docker build -t vhdl/doc - <<-EOF
289+ FROM btdi/sphinx:featured
290+ RUN apk add -U --no-cache graphviz
291+ EOF
239292
240- - name : 🛳️ Unknown
241- uses : buildthedocs/btd@v0
242- with :
243- token : ${{ github.token }}
293+ - name : 🛳️ Build documentation in 'pyVHDLModel/doc'
294+ uses : buildthedocs/btd@v0
295+ with :
296+ token : ${{ github.token }}
244297
245- - name : Upload artifacts to GitHub Pages
246- uses : actions/upload-artifact@master
247- with :
248- name : doc
249- path : doc/_build/html
298+ - name : Upload artifacts to GitHub Pages
299+ uses : actions/upload-artifact@master
300+ with :
301+ name : doc
302+ path : doc/_build/html
250303
251304 ArtifactCleanUp :
252305 name : 🗑️ Artifact Cleanup
@@ -260,8 +313,8 @@ jobs:
260313 ARTIFACT : ${{ needs.Package.outputs.artifact }}
261314
262315 steps :
263- - name : 🗑️ Delete all Artifacts
264- uses : geekyeggo/delete-artifact@v1
265- with :
266- name : |
267- ${{ env.ARTIFACT }}
316+ - name : 🗑️ Delete all Artifacts
317+ uses : geekyeggo/delete-artifact@v1
318+ with :
319+ name : |
320+ ${{ env.ARTIFACT }}
0 commit comments