VaMPy CI #1078
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: VaMPy CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
schedule: | |
- cron: '0 8 * * *' | |
env: | |
CACHE_NUMBER: 12 # Increase to reset cache | |
jobs: | |
check-code: | |
name: Check code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.8' | |
- name: Install dependencies and VaMPy | |
run: | | |
python -m pip install --upgrade pip setuptools | |
python -m pip install types-paramiko .[test] | |
- run: python -m flake8 | |
- run: python -m mypy | |
test-code: | |
needs: check-code | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
label: linux-64 | |
prefix: /usr/share/miniconda3/envs/vampy | |
- os: macos-latest | |
label: osx-64 | |
prefix: /Users/runner/miniconda3/envs/vampy | |
name: Test VaMPy on ${{ matrix.label }} | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: # https://github.com/marketplace/actions/setup-miniconda#use-a-default-shell | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.8' | |
- name: Setup and install with Mambaforge | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
channels: conda-forge | |
activate-environment: vampy | |
use-mamba: true | |
environment-file: environment-test.yml | |
id: mamba | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ matrix.prefix }} | |
key: ${{ matrix.label }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment-test.yml') }} | |
restore-keys: ${{ matrix.label }}-${{ env.CACHE_NUMBER }}- | |
- run: mamba env update -n vampy -f environment-test.yml | |
- name: Install VaMPy | |
run: mamba run -n vampy python -m pip install '.[test]' | |
- name: Run tests | |
run: mamba run -n vampy python -m pytest tests | |
- name: Upload coverage report to Codecov | |
if: matrix.os == 'ubuntu-latest' | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
fail_ci_if_error: false | |
verbose: true |