forked from shap/shap
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (82 loc) · 2.98 KB
/
run_tests.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
name: tests
on:
push:
branches:
- master
pull_request:
branches:
- master
paths:
- "shap/**"
- "tests/**"
- "data/**"
- ".github/workflows/run_tests.yml"
- "pyproject.toml"
- "setup.py"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
run_tests:
strategy:
matrix:
os: ["ubuntu-latest"]
# The total number of matrix jobs should match codecov.yml `after_n_builds`.
python-version: ["3.8", "3.9", "3.10", "3.11"]
extras: ["test"]
include:
# Test on windows/mac, just one job each
- os: windows-latest
python-version: "3.11"
extras: "test"
- os: macos-latest
python-version: "3.11"
extras: "test"
# Run tests with only the core dependencies, to ensure we
# cover the latest version of numpy/pandas. See dsgibbons#46
- os: ubuntu-latest
python-version: "3.11"
extras: "test-core"
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache python libs
uses: actions/cache@v3
if: matrix.extras == 'test'
with:
path: |
# Only cache a subset of libraries, ensuring cache size remains under 10GB. See dsgibbons#42
${{ env.pythonLocation }}/**/site-packages/pyspark*
${{ env.pythonLocation }}/**/site-packages/nvidia*
${{ env.pythonLocation }}/**/site-packages/torch*
${{ env.pythonLocation }}/**/site-packages/functorch*
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ env.pythonLocation }}-${{ hashFiles('setup.py', 'pyproject.toml') }}-0
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# Use "eager" update strategy in case cached dependencies are outdated
# Using regular install NOT editable install: see GH #3020
pip install --upgrade --upgrade-strategy eager '.[${{ matrix.extras }},plots]'
- name: Test with pytest
# Ensure we avoid adding current working directory to sys.path:
# - Use "pytest" over "python -m pytest"
# - Use "append" import mode rather than default "prepend"
run: >
pytest --durations=20
--cov --cov-report=xml
--mpl-generate-summary=html --mpl-results-path=./mpl-results
--import-mode=append
- name: Upload mpl test report
if: failure()
uses: actions/upload-artifact@v3
with:
name: mpl-results-${{ matrix.python-version }}-${{ runner.os }}-${{ matrix.extras }}
path: mpl-results/
if-no-files-found: ignore
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3