Simplify release workflow 2 #74
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| cache: pip | |
| cache-dependency-path: pyproject.toml | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install .[dev] | |
| - name: Lint | |
| run: pre-commit run --all-files --show-diff-on-failure | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # OVITO does not yet ship wheels for Python 3.13, so we cap at 3.12. | |
| python-version: ['3.10', '3.11', '3.12'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| cache-dependency-path: pyproject.toml | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libegl1 libopengl0 libxkbcommon-x11-0 libdbus-1-3 | |
| python -m pip install --upgrade pip | |
| pip install .[dev,all] | |
| - name: Test | |
| run: pytest --cov=wetting_angle_kit --cov-report=xml --cov-fail-under=80 | |
| - name: Upload coverage to Codecov | |
| if: matrix.python-version == '3.11' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./coverage.xml | |
| fail_ci_if_error: false | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| # macOS smoke test: confirms the package installs and the non-OVITO code | |
| # paths work on macOS. OVITO is skipped because it does not ship via PyPI | |
| # for macOS; install via its conda channel locally if you need it. | |
| test-macos: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: pip | |
| cache-dependency-path: pyproject.toml | |
| - name: Install dependencies (ASE only, no OVITO) | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install .[dev,ase] | |
| - name: Test | |
| # OVITO-dependent test modules call ``pytest.importorskip("ovito")`` | |
| # at import time, so the full suite can run on macOS: those modules | |
| # are skipped automatically and the ASE-backed tests still execute. | |
| run: pytest | |
| docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: pip | |
| cache-dependency-path: pyproject.toml | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| # Required to generate rst files from markdown | |
| sudo apt install pandoc | |
| pip install .[doc] | |
| - name: Build Sphinx docs | |
| working-directory: docs | |
| # ``-W`` promotes warnings to errors so doc regressions break CI | |
| # rather than slipping through silently; ``--keep-going`` reports | |
| # every offender in one run instead of stopping at the first. | |
| run: python -m sphinx -W --keep-going -b html source build/html |