mbarlow-rmi is running unit tests #23
Workflow file for this run
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: Run Tests and Coverage for OPGEE | |
run-name: ${{ github.actor }} is running unit tests | |
on: | |
pull_request: | |
branches: | |
- master | |
- main | |
- dev | |
jobs: | |
test-linux: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 5 | |
defaults: | |
run: | |
shell: bash -el {0} | |
env: | |
OPGEE_HOME: ${{ github.workspace }}/tests/files | |
CI: 'true' | |
opgee_pkg_list: 'opgee-linux64.pkg_list.txt' | |
opgee_linux_yml: 'py3-opgee-linux.yml' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache pip dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: | |
${{ runner.os }}-pip-${{ hashFiles('requirements.txt')}} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Init opgee conda env | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-version: latest | |
activate-environment: opgee | |
python-version: 3.9 | |
- name: Cache Conda env | |
id: opgee-env-cache | |
uses: actions/cache@v3 | |
env: | |
# increment cache number to invalidate and rebuild the env | |
CACHE_NUMBER: 0 | |
with: | |
path: ${{ env.CONDA }}/envs | |
key: | |
${{ runner.os }}-conda-${{ runner.arch }}-${{ hashFiles(env.opgee_pkg_list) }}-${{ env.CACHE_NUMBER }} | |
- name: Update Conda env | |
run: | | |
conda env update -n opgee -f $opgee_linux_yml | |
if: steps.opgee-env-cache.outputs.cache-hit != 'true' | |
- run: | | |
pip install -e . | |
pip install pytest-cov codecov coveralls PyYAML | |
- name: Run unit tests with coverate | |
run: coverage run --source=opgee -m pytest | |
- name: Code coverage report | |
if: ${{ success() }} | |
run: | | |
coveralls | |
bash <(curl -s https://codecov.io/bash) |