forked from interpretml/interpret-community
-
Notifications
You must be signed in to change notification settings - Fork 1
115 lines (108 loc) · 3.6 KB
/
CI-python.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: CI Python
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '30 5 * * *'
jobs:
ci-python:
strategy:
matrix:
packageDirectory: ["interpret_community"]
operatingSystem: [ubuntu-latest]
pythonVersion: [3.7, 3.8, 3.9]
runs-on: ${{ matrix.operatingSystem }}
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.pythonVersion }}
- name: Install numpy
shell: bash -l {0}
run: |
conda install --yes --quiet numpy==1.19.5 -c conda-forge
- if: ${{ matrix.operatingSystem != 'macos-latest' }}
name: Install pytorch on non-MacOS
shell: bash -l {0}
run: |
conda install --yes --quiet pytorch torchvision captum cpuonly -c pytorch
- if: ${{ matrix.operatingSystem == 'macos-latest' }}
name: Install Anaconda packages on MacOS, which should not include cpuonly according to official docs
shell: bash -l {0}
run: |
conda install --yes --quiet pytorch torchvision captum -c pytorch
- if: ${{ matrix.operatingSystem == 'macos-latest' }}
name: Install lightgbm from conda on MacOS
shell: bash -l {0}
run: |
conda install --yes -c conda-forge lightgbm
- name: Install package
shell: bash -l {0}
run: |
pip install -e ./python
- name: Install dev dependencies
shell: bash -l {0}
run: |
pip install -r requirements-dev.txt
- name: Install visualization dependencies
shell: bash -l {0}
# install scikit-learn to workaround raiwidgets dependency
run: |
pip install raiwidgets
pip install -r requirements-vis.txt
pip install --upgrade scikit-learn
- name: Install test dependencies
shell: bash -l {0}
run: |
pip install -r requirements-test.txt
- name: Test with pytest
shell: bash -l {0}
run: |
pytest ./tests -m "not notebooks" -s -v --cov=${{ matrix.packageDirectory }} --cov-report=xml --cov-report=html
- name: Upload code coverage results
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.packageDirectory }}-code-coverage-results
path: htmlcov
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
- if: ${{ matrix.pythonVersion == '3.8' }}
name: Upload to codecov
id: codecovupload1
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: .
env_vars: OS,PYTHON
fail_ci_if_error: false
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
path_to_write_report: ./coverage/codecov_report.txt
verbose: true
- if: ${{ (steps.codecovupload1.outcome == 'failure') && (matrix.pythonVersion == '3.8') }}
name: Retry upload to codecov
id: codecovupload2
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: .
env_vars: OS,PYTHON
fail_ci_if_error: false
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
path_to_write_report: ./coverage/codecov_report.txt
verbose: true
- if: ${{ matrix.pythonVersion == '3.8' }}
name: Set codecov status
shell: bash
run: |
if ${{ (steps.codecovupload1.outcome == 'success') || (steps.codecovupload2.outcome == 'success') }} ; then
echo fine
else
exit 1
fi