VaMPy CI #865
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: 11 # Increase to reset cache | |
jobs: | |
check-code: | |
name: Check code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- 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@v2 | |
with: | |
path: ${{ matrix.prefix }} | |
key: ${{ matrix.label }}-${{ github.run_id }}-${{ env.CACHE_NUMBER }} | |
restore-keys: ${{ matrix.label }}- | |
- run: mamba env update -n vampy -f environment-test.yml | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Install VaMPy | |
run: python -m pip install .[test] | |
- name: Run tests | |
run: 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 |