Support PEP 639 and format pyproject.toml
#356
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: CI | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| pull_request: | |
| branches: | |
| - "main" | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| jobs: | |
| test: | |
| name: 📦=${{ matrix.install-source }}, 💻=${{ matrix.os }}, 🐍=${{ matrix.python-version }}, 🍺=${{ matrix.pint-version }}, ⚛️=${{ matrix.openmm }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| install-source: [conda, pypi] | |
| os: [macos-latest, ubuntu-latest] | |
| openmm: ["true", "false"] | |
| python-version: ["3.11", "3.12", "3.13"] | |
| pint-version: ["0.24"] | |
| exclude: | |
| - python-version: "3.13" | |
| openmm: "true" | |
| env: | |
| PYTEST_ARGS: -v -n auto | |
| COV: --cov=openff/units --cov-report=xml --cov-append | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup conda environment | |
| if: ${{ matrix.install-source == 'conda' }} | |
| uses: mamba-org/setup-micromamba@v2 | |
| with: | |
| environment-file: devtools/conda-envs/test_env.yaml | |
| create-args: >- | |
| python=${{ matrix.python-version }} | |
| pint=${{ matrix.pint-version }} | |
| - name: Optionally install OpenMM via conda | |
| if: ${{ matrix.install-source == 'conda' && matrix.openmm == 'true' }} | |
| run: micromamba install "openmm ~=8.3" --yes | |
| - name: Verify OpenMM is not installed when not expected (conda) | |
| if: ${{ matrix.install-source == 'conda' && matrix.openmm == 'false' }} | |
| run: | | |
| # If the number of packages matching "*openmm*" is greater than zero | |
| if [[ $(micromamba list | grep openmm | wc -l) -gt 0 ]]; then | |
| micromamba list; | |
| exit 1; | |
| fi | |
| - name: Install package locally (conda) | |
| if: ${{ matrix.install-source == 'conda' }} | |
| run: python -m pip install --no-deps -e downstream_dummy/ . | |
| - name: Setup Python | |
| if: ${{ matrix.install-source == 'pypi' }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install package via PyPI | |
| if: ${{ matrix.install-source == 'pypi' }} | |
| run: python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ -e ."[test,typing]" downstream_dummy/ | |
| - name: Optionally install OpenMM from PyPI | |
| if: ${{ matrix.install-source == 'pypi' && matrix.openmm == 'true' }} | |
| run: pip install "openmm ~=8.3" | |
| - name: Verify OpenMM is not installed when not expected (PyPI) | |
| if: ${{ matrix.install-source == 'pypi' && matrix.openmm == 'false' }} | |
| run: | | |
| # If the number of packages matching "*openmm*" is greater than zero | |
| if [[ $(pip list | grep openmm | wc -l) -gt 0 ]]; then | |
| pip list; | |
| exit 1; | |
| fi | |
| - name: Run unit tests | |
| run: | | |
| if [[ ${{ matrix.openmm }} == false ]]; then | |
| PYTEST_ARGS+=" --ignore=openff/units/_tests/test_openmm.py" | |
| fi | |
| # https://github.com/openforcefield/openff-units/issues/111 | |
| python -c "from openff.units import *" | |
| python -m pytest $PYTEST_ARGS $COV openff/units/_tests/ | |
| - name: Run dummy package tests | |
| run: python -m pytest $PYTEST_ARGS downstream_dummy/tests/ | |
| - name: Run mypy | |
| if: ${{ matrix.python-version == '3.12' }} | |
| run: python -m mypy -p "openff.units" && python -m mypy downstream_dummy/ --exclude=downstream_dummy/build/ | |
| - name: Run docexamples | |
| if: ${{ matrix.openmm == 'true' }} | |
| run: pytest --doctest-modules $PYTEST_ARGS openff --ignore=openff/units/_tests | |
| - name: Check OpenMM is lazy-imported | |
| if: ${{ matrix.openmm == 'true' }} | |
| run: python -c "import sys; from openff.units import unit, Quantity; assert 'openmm' not in sys.modules" | |
| - name: Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| fail_ci_if_error: false |