CI #244
This file contains 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" | |
schedule: | |
# Weekly tests run on main by default: | |
# Scheduled workflows run on the latest commit on the default or base branch. | |
# (from https://help.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule) | |
- cron: "0 0 * * 0" | |
# This will cancel the workflow if we make another push, | |
# we want this so that if we make 3 commits, we only | |
# run our workflow on the last commit, instead of running | |
# it 3 times. | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.ref }}" | |
cancel-in-progress: true | |
defaults: | |
run: | |
# This shell command is a safer default so if bash hits | |
# and error, it will stop | |
shell: bash -leo pipefail {0} | |
jobs: | |
test: | |
name: Test on ${{ matrix.os }}, Python ${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
# We want every job in our matrix to run, so we don't | |
# want to fail fast | |
fail-fast: false | |
matrix: | |
# We don't really support windows so we don't need | |
# to test it | |
os: [macOS-latest, ubuntu-latest] | |
python-version: ["3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Additional info about the build | |
shell: bash | |
run: | | |
uname -a | |
df -h | |
ulimit -a | |
# More info on options: https://github.com/marketplace/actions/provision-with-micromamba | |
- name: "Setup Micromamba" | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
#environment-file: devtools/conda-envs/test_env.yaml | |
environment-file: environment.yml | |
environment-name: openfe_gromacs | |
cache-environment: true | |
cache-downloads: true | |
create-args: >- | |
python=${{ matrix.python-version }} | |
init-shell: bash | |
- name: Install gmxapi | |
run: | | |
# gmxapi needs to be pointed to where gromacs lives | |
# we also need to tell it where to find our compilers | |
export CMAKE_ARGS="-Dgmxapi_ROOT=$CONDA_PREFIX -C $CONDA_PREFIX/share/cmake/gromacs/gromacs-hints.cmake -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC" | |
pip install gmxapi | |
- name: Install package | |
run: python -m pip install . --no-deps | |
- name: Run tests | |
run: | | |
pytest -n logical -v --cov=openfe_gromacs --cov-report=xml --color=yes openfe_gromacs/tests/ | |
- name: CodeCov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
if: ${{ github.event != 'schedule' }} # Don't upload results on scheduled runs | |
with: | |
file: ./coverage.xml | |
flags: unittests | |
name: codecov-${{ matrix.os }}-py${{ matrix.python-version }} |