Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

speed up and improve CI and update readme #169

Merged
merged 3 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 31 additions & 38 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,50 @@ name: CI
on:
pull_request:
branches:
- master
- main
push:
branches:
- master
- main

schedule:
# Nightly tests run on master 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 * * *"

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

defaults:
run:
shell: bash -l {0}

jobs:
test:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }}, Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
include:
- name: Linux, Python 3.8
os: ubuntu-latest
python-version: "3.8"
conda-installer: https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh

- name: Linux, Python 3.9
os: ubuntu-latest
python-version: "3.9"
conda-installer: https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh

- name: MacOS, Python 3.9
os: macOS-latest
python-version: "3.9"
conda-installer: https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-MacOSX-x86_64.sh
os: ['macos', 'ubuntu']
python-version:
- "3.9"
- "3.10"

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

steps:
- uses: actions/checkout@v2

- uses: conda-incubator/setup-miniconda@v2
- uses: actions/checkout@v3
- uses: mamba-org/setup-micromamba@v1
with:
installer-url: ${{ matrix.conda-installer }}
python-version: ${{ matrix.python-version }}
activate-environment: test
channel-priority: true
environment-file: devtools/conda-envs/espaloma.yaml
auto-activate-base: false
use-mamba: true
cache-environment: true
cache-downloads: true
create-args: >-
python=${{ matrix.python-version }}

- name: Additional info about the build
shell: bash
Expand All @@ -63,27 +56,27 @@ jobs:
ulimit -a

- name: Environment Information
shell: bash -l {0}
run: |
conda info --all
conda list
mamba --version
micromamba info
micromamba list
micromamba --version

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

- name: Run tests
shell: bash -l {0}
run: |
pytest -v --cov=espaloma --cov-report=xml --color=yes espaloma/
pytest -v -n auto --cov=espaloma --cov-report=xml --color=yes espaloma/

- name: CodeCov
uses: codecov/codecov-action@v1
if: always()
uses: codecov/codecov-action@v3
if: ${{ github.repository == 'choderalab/espaloma'
&& github.event_name == 'pull_request' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
yml: ./.codecov.yml
fail_ci_if_error: False
verbose: True
34 changes: 34 additions & 0 deletions .github/workflows/clean_cache.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# from https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries
name: cleanup caches by a branch
on:
pull_request:
types:
- closed

jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Cleanup
run: |
gh extension install actions/gh-actions-cache

REPO=${{ github.repository }}
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"

echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )

## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
espaloma: **E**xtensible **S**urrogate **P**otenti**al** **O**ptimized by **M**essage-passing **A**lgorithms 🍹
==============================
[//]: # (Badges)
[![CI](https://github.com/choderalab/espaloma/actions/workflows/CI.yaml/badge.svg?branch=master)](https://github.com/choderalab/espaloma/actions/workflows/CI.yaml)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/choderalab/espaloma.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/choderalab/espaloma/alerts/)
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/choderalab/espaloma.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/choderalab/espaloma/context:python)
[![docs stable](https://img.shields.io/badge/docs-stable-5077AB.svg?logo=read%20the%20docs)](https://espaloma.wangyq.net/)

[![CI](https://github.com/choderalab/espaloma/actions/workflows/CI.yaml/badge.svg?branch=main)](https://github.com/choderalab/espaloma/actions/workflows/CI.yaml)
[![Documentation Status](https://readthedocs.org/projects/espaloma/badge/?version=latest)](https://espaloma.readthedocs.io/en/latest/?badge=latest)

Source code for [Wang Y, Fass J, and Chodera JD "End-to-End Differentiable Construction of Molecular Mechanics Force Fields."](https://arxiv.org/abs/2010.01196)

Expand Down
Loading