forked from ActivitySim/activitysim
-
Notifications
You must be signed in to change notification settings - Fork 2
494 lines (423 loc) · 15.2 KB
/
core_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
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
name: Core Testing
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
env:
CACHE_NUMBER: 2 # increase to reset cache manually
jobs:
foundation:
strategy:
matrix:
python-version: ["3.10"]
defaults:
run:
shell: bash -l {0}
name: linux-64-py${{ matrix.python-version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: asim-test
use-mamba: true
python-version: ${{ matrix.python-version }}
- name: Set cache date for year and month
run: echo "DATE=$(date +'%Y%m')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
path: /usr/share/miniconda3/envs/asim-test
key: linux-64-conda-${{ hashFiles('conda-environments/github-actions-tests.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
id: cache
- name: Update environment
run: |
mamba env update -n asim-test -f conda-environments/github-actions-tests.yml
if: steps.cache.outputs.cache-hit != 'true'
- name: Install activitysim
# installing without dependencies is faster, we trust that all needed dependencies
# are in the conda environment defined above. Also, this avoids pip getting
# confused and reinstalling tables (pytables).
run: |
python -m pip install -e . --no-deps
- name: Conda checkup
run: |
mamba info -a
mamba list
- name: Lint with Black
run: |
# stop the build if there are problems
black --check --diff .
- name: Test activitysim.core
run: |
python -m pytest --pyargs activitysim.core
- name: Test activitysim.abm.models
run: |
python -m pytest --pyargs activitysim.abm.models
- name: Test activitysim.abm.test
run: |
python -m pytest --pyargs activitysim.abm.test
- name: Test activitysim.cli
run: |
python -m pytest --pyargs activitysim.cli
- name: Test activitysim.examples.test
run: |
python -m pytest --pyargs activitysim.examples.test
cross-platform:
# also test foundation cross platforms, but do not require a successful
# completion before starting regional model tests
needs: foundation
strategy:
matrix:
include:
- os: macos-latest
label: macOS
python-version: "3.10"
- os: windows-latest
label: win-64
python-version: "3.10"
defaults:
run:
shell: bash -l {0}
name: ${{ matrix.label }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: asim-test
use-mamba: true
python-version: ${{ matrix.python-version }}
- name: Set cache date for year and month
run: echo "DATE=$(date +'%Y%m')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
path: ${{ env.CONDA }}/envs
key: ${{ matrix.label }}-conda-${{ hashFiles('conda-environments/github-actions-tests.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
id: cache
- name: Update environment
run: |
mamba env update -n asim-test -f conda-environments/github-actions-tests.yml
if: steps.cache.outputs.cache-hit != 'true'
- name: Install activitysim
# installing without dependencies is faster, we trust that all needed dependencies
# are in the conda environment defined above. Also, this avoids pip getting
# confused and reinstalling tables (pytables).
run: |
python -m pip install -e . --no-deps
- name: Conda checkup
run: |
mamba info -a
mamba list
- name: Lint with Black
run: |
# stop the build if there are problems
black --check --diff .
- name: Test activitysim.core
run: |
python -m pytest --pyargs activitysim.core
- name: Test activitysim.abm.models
run: |
python -m pytest --pyargs activitysim.abm.models
- name: Test activitysim.abm.test
run: |
python -m pytest --pyargs activitysim.abm.test
- name: Test activitysim.cli
run: |
python -m pytest --pyargs activitysim.cli
builtin_regional_models:
needs: foundation
env:
python-version: "3.10"
label: linux-64
strategy:
matrix:
region:
- prototype_mtc
- placeholder_psrc
- prototype_marin
- prototype_mtc_extended
- placeholder_sandag
- prototype_sandag_xborder
- production_semcog
- prototype_mwcog
- placeholder_multiple_zone
fail-fast: false
defaults:
run:
shell: bash -l {0}
name: ${{ matrix.region }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: asim-test
use-mamba: true
python-version: ${{ env.python-version }}
- name: Set cache date for year and month
run: echo "DATE=$(date +'%Y%m')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
path: ${{ env.CONDA }}/envs
key: ${{ env.label }}-conda-${{ hashFiles('conda-environments/github-actions-tests.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
id: cache
- name: Update environment
run: |
mamba env update -n asim-test -f conda-environments/github-actions-tests.yml
if: steps.cache.outputs.cache-hit != 'true'
- name: Install activitysim
# installing without dependencies is faster, we trust that all needed dependencies
# are in the conda environment defined above. Also, this avoids pip getting
# confused and reinstalling tables (pytables).
run: |
python -m pip install -e . --no-deps
- name: Conda checkup
run: |
mamba info -a
mamba list
# TODO: Cache sharrow compiled flows? The contents of __pycache__ appear to
# be ignored, so this is not working as expected right now
#
# - name: Define Inputs
# run: echo "REGION_DEFS=activitysim/examples/${{ matrix.region }}/** " >> $GITHUB_ENV
#
# - name: Get a random number
# run: echo "RANDOM_SUFFIX=${RANDOM}${RANDOM}" >> $GITHUB_ENV
#
# - uses: actions/cache@v3
# # store the regional model's cache directory in github actions cache
# # this will (almost) never hit on primary key due to the random number
# # but will pull the most recent cache from restore-keys... and then
# # update the cache with additional compiled flows as needed.
# # Hoping this will result in fewer re-compiles on tests and faster
# # testing overall
# with:
# path: activitysim/examples/${{ matrix.region }}/test/output/cache
# key: ${{ matrix.region }}-${{ env.label }}-${{ hashFiles(env.REGION_DEFS) }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}-${{ env.RANDOM_SUFFIX }}
# restore-keys: |
# ${{ matrix.region }}-${{ env.label }}-${{ hashFiles(env.REGION_DEFS) }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
# id: cache-example
- name: Test ${{ matrix.region }}
run: |
python -m pytest activitysim/examples/${{ matrix.region }}/test --durations=0
external_regional_models:
needs: foundation
env:
python-version: "3.10"
label: linux-64
strategy:
matrix:
include:
- region: Standard 1-Zone Example (MTC)
region-org: ActivitySim
region-repo: activitysim-prototype-mtc
region-branch: extended
- region: Standard 2-Zone Example (SANDAG)
region-org: ActivitySim
region-repo: sandag-abm3-example
region-branch: main
fail-fast: false
defaults:
run:
shell: bash -l {0}
name: ${{ matrix.region }}
runs-on: ubuntu-latest
steps:
- name: Checkout ActivitySim
uses: actions/checkout@v4
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: asim-test
use-mamba: true
python-version: ${{ env.python-version }}
- name: Set cache date for year and month
run: echo "DATE=$(date +'%Y%m')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
path: |
${{ env.CONDA }}/envs
~/.cache/ActivitySim
key: ${{ env.label }}-conda-${{ hashFiles('conda-environments/github-actions-tests.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
id: cache
- name: Update environment
run: |
mamba env update -n asim-test -f conda-environments/github-actions-tests.yml
if: steps.cache.outputs.cache-hit != 'true'
- name: Install activitysim
# installing without dependencies is faster, we trust that all needed dependencies
# are in the conda environment defined above. Also, this avoids pip getting
# confused and reinstalling tables (pytables).
run: |
python -m pip install . --no-deps
- name: Conda checkup
run: |
mamba info -a
mamba list
- name: Checkout Example
uses: actions/checkout@v4
with:
repository: '${{ matrix.region-org }}/${{ matrix.region-repo }}'
ref: '${{ matrix.region-branch }}'
path: '${{ matrix.region-repo }}'
- name: Test ${{ matrix.region }}
run: |
cd ${{ matrix.region-repo }}/test
python -m pytest .
random_seed_generation:
needs: foundation
env:
python-version: "3.10"
label: linux-64
defaults:
run:
shell: bash -l {0}
name: random_seed_generation_test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: asim-test
use-mamba: true
python-version: ${{ env.python-version }}
- name: Set cache date for year and month
run: echo "DATE=$(date +'%Y%m')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
path: ${{ env.CONDA }}/envs
key: ${{ env.label }}-conda-${{ hashFiles('conda-environments/github-actions-tests.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
id: cache
- name: Update environment
run: |
mamba env update -n asim-test -f conda-environments/github-actions-tests.yml
if: steps.cache.outputs.cache-hit != 'true'
- name: Install activitysim
# installing without dependencies is faster, we trust that all needed dependencies
# are in the conda environment defined above. Also, this avoids pip getting
# confused and reinstalling tables (pytables).
run: |
python -m pip install -e . --no-deps
- name: Conda checkup
run: |
mamba info -a
mamba list
- name: Test Random Seed Generation
run: |
python -m pytest test/random_seed/test_random_seed.py --durations=0
estimation_mode:
needs: foundation
env:
python-version: "3.10"
label: linux-64
defaults:
run:
shell: bash -l {0}
name: estimation_mode_test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: asim-test
use-mamba: true
python-version: ${{ env.python-version }}
- name: Set cache date for year and month
run: echo "DATE=$(date +'%Y%m')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
path: ${{ env.CONDA }}/envs
key: ${{ env.label }}-conda-${{ hashFiles('conda-environments/github-actions-tests.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
id: cache
- name: Update environment
run: |
mamba env update -n asim-test -f conda-environments/github-actions-tests.yml
if: steps.cache.outputs.cache-hit != 'true'
- name: Install Larch
run: mamba install "larch>=5.7.1"
- name: Install activitysim
# installing without dependencies is faster, we trust that all needed dependencies
# are in the conda environment defined above. Also, this avoids pip getting
# confused and reinstalling tables (pytables).
run: |
python -m pip install -e . --no-deps
- name: Conda checkup
run: |
mamba info -a
mamba list
- name: Test Estimation Mode
run: |
python -m pytest activitysim/estimation/test/test_larch_estimation.py --durations=0
develop-docbuild:
needs: foundation
if: github.ref_name == 'main'
name: develop-docbuild
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # get all tags, lets setuptools_scm do its thing
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
environment-file: conda-environments/docbuild.yml
python-version: "3.10"
activate-environment: docbuild
auto-activate-base: false
auto-update-conda: false
- name: Install activitysim
run: |
python -m pip install .
- name: Conda checkup
run: |
conda info -a
conda list
echo ${{ github.repository }}
echo ${{ github.ref_name }}
- name: localize version switcher
run: |
python .github/workflows/localize-base-urls.py docs/_static/switcher.json
git update-index --assume-unchanged docs/_static/switcher.json
cat docs/_static/switcher.json
- name: Build the docs
run: |
cd docs
make clean
make html
- name: Push to GitHub Pages
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Token is created automatically by Github Actions, no other config needed
publish_dir: ./docs/_build/html
destination_dir: develop