Skip to content

Assorted Bug Fixes #148

Assorted Bug Fixes

Assorted Bug Fixes #148

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]
include:
- os: ubuntu-latest
python-version: "3.12"
environment_file: cge_test
- os: windows-latest
python-version: "3.11"
environment_file: cge_test_windows
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 cge_test.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-py${{matrix.python-version}}-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('conda_envs/cge_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: 1
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: cge-test
channel-priority: strict
environment-file: conda_envs/${{ matrix.environment_file }}.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 cge-test
pip install -e .
python --version
- name: Run tests
run: |
python -m pytest -vv --cov=cge_modeling --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