|
| 1 | +# This workflow will install Python dependencies, run tests and lint with a single version of Python |
| 2 | +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python |
| 3 | + |
| 4 | +name: Python application |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - '**' |
| 10 | + |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + |
| 15 | +jobs: |
| 16 | + PEP-Guidelines: |
| 17 | + |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v3 |
| 22 | + - name: Set up Python 3.10 |
| 23 | + uses: actions/setup-python@v3 |
| 24 | + with: |
| 25 | + python-version: "3.10" |
| 26 | + - name: Install dependencies |
| 27 | + run: | |
| 28 | + python -m pip install --upgrade pip |
| 29 | + pip install flake8 flake8-docstrings pep8-naming |
| 30 | + - name: Lint with flake8 |
| 31 | + run: | |
| 32 | + # stop the build if there are Python syntax errors or undefined names |
| 33 | + flake8 ./GEMstack --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=__init__.py || exit 1 |
| 34 | + # to enable more advanced checks on the repo, uncomment the lines below (There are around 3000 violations) |
| 35 | + # flake8 ./GEMstack --ignore=D,C901,E402,E231 --count --max-complexity=10 --max-line-length=127 --statistics --exclude=__init__.py || exit 1 |
| 36 | + # if we want to enable documentation checks, uncomment the line below |
| 37 | + # flake8 ./GEMstack --ignore=E128,E402,E501,F401 --docstring-convention pep257 --max-line-length=120 --exclude=__init__.py || exit 1 |
| 38 | + continue-on-error: false |
| 39 | + |
| 40 | + Documentation: |
| 41 | + |
| 42 | + runs-on: ubuntu-latest |
| 43 | + |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v3 |
| 46 | + - name: Set up Python 3.10 |
| 47 | + uses: actions/setup-python@v3 |
| 48 | + with: |
| 49 | + python-version: "3.10" |
| 50 | + - name: Install dependencies |
| 51 | + run: | |
| 52 | + python -m pip install --upgrade pip |
| 53 | + pip install sphinx sphinx-rtd-theme |
| 54 | + - name: Generate Documentation |
| 55 | + run: | |
| 56 | + # stop the build if there are Python syntax errors or undefined names |
| 57 | + sphinx-build -b html docs docs/build |
| 58 | + - name: Save Documentation as Artifact |
| 59 | + uses: actions/upload-artifact@v4 |
| 60 | + with: |
| 61 | + name: documentation |
| 62 | + path: docs/build |
0 commit comments