-
-
Notifications
You must be signed in to change notification settings - Fork 132
193 lines (193 loc) · 5.85 KB
/
ci.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
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
jobs:
test:
defaults:
run:
shell: bash -el {0}
strategy:
matrix:
os: [ubuntu-latest]
python: ['3.10', '3.11', '3.12']
pip_opts: ['']
numba_boundscheck: [0]
include:
- os: macos-latest
python: '3.10'
- os: windows-latest
python: '3.10'
- os: ubuntu-latest
python: '3.10'
numba_boundscheck: 1
- os: ubuntu-latest
pip_opts: "--pre -U"
fail-fast: false
runs-on: ${{ matrix.os }}
env:
PYTHON_VERSION: ${{ matrix.python }}
NUMBA_BOUNDSCHECK: ${{ matrix.numba_boundscheck }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Cache conda
uses: actions/cache@v4
env:
# Increase this value to reset cache if ci/environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key:
test-${{ matrix.os }}-conda-py${{ matrix.python }}-${{ env.CACHE_NUMBER }}-${{
hashFiles('ci/environment.yml') }}
- uses: julia-actions/setup-julia@v1
with:
version: '1.10.0'
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: sparse-dev
allow-softlinks: true
environment-file: ci/environment.yml
python-version: ${{ matrix.python }}
miniforge-version: latest
- name: Install package
run: |
pip install -e .[tests]
pip install ${{ matrix.pip_opts }} numpy numba
- name: Run tests
run: |
SPARSE_BACKEND=Numba pytest --pyargs sparse
SPARSE_BACKEND=Finch pytest --pyargs sparse/tests
- uses: codecov/codecov-action@v4
if: always()
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v2
if: always()
with:
files: "**/test-*.xml"
docs:
defaults:
run:
shell: bash -el {0}
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Cache conda
uses: actions/cache@v4
env:
# Increase this value to reset cache if ci/environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key:
docs-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment.yml') }}
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: sparse-dev
allow-softlinks: true
environment-file: ci/environment.yml
python-version: '3.10'
miniforge-version: latest
- name: Install package
run: |
pip install -e .[docs]
- name: Run tests
run: |
sphinx-build -W -b html docs/ _build/html
- uses: actions/upload-artifact@v4
with:
name: Documentation
path: _build/html
benchmarks:
defaults:
run:
shell: bash -el {0}
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Cache conda
uses: actions/cache@v4
env:
# Increase this value to reset cache if ci/environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key:
benchmarks-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment.yml') }}
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: sparse-dev
allow-softlinks: true
environment-file: ci/environment.yml
python-version: '3.10'
miniforge-version: latest
- name: Install asv
run: |
pip install asv
asv machine --yes
- name: Run benchmarks
run: |
asv run --quick
examples:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.11'
- name: Build and install Sparse
run: |
python -m pip install '.[finch]' scipy
- name: Run examples
run: |
source ci/test_examples.sh
array_api_tests:
strategy:
matrix:
backend: ['Numba', 'Finch']
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Checkout array-api-tests
uses: actions/checkout@v4
with:
repository: data-apis/array-api-tests
ref: 'd295a0a66cd82a43e84c1b8d73ca198cc45e9d23' # Latest commit as of 2024-06-10
submodules: 'true'
path: 'array-api-tests'
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.11'
- name: Install build and test dependencies from PyPI
run: |
python -m pip install pytest-xdist -r array-api-tests/requirements.txt
- name: Build and install Sparse
run: |
python -m pip install '.[finch]'
- name: Run the test suite
env:
ARRAY_API_TESTS_MODULE: sparse
SPARSE_BACKEND: ${{ matrix.backend }}
run: |
cd ${GITHUB_WORKSPACE}/array-api-tests
pytest array_api_tests -v -c pytest.ini -n 4 --max-examples=2 --derandomize --disable-deadline -o xfail_strict=True --xfails-file ${GITHUB_WORKSPACE}/ci/${{ matrix.backend }}-array-api-xfails.txt --skips-file ${GITHUB_WORKSPACE}/ci/${{ matrix.backend }}-array-api-skips.txt
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
- vnext
pull_request:
branches:
- main
- vnext
# Also trigger on page_build, as well as release created events
page_build:
release:
types: # This configuration does not affect the page_build event above
- created