forked from msmasnadi/OPGEEv4
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (70 loc) · 2.19 KB
/
opgee-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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
id: pip-cache
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
pip install -e .
python -m pip install -e .
pip install pytest-cov codecov coveralls PyYAML
# if: steps.opgee-env-cache.outputs.cache-hit != 'true'
if: steps.pip-cache.outputs.cache-hit != 'true' || steps.opgee-env-cache.cache-hit != 'true'
# - name: Install pip deps
# run: |
# conda activate opgee
# python -m pip install setuptools
# python -m pip install -e .
# pip install pytest-cov codecov coveralls PyYAML
# if: steps.pip-cache.outputs.cache-hit != 'true' || steps.opgee-env-cache.cache-hit != 'true'
- name: Run unit tests with coverage
run: coverage run --source=opgee -m pytest
- name: Code coverage report
if: ${{ success() }}
run: |
coveralls
bash <(curl -s https://codecov.io/bash)