Skip to content

Add pre-commit badge #2049

Add pre-commit badge

Add pre-commit badge #2049

Workflow file for this run

name: "CI"
on:
# Allow for workflows to be manuallly triggered
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main
schedule:
# At 07:00 UTC on Monday and Thursday.
- cron: "0 7 * * *"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
defaults:
run:
shell: bash -l {0}
jobs:
tests:
runs-on: ${{ matrix.OS }}
name: "πŸ’»-${{matrix.os }} 🐍-${{ matrix.python-version }} πŸ—ƒοΈ${{ matrix.pydantic-version }}"
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest']
pydantic-version: [">1"]
python-version:
- "3.10"
- "3.11"
- "3.12"
include:
# Note: pinned to macos-12
# see https://github.com/OpenFreeEnergy/openfe/issues/842
- os: "macos-12"
python-version: "3.11"
pydantic-version: ">1"
- os: "ubuntu-latest"
python-version: "3.11"
pydantic-version: "<2"
env:
OE_LICENSE: ${{ github.workspace }}/oe_license.txt
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Setup Micromamba"
uses: mamba-org/setup-micromamba@v1
with:
micromamba-binary-path: ~/.local/bin/micromamba
environment-file: environment.yml
environment-name: gufe
cache-environment: true
cache-downloads: true
create-args: >-
python=${{ matrix.python-version }}
init-shell: bash
- name: "Install"
run: python -m pip install --no-deps -e .
- name: "Test imports"
run: |
# if we add more to this, consider changing to for + env vars
python -Ic "import gufe; print(gufe.__version__)"
- name: "Environment Information"
run: |
micromamba info
micromamba list
- name: "Run tests"
run: |
pytest -n 2 -v --cov=gufe --cov-report=xml
- name: codecov
if: ${{ github.repository == 'OpenFreeEnergy/gufe'
&& github.event != 'schedule' }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.xml
fail_ci_if_error: False
verbose: True
package_build_and_test:
runs-on: ubuntu-latest
name: "package build and install test"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Setup Micromamba"
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
environment-name: gufe
cache-environment: true
cache-downloads: true
create-args: >-
python=${{ matrix.python-version }}
init-shell: bash
- name: "install extra deps"
run: pip install pipx wheel twine readme-renderer
- name: "build sdist"
run: pipx run build --sdist --outdir dist
- name: "check package build"
run: |
dist=$(ls -t1 dist/gufe-*tar.gz | head -n1)
test -n "${dist}" || { echo "no distribution found"; exit 1; }
twine check $dist
- name: "install from source dist"
working-directory: ./dist
run: python -m pip install gufe-*tar.gz
- name: "install checks"
working-directory: ./dist
run: |
pip check
python -Ic "import gufe; print(gufe.__version__)"
- name: "run tests"
working-directory: ./dist
run: pytest -n auto --pyargs gufe