Skip to content

CI

CI #695

Workflow file for this run

name: CI
on:
# GitHub has started calling new repo's first branch "main" https://github.com/github/renaming
# Existing codes likely still have "master" as the primary branch
# Both are tracked here to keep legacy and new codes working
workflow_run:
workflows:
- "CI-prep"
branches:
- "main"
- "v0.2.0"
types:
- completed
push:
branches:
- "main"
- "v0.2.0"
pull_request:
branches:
- "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 * * *"
jobs:
prep:
name: Prep on ${{ matrix.os }}, Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.11]
steps:
- uses: actions/checkout@v2
# More info on options: https://github.com/conda-incubator/setup-miniconda
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
channels: conda-forge
activate-environment: test
auto-update-conda: false
auto-activate-base: true
show-channel-urls: true
- name: Install conda-lock
shell: bash -l {0}
run: conda install conda-lock
- name: Generate conda-lock file
shell: bash -l {0}
run: |
conda-lock -f pyproject.toml -k explicit --filename-template ${{ matrix.python-version }}.conda.lock
- uses: actions/upload-artifact@v2
with:
name: conda-lock-file
path: ${{ matrix.python-version }}.conda.lock
test:
needs: prep
name: Test on ${{ matrix.os }}, Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.11]
steps:
- uses: actions/checkout@v2
- name: Additional info about the build
shell: bash
run: |
uname -a
df -h
ulimit -a
- uses: actions/[email protected]
with:
name: conda-lock-file
# More info on options: https://github.com/conda-incubator/setup-miniconda
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: false
activate-environment: explicit-env
environment-file: ${{ matrix.python-version }}.conda.lock
- name: Install package & its deps
# conda setup requires this special shell
shell: bash -l {0}
run: |
python -m pip install . --no-deps
conda list
- name: Run tests
# conda setup requires this special shell
shell: bash -l {0}
run: |
pytest -v --cov=auto_martini --cov-report=xml --cov-report=html --color=yes
- name: CodeCov
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
flags: unittests
name: codecov-${{ matrix.os }}-py${{ matrix.python-version }}