-
Notifications
You must be signed in to change notification settings - Fork 36
178 lines (175 loc) · 5.62 KB
/
testing.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
name: Tests
on:
push:
branches:
- master
tags:
- v[0-9].*
pull_request:
branches:
- master
defaults:
run:
# The default shell must be set like this so that bash will source the
# profile, which contains settings initialized by Conda:
# https://github.com/marketplace/actions/setup-miniconda#important
shell: bash -el {0}
jobs:
pre-commit:
runs-on: ubuntu-latest
env:
# Skipped for now since we just added pre-commit and not all of our code
# perfectly passes pylint.
SKIP: pylint
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.11"
- name: Install all deps and pylint (to be available to pre-commit)
run: pip install .[all] pylint
- uses: pre-commit/[email protected]
# The visualize extra is only tested with pinned reqs because different
# Matplotlib versions have slightly different outputs.
test:
strategy:
max-parallel: 12 # All in parallel.
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.11"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install core deps
run: pip install .[dev]
- name: Test core
run: >
pytest tests/archives tests/emitters tests/schedulers
pin:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.8"
- name: Install core deps
run: pip install -r pinned_reqs/install.txt .[dev]
- name: Test core
run: >
pytest tests/archives tests/emitters tests/schedulers
- name: Install extras deps
run: pip install -r pinned_reqs/extras_visualize.txt
- name: Test visualize extra
run: pytest tests/visualize
- name: Install QDax
run: pip install qdax
- name: Test visualize extra for QDax
run: pytest tests/visualize_qdax
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.8"
- name: Install deps
run: pip install .[visualize,dev]
- name: Test coverage
env:
NUMBA_DISABLE_JIT: 1
# Exclude `visualize_qdax` since we don't install QDax here. We also
# exclude `tests` since we don't want the base directory here.
run:
pytest $(find tests -maxdepth 1 -type d -not -name 'tests' -not -name
'visualize_qdax')
benchmarks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.8"
- name: Install deps
run: pip install .[visualize,dev]
- name: Run benchmarks
run: pytest -c pytest_benchmark.ini tests
examples:
runs-on: ubuntu-latest
steps:
# SWIG should not be installed so that we can test that lunar lander is
# installing SWIG properly. See https://github.com/icaros-usc/pyribs/pull/366
- name: Remove swig
run: sudo apt-get remove swig
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.8
- name: Install deps
run: pip install .[visualize]
- name: Test Examples
run: bash tests/examples.sh
tutorials_list:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: |
TUTORIALS=($(ls tutorials/*.ipynb tutorials/*/*.ipynb))
JSON_LIST=""
for x in "${TUTORIALS[@]}"; do JSON_LIST="$JSON_LIST\"$x\","; done
JSON_LIST=${JSON_LIST%","} # Remove extra comma.
echo "matrix={\"tutorial\": [$JSON_LIST]}" >> $GITHUB_OUTPUT
tutorials:
runs-on: ubuntu-latest
needs: tutorials_list
strategy:
matrix: ${{ fromJSON(needs.tutorials_list.outputs.matrix) }}
steps:
# SWIG should not be installed so that we can test that lunar lander is
# installing SWIG properly. See https://github.com/icaros-usc/pyribs/pull/366
- name: Remove swig
run: sudo apt-get remove swig
# We use Python 3.10 instead of 3.8 here since Google Colab uses 3.10.
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.10"
- name: Install deps
run: pip install .[visualize] jupyter nbconvert
- name: Test Tutorials
run: bash tests/tutorials.sh ${{ matrix.tutorial }}
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.8"
- name: Install deps
run: pip install .[visualize,dev]
- name: Build docs
run: make docs
deploy:
runs-on: ubuntu-latest
needs: [pre-commit, test, pin, coverage, benchmarks, examples, tutorials]
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.8"
- name: Install dependencies
run: |
pip install -e .
pip install -e .[dev]
- name: Publish
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
make release