-
Notifications
You must be signed in to change notification settings - Fork 12
60 lines (52 loc) · 2.05 KB
/
create_test_conda_env.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
name: create_test_conda_env
on: [push]
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '>=3.9'
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Create fre-cli environment
run: |
# create environment fre-cli will be installed into
conda env create -f environment.yml --name fre-cli
# try to make sure the right things are in GITHUB_PATH
echo $CONDA/envs/fre-cli/bin >> $GITHUB_PATH
# install fre-cli w pip
$CONDA/envs/fre-cli/bin/python -m pip install --prefix $CONDA/envs/fre-cli .
- name: Run pytest in fre-cli environment
run: |
# try to make sure the right things are in GITHUB_PATH
echo $CONDA/envs/fre-cli/bin >> $GITHUB_PATH
which python
python --version
$CONDA/envs/fre-cli/bin/python --version
# run pytest
pytest --junit-xml=pytest_results.xml --config-file=fre/pytest.ini --cov-config=fre/coveragerc --cov-report=xml --cov=fre fre/
# install genbadge to generate coverage badge based on xml
pip install genbadge
genbadge coverage -v -i coverage.xml -o cov_badge.svg
genbadge tests -v -i pytest_results.xml -o pytest_badge.svg
- name: upload code coverage and test badge
uses: actions/upload-artifact@v4
with:
name: code-coverage-badges
path: |
cov-badge.svg
pytest_badge.svg
- name: Run pylint in fre-cli environment
run: |
# try to make sure the right things are in GITHUB_PATH
echo $CONDA/envs/fre-cli/bin >> $GITHUB_PATH
which python
python --version
$CONDA/envs/fre-cli/bin/python --version
# run pylint
pylint fre/ || echo "pylint returned non-zero exit code. preventing workflow from dying with this echo."