Repository navigation
166 lines (152 loc) · 5.13 KB
/
Copy pathCI-python.yml
File metadata and controls
166 lines (152 loc) · 5.13 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
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.9]
runs-on: ${{ matrix.operatingSystem }}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
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 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 -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}
run: |
pip install raiwidgets
pip install -r requirements-vis.txt
pip install --upgrade "shap<=0.46.0"
- if: ${{ matrix.pythonVersion == '3.9' }}
name: Install scikit-learn to work around raiwidgets dependency
shell: bash -l {0}
run: |
pip install "scikit-learn==1.4.2"
- name: Install test dependencies
shell: bash -l {0}
run: |
pip install -r requirements-test.txt
pip install --upgrade "pandas>2.0"
- name: Restore editable package
shell: bash -l {0}
run: |
pip install --no-deps -e ./python
- 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
- if: ${{ matrix.pythonVersion == '3.9' }}
name: Upload code coverage results
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.packageDirectory }}-code-coverage-results
path: htmlcov
- if: ${{ matrix.pythonVersion == '3.9' }}
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.9') }}
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.9' }}
name: Set codecov status
shell: bash
run: |
if ${{ (steps.codecovupload1.outcome == 'success') || (steps.codecovupload2.outcome == 'success') }} ; then
echo fine
else
exit 1
fi
ci-numpy-compatibility:
strategy:
fail-fast: false
matrix:
include:
- numpyVersion: '1.26.4'
dependencySet: latest
- numpyVersion: '2.0.2'
dependencySet: latest
- numpyVersion: '2.0.2'
dependencySet: minimum
- numpyVersion: '2.2.6'
dependencySet: latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install ${{ matrix.dependencySet }} dependencies with NumPy ${{ matrix.numpyVersion }}
run: |
python -m pip install --upgrade pip
constraint_file="${{ github.workspace }}/numpy-constraints.txt"
echo "numpy==${{ matrix.numpyVersion }}" > "$constraint_file"
if [[ "${{ matrix.dependencySet }}" == "minimum" ]]; then
cat numpy_compatibility_tests/requirements-minimum.txt >> "$constraint_file"
fi
PIP_CONSTRAINT="$constraint_file" pip install \
"numpy==${{ matrix.numpyVersion }}" -e ./python pytest
- name: Verify dependency consistency
run: |
python -c "import numpy; assert numpy.__version__ == '${{ matrix.numpyVersion }}'"
pip check
- name: Run NumPy compatibility test
run: |
pytest numpy_compatibility_tests -v