diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 624f3073..3b477154 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -1,43 +1,60 @@ -name: build the documentation -on: [push, pull_request] +name: Build documentation + +on: + push: + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +env: + FORCE_COLOR: "1" + jobs: build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - - name: set up python - uses: actions/setup-python@v5 - with: - cache: 'pip' - - - name: install dependencies - run: | - pip install ".[docs]" - sudo apt-get -y update - sudo apt-get -y install graphviz libclang1-11 libclang-cpp11 - - - name: install doxygen from SF binary archives - env: - DOXYGEN_VERSION: 1.9.4 - run: | - mkdir doxygen-bin-arc && cd doxygen-bin-arc - curl -L https://sourceforge.net/projects/doxygen/files/rel-$DOXYGEN_VERSION/doxygen-$DOXYGEN_VERSION.linux.bin.tar.gz > doxygen.tar.gz - gunzip doxygen.tar.gz - tar xf doxygen.tar - cd doxygen-$DOXYGEN_VERSION - sudo make install - - - name: build the documentation - run: | - make html - rm documentation/build/html/.buildinfo - - - uses: actions/upload-artifact@v3 - with: - name: docs build artifacts - path: | - documentation/build/html - examples/*/*/xml + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3" + + - name: Install apt dependencies + run: | + sudo apt-get update + sudo apt-get install graphviz libclang1-11 libclang-cpp11 + + - name: Install doxygen from SourceForge binary archives + env: + DOXYGEN_VERSION: 1.9.4 + run: | + mkdir doxygen-bin-arc && cd doxygen-bin-arc + curl -L https://sourceforge.net/projects/doxygen/files/rel-$DOXYGEN_VERSION/doxygen-$DOXYGEN_VERSION.linux.bin.tar.gz > doxygen.tar.gz + gunzip doxygen.tar.gz + tar xf doxygen.tar + cd doxygen-$DOXYGEN_VERSION + sudo make install + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install .[docs] + + - name: Build the documentation + run: | + make html + rm documentation/build/html/.buildinfo + + - uses: actions/upload-artifact@v4 + with: + name: docs build artifacts + path: | + documentation/build/html + examples/*/*/xml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9b054158..23bcd253 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,27 +1,83 @@ -name: lint -on: [push, pull_request] -jobs: - build: +name: Lint source code + +on: + push: + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true +env: + FORCE_COLOR: "1" + +jobs: + black: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install "black==22.3.0" + - name: Format with black + run: black --check . - - name: set up python - uses: actions/setup-python@v5 - with: - cache: 'pip' + flake8: + runs-on: ubuntu-latest - - name: install dependencies - run: | - pip install ".[lint]" + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install --upgrade "flake8>=6" + - name: Lint with flake8 + run: flake8 breathe + + mypy: + runs-on: ubuntu-latest - - name: lint the source code - run: make flake8 + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install ".[lint]" + - name: Type check with mypy + run: mypy --warn-redundant-casts --warn-unused-ignores breathe tests - - name: check source code formatting - run: make black + twine: + runs-on: ubuntu-latest - - name: type check the source code - run: make type-check + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install --upgrade twine build + - name: Lint with twine + run: | + python -m build . + twine check dist/* diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 0c95b400..64bc9008 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -1,8 +1,31 @@ -name: unit tests -on: [push, pull_request] -jobs: - build: +name: Tests + +on: + push: + paths: + - ".github/workflows/unit_tests.yml" + - "breathe/**" + - "tests/**" + pull_request: + paths: + - ".github/workflows/unit_tests.yml" + - "breathe/**" + - "tests/**" + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +env: + FORCE_COLOR: "1" + PYTHONDEVMODE: "1" # -X dev + PYTHONWARNDEFAULTENCODING: "1" # -X warn_default_encoding +jobs: + test: runs-on: ubuntu-latest strategy: fail-fast: false @@ -14,32 +37,50 @@ jobs: - '3.11' - '3.12' sphinx-version: - - '5.0.2' - - '5.1.1' - - '5.2.3' - - '5.3.0' - - '6.1.3' - - git+https://github.com/sphinx-doc/sphinx.git@master + - '5.0' + - '5.1' + - '5.2' + - '5.3' + - '6.0' + - '6.1' + - '6.2' + - '7.0' + - '7.1' + - '7.2' + - '7.3' + - '7.4' + - '8.0' steps: - - uses: actions/checkout@v4 - - name: set up python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - cache: 'pip' - - - name: install dependencies - run: | - pip install ".[test]" - - - name: install sphinx from PyPI or from git - run: | - if echo "${{ matrix.sphinx-version }}"|grep -q git; then - pip install ${{ matrix.sphinx-version }} - else - pip install -Iv Sphinx==${{ matrix.sphinx-version }} - fi + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install .[test] + - name: Install Sphinx ${{ matrix.sphinx-version }} + run: python -m pip install --upgrade "Sphinx~=${{ matrix.sphinx-version }}.0" + - name: Test with pytest + run: python -m pytest -vv + env: + PYTHONWARNINGS: "error" # treat all warnings as errors - - name: run the unit tests - run: make dev-test + test-latest-sphinx: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v5 + with: + python-version: "3" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install .[test] + - name: Install Sphinx master + run: python -m pip install "Sphinx @ git+https://github.com/sphinx-doc/sphinx" + - name: Test with pytest + run: python -m pytest -vv