GH Actions CI #177
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: GH Actions CI | |
| on: | |
| push: | |
| pull_request: | |
| schedule: | |
| # nightly tests, between US and AUS working hours | |
| - cron: "0 9 * * *" | |
| workflow_dispatch: | |
| concurrency: | |
| # Specific group naming so CI is only cancelled | |
| # within same PR or on merge to main | |
| group: ${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| env: | |
| OE_LICENSE: ${{ github.workspace }}/oe_license.txt | |
| jobs: | |
| main_tests: | |
| name: CI (${{ matrix.os }}, py-${{ matrix.python-version }}, rdkit=${{ matrix.include-rdkit }}, openeye=${{ matrix.include-openeye }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| os: [macOS-latest, ubuntu-latest] | |
| python-version: ["3.11", "3.12"] | |
| include-rdkit: [true] | |
| include-openeye: [false, true] | |
| exclude: | |
| - include-rdkit: false | |
| include-openeye: false | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Build information | |
| run: | | |
| uname -a | |
| df -h | |
| ulimit -a | |
| - name: Install environment | |
| uses: mamba-org/setup-micromamba@v2 | |
| with: | |
| environment-file: devtools/conda-envs/test.yaml | |
| create-args: >- | |
| python=${{ matrix.python-version }} | |
| - name: Install package | |
| run: | | |
| python -m pip install . --no-deps | |
| - uses: ./.github/actions/include-openeye | |
| if: matrix.include-openeye == true | |
| with: | |
| openeye-license-text: ${{ secrets.OE_LICENSE }} | |
| openeye-license-file: ${{ env.OE_LICENSE }} | |
| - name: Uninstall OpenEye | |
| if: matrix.include-openeye == false | |
| run: micromamba remove --force openeye-toolkits --yes || echo "openeye not installed" | |
| - name: Uninstall RDKit | |
| if: matrix.include-rdkit == false | |
| run: micromamba remove --force rdkit --yes || echo "rdkit not installed" | |
| - name: Check toolkit installations | |
| shell: bash -l -c "python -u {0}" | |
| run: | | |
| from openff.toolkit.utils.toolkits import OPENEYE_AVAILABLE, RDKIT_AVAILABLE | |
| assert str(OPENEYE_AVAILABLE).lower() == '${{ matrix.include-openeye }}' | |
| assert str(RDKIT_AVAILABLE).lower() == '${{ matrix.include-rdkit }}' | |
| - name: Run type-checker | |
| if: ${{ false == true }} # Skip Mypy for now | |
| run: | | |
| python -m mypy dimsim/ | |
| - name: Run tests | |
| run: | | |
| python -m pytest -v --cov=dimsim --cov-config=pyproject.toml --cov-append --cov-report=xml --color=yes dimsim/_tests | |
| - name: codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| verbose: True | |
| pylint_check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install Pylint | |
| run: | | |
| which pip | |
| which python | |
| pip install pylint | |
| - name: Run Pylint | |
| env: | |
| PYLINTRC: .pylintrc | |
| run: | | |
| pylint dimsim | |
| pypi_check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| pip install setuptools twine | |
| - name: Build package | |
| run: | | |
| python3 -m pip install --upgrade build | |
| python3 -m build | |
| - name: Check package build | |
| run: | | |
| DISTRIBUTION=$(ls -t1 dist/dimsim-*.tar.gz | head -n 1) | |
| test -n "${DISTRIBUTION}" || { echo "no distribution dist/dimsim-*.tar.gz found"; exit 1; } | |
| echo "twine check $DISTRIBUTION" | |
| twine check $DISTRIBUTION | |
| install_from_source_conda: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install conda | |
| uses: mamba-org/setup-micromamba@v2 | |
| with: | |
| environment-name: dimsim | |
| create-args: >- | |
| python=${{ matrix.python-version }} | |
| - name: Build from source | |
| run: | | |
| micromamba env update --name dimsim --file devtools/conda-envs/dev.yaml | |
| python --version | |
| python -m pip install . --no-deps | |
| micromamba list | |
| - name: Check success | |
| run: | | |
| python -c "import dimsim ; print(dimsim.__version__)" |