choderalab/yank

View on GitHub
.github/workflows/CI.yaml

Summary

Maintainability
Test Coverage
name: CI

on:
  pull_request:
    branches:
      - "master"
  schedule:
    # nightly tests
    - cron: "0 0 * * *"
  push:
    branches:
      - master

jobs:
  test:
    name: Test on ${{ matrix.cfg.os }}, Python ${{ matrix.cfg.python-version }}, OpenMM ${{ matrix.cfg.openmm }}
    runs-on: ${{ matrix.cfg.os }}
    strategy:
      fail-fast: false
      matrix:
        cfg:
          - { os: ubuntu-latest, python-version: 3.7, docs: true,  openmm: latest }
          - { os: macos-latest,  python-version: 3.7, docs: true,  openmm: latest }
          - { os: ubuntu-latest, python-version: 3.8, docs: false, openmm: latest }
          - { os: ubuntu-latest, python-version: 3.7, docs: false, openmm: nightly }
          - { os: ubuntu-latest, python-version: 3.8, docs: false, openmm: nightly }
          - { os: ubuntu-latest, python-version: 3.7, docs: false, openmm: conda-forge }
          - { os: ubuntu-latest, python-version: 3.8, docs: false, openmm: conda-forge }

    env:
      OPENMM: ${{ matrix.cfg.openmm }}
      OE_LICENSE: ${{ github.workspace }}/oe_license.txt
      PACKAGENAME: yank

    steps:
      - uses: actions/checkout@v2

      - name: Additional info about the build
        shell: bash
        run: |
          uname -a
          df -h
          ulimit -a

      # More info on options: https://github.com/conda-incubator/setup-miniconda
      - uses: conda-incubator/setup-miniconda@v2
        with:
          python-version: ${{ matrix.cfg.python-version }}
          environment-file: devtools/conda-envs/test_env.yaml
          activate-environment: test
          auto-update-conda: true
          auto-activate-base: false
          show-channel-urls: true

      - name: Refine test environment
        shell: bash -l {0}
        run: |
          case ${{ matrix.cfg.openmm }} in
            latest)
              echo "Using latest release OpenMM."
              conda install --quiet -c omnia openmm;;
            rc)
              echo "Using OpenMM rc"
              conda install --quiet -c omnia/label/rc openmm;;
            beta)
              echo "Using OpenMM beta"
              conda install --quiet -c omnia/label/beta openmm;;
            nightly)
              echo "Using OpenMM nightly dev build."
              conda install --quiet -c omnia-dev openmm;;
            conda-forge)
              echo "Using OpenMM conda-forge testing build."
              conda install --quiet -c conda-forge/label/test openmm;;
          esac

      - name: Install package
        shell: bash -l {0}
        run: |
          python -m pip install --no-deps -v .

      - name: Environment Information
        shell: bash -l {0}
        run: |
          conda info -a
          conda list

      - name: Decrypt licenses
        # TODO: MODELLER
        shell: bash -l {0}
        env:
          OE_LICENSE_TEXT: ${{ secrets.OE_LICENSE }}
        run: |
          echo "${OE_LICENSE_TEXT}" > ${OE_LICENSE}
          python -c "import openeye; assert openeye.oechem.OEChemIsLicensed(), 'OpenEye license checks failed!'"

      - name: Test the package
        shell: bash -l {0}
        run: |
          export OE_LICENSE="$HOME/oe_license.txt"
          export TRAVIS=true
          pushd .
          nosetests ${PACKAGENAME} --nocapture --with-coverage --verbosity=3 --with-timer -a '!slow' --cover-xml --cover-xml-file=./coverage.xml
          popd

      - name: Codecov
        uses: codecov/codecov-action@v1
        with:
          file: ./coverage.xml
          fail_ci_if_error: false

      - name: Build docs
        shell: bash -l {0}
        if: matrix.cfg.docs
        run: |
          cd docs && make html; cd ..
          # Move the docs into a versioned subdirectory
          python devtools/travis-ci/set_doc_version.py
          # Prepare versions.json
          python devtools/travis-ci/update_versions_json.py