Skip to content

gEconpy v2.0

gEconpy v2.0 #133

Workflow file for this run

name: run_tests
on:
pull_request:
push:
branches: [main]
jobs:
unittest:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.12"]
test-subset:
- |
tests/
runs-on: ${{ matrix.os }}
env:
TEST_SUBSET: ${{ matrix.test-subset }}
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
env:
# Increase this value to reset cache if geconpy_test.yml has not changed
CACHE_NUMBER: 2
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-py${{matrix.python-version}}-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('conda_envs/geconpy_test.yml') }}
- name: Cache multiple paths
uses: actions/cache@v3
env:
# Increase this value to reset cache if requirements.txt has not changed
CACHE_NUMBER: 2
with:
path: |
~/.cache/pip
$RUNNER_TOOL_CACHE/Python/*
~\AppData\Local\pip\Cache
key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{
hashFiles('requirements.txt') }}
- uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Miniforge3
miniforge-version: latest
mamba-version: "*"
activate-environment: geconpy-test
channel-priority: strict
environment-file: conda_envs/geconpy_test.yml
python-version: ${{matrix.python-version}}
use-mamba: true
use-only-tar-bz2: false # IMPORTANT: This may break caching of conda packages! See https://github.com/conda-incubator/setup-miniconda/issues/267
- name: Install current branch
run: |
conda activate geconpy-test
pip install -e .
python --version
- name: Run tests
run: |
python -m pytest -vv --cov=gEconpy --cov-report=xml --no-cov-on-fail --cov-report term $TEST_SUBSET
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # use token for more robust uploads
env_vars: TEST_SUBSET
name: ${{ matrix.os }}
fail_ci_if_error: false
verbose: true