| 1 |
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
| 2 |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
| 3 |
|
| 4 |
name: Python package |
| 5 |
|
| 6 |
on: |
| 7 |
push: |
| 8 |
branches: [ master ] |
| 9 |
pull_request: |
| 10 |
branches: [ master ] |
| 11 |
|
| 12 |
jobs: |
| 13 |
build: |
| 14 |
|
| 15 |
runs-on: ubuntu-latest |
| 16 |
strategy: |
| 17 |
fail-fast: false |
| 18 |
matrix: |
| 19 |
python-version: [3.8, 3.12, 3.13] |
| 20 |
|
| 21 |
steps: |
| 22 |
- uses: actions/checkout@v4 |
| 23 |
- name: Set up Python ${{ matrix.python-version }} |
| 24 |
uses: actions/setup-python@v5 |
| 25 |
with: |
| 26 |
python-version: ${{ matrix.python-version }} |
| 27 |
- name: Install dependencies |
| 28 |
run: | |
| 29 |
# also install epstopdf, latexmk, pdflatex, etc. |
| 30 |
sudo apt update |
| 31 |
sudo apt install latexmk plantuml texlive texlive-font-utils texlive-latex-extra |
| 32 |
python -m pip install --upgrade pip |
| 33 |
python -m pip install Pillow flake8 pytest sphinx |
| 34 |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
| 35 |
- name: Work around sphinxcontrib namespace package conflicts |
| 36 |
run: | |
| 37 |
# if we had sphinxcontrib/ directory with no __init__.py in the sys.path, |
| 38 |
# importing non-native namespace package would fail even if our local |
| 39 |
# module should precede the native namespace package. |
| 40 |
# https://packaging.python.org/en/latest/guides/packaging-namespace-packages/#native-namespace-packages |
| 41 |
python -c 'import sphinxcontrib.plantuml' || rm -f sphinxcontrib/__init__.py* |
| 42 |
- name: Lint with flake8 |
| 43 |
run: | |
| 44 |
# stop the build if there are Python syntax errors or undefined names |
| 45 |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 46 |
flake8 . --count --max-complexity=10 --statistics |
| 47 |
- name: Test with pytest |
| 48 |
run: | |
| 49 |
python -m pytest |
| 50 |
- name: Build example docs |
| 51 |
run: | |
| 52 |
make -C tests/fixture html |
| 53 |
make -C tests/fixture latexpdf |