-
Notifications
You must be signed in to change notification settings - Fork 497
506 lines (449 loc) · 20.9 KB
/
Copy pathtest.yml
File metadata and controls
506 lines (449 loc) · 20.9 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
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
495
496
497
498
499
500
501
502
503
504
505
506
name: tests
on:
workflow_call:
workflow_dispatch:
merge_group:
push:
branches: [main]
workflow_run:
workflows:
- "contributor check"
types:
- completed
# The path to the sha of the commit we want to test will depend
# on the trigger type. If a workflow_run trigger, then we want
# the sha from the head of the branch that triggered it. For
# pushes and manual triggers, we want the sha of the branch.
env:
CI: true
HEAD_SHA: |
${{
github.event.workflow_run.head_sha ||
github.event.pull_request.head.sha ||
github.sha
}}
jobs:
test:
runs-on: 32-core-ubuntu
# Explicit `name:` overrides GitHub Actions' default check-run name.
# Without it, GitHub auto-expands EVERY field of the object-typed
# `shard` matrix entry — including `shard.paths` — into a
# >100-character truncated string like
# `test (3.14, core, tests/core/models tests/core/graph ...`.
# That diverges from the short custom status emitted by
# multi-trigger-setup, forcing branch protection to pick one event
# type's names and break the others.
#
# We use a literal job key (`test`) rather than `${{ github.job }}`
# because `github.job` is only populated inside the execution of
# `steps:` per the GitHub docs, and resolves to null at job-level
# `name:` evaluation time. The literal matches what `github.job`
# would have produced and matches the multi-trigger-setup template
# verbatim, so the auto-generated check-run name and the custom
# commit status now share a single string set across all event
# types (push, merge_group, workflow_run, workflow_dispatch).
name: 'test (${{ matrix.python_version }}, ${{ matrix.shard.name }})'
permissions:
contents: read
# Needed to manually set commit status
statuses: write
strategy:
max-parallel: 10
fail-fast: false
matrix:
python_version: ['3.11', '3.14']
# tests/perf is run by perf-test.yml on a separate cadence.
# tests/applications and tests/lammps are run by integration-test.yml
# and test_lammps_gpu respectively. Both shards below intentionally
# exclude those paths.
# YAML anchor: shard list is reused by test_cpu_sweep below.
# Do not reorder jobs (the alias must follow the anchor textually).
shard: &cpu_shards
- name: units
paths: tests/core/units
- name: core
paths: tests/core/models tests/core/graph tests/core/calculate tests/core/components tests/core/common tests/core/datasets tests/core/evaluator tests/core/modules tests/core/scripts tests/core/launchers tests/core/test_cli.py tests/core/test_download_large_files.py tests/data tests/demo
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
ref: ${{ env.HEAD_SHA }}
# Required since actions/checkout began refusing fork PR code in
# workflow_run jobs. Safe here: fork PRs from all external
# contributors require maintainer approval before this trusted,
# secret-holding run can execute (repo Actions setting).
# See https://gh.io/securely-using-pull_request_target
allow-unsafe-pr-checkout: true
# Optional: get full history if needed
fetch-depth: 0
- name: Setup
uses: ./.github/actions/multi-trigger-setup
with:
status-context: '${{ github.job }} (${{ matrix.python_version }}, ${{ matrix.shard.name }})'
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Cache pip
uses: actions/cache@v6
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install core dependencies and package
run: |
python -m pip install --upgrade pip
pip install \
packages/fairchem-core[dev,extras] \
packages/fairchem-data-oc[dev] \
packages/fairchem-data-omat \
packages/fairchem-data-omol[dev] \
packages/fairchem-demo-ocpapi[dev] \
-r tests/requirements.txt # pin test packages
- name: Install torchsim (Python 3.12+)
if: ${{ matrix.python_version == '3.12' || matrix.python_version == '3.13' || matrix.python_version == '3.14' }}
run: |
pip install packages/fairchem-core[torchsim]
- name: Install additional dependencies
if: matrix.shard.name == 'core'
run: |
wget https://github.com/m3g/packmol/archive/refs/tags/v20.15.0.tar.gz
tar -xzvf v20.15.0.tar.gz
cd packmol-20.15.0
./configure
make
echo "$(readlink -f .)" >> $GITHUB_PATH
- name: Download large test files
if: matrix.shard.name == 'core'
run: coverage run -m fairchem.core.scripts.download_large_files oc
- name: Core tests (${{ matrix.shard.name }})
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
# --exclude-models deselects tests locked to sweep models and
# removes sweep models from all-models parametrization. The
# sweep jobs (test_cpu_sweep) handle those models.
run: |
NCCL_DEBUG=INFO pytest -n auto -m "not subprocess and not serial and not gpu" ${{ matrix.shard.paths }} --durations=0 -vv --ignore=tests/demo/ocpapi/tests/integration/ --exclude-models=uma-s-1p1,uma-s-1p2 --cov-report=xml --cov=fairchem --cov-append --junitxml=junit-${{ matrix.shard.name }}.xml -o junit_family=legacy -c ./packages/fairchem-core/pyproject.toml --suppress-no-test-exit-code
- name: Serial CPU tests (${{ matrix.shard.name }})
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
pytest -m "serial and not gpu" ${{ matrix.shard.paths }} -vv --ignore=tests/demo/ocpapi/tests/integration/ --exclude-models=uma-s-1p1,uma-s-1p2 --cov-report=xml --cov=fairchem --cov-append --junitxml=junit-serial-${{ matrix.shard.name }}.xml -o junit_family=legacy -c ./packages/fairchem-core/pyproject.toml --suppress-no-test-exit-code
- if: ${{ matrix.python_version == '3.14' }}
name: codecov-coverage
uses: codecov/codecov-action@v7
with:
fail_ci_if_error: false
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- if: ${{ matrix.python_version == '3.14' }}
name: codecov-test-results
uses: codecov/test-results-action@v1
with:
files: ./junit-${{ matrix.shard.name }}.xml,./junit-serial-${{ matrix.shard.name }}.xml
token: ${{ secrets.CODECOV_TOKEN }}
commit_parent: ${{ env.HEAD_SHA }}
verbose: true
- name: Cleanup
if: always()
uses: ./.github/actions/multi-trigger-cleanup
with:
status-context: '${{ github.job }} (${{ matrix.python_version }}, ${{ matrix.shard.name }})'
test_cpu_sweep:
runs-on: 32-core-ubuntu
# See `test` job above for the `name:` rationale (literal job key,
# not `${{ github.job }}`, to avoid the null-at-job-level pitfall).
name: 'test_cpu_sweep (${{ matrix.python_version }}, ${{ matrix.shard.name }}, ${{ matrix.sweep_model }})'
permissions:
contents: read
statuses: write
strategy:
fail-fast: false
matrix:
python_version: ['3.14']
sweep_model: [uma-s-1p1, uma-s-1p2]
shard: *cpu_shards
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
ref: ${{ env.HEAD_SHA }}
# See the checkout step in the `test` job for why this is set
# and why it is safe (external-contributor approval gate).
allow-unsafe-pr-checkout: true
fetch-depth: 0
- name: Setup
uses: ./.github/actions/multi-trigger-setup
with:
status-context: '${{ github.job }} (${{ matrix.python_version }}, ${{ matrix.shard.name }}, ${{ matrix.sweep_model }})'
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Cache pip
uses: actions/cache@v6
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install core dependencies and package
run: |
python -m pip install --upgrade pip
pip install \
packages/fairchem-core[dev,extras] \
packages/fairchem-data-oc[dev] \
packages/fairchem-data-omat \
packages/fairchem-data-omol[dev] \
packages/fairchem-demo-ocpapi[dev] \
-r tests/requirements.txt # pin test packages
- name: Install torchsim (Python 3.12+)
if: ${{ matrix.python_version == '3.12' || matrix.python_version == '3.13' || matrix.python_version == '3.14' }}
run: |
pip install packages/fairchem-core[torchsim]
- name: Install additional dependencies
if: matrix.shard.name == 'core'
run: |
wget https://github.com/m3g/packmol/archive/refs/tags/v20.15.0.tar.gz
tar -xzvf v20.15.0.tar.gz
cd packmol-20.15.0
./configure
make
echo "$(readlink -f .)" >> $GITHUB_PATH
- name: Download large test files
if: matrix.shard.name == 'core'
run: coverage run -m fairchem.core.scripts.download_large_files oc
- name: Sweep CPU tests (${{ matrix.shard.name }}, ${{ matrix.sweep_model }})
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
NCCL_DEBUG=INFO pytest -n auto -m "not subprocess and not serial and not gpu" ${{ matrix.shard.paths }} --durations=0 -vv --ignore=tests/demo/ocpapi/tests/integration/ --sweep-model=${{ matrix.sweep_model }} --junitxml=junit-sweep-${{ matrix.shard.name }}-${{ matrix.sweep_model }}.xml -o junit_family=legacy -c ./packages/fairchem-core/pyproject.toml --suppress-no-test-exit-code
- name: Sweep serial CPU tests (${{ matrix.shard.name }}, ${{ matrix.sweep_model }})
# The core shard has no serial @pretrained tests, so the sweep
# serial step would collect zero tests there (pytest exit 5).
# Skip the step on core; only run on units.
if: matrix.shard.name == 'units'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
pytest -m "serial and not gpu" ${{ matrix.shard.paths }} -vv --ignore=tests/demo/ocpapi/tests/integration/ --sweep-model=${{ matrix.sweep_model }} --junitxml=junit-sweep-serial-${{ matrix.shard.name }}-${{ matrix.sweep_model }}.xml -o junit_family=legacy -c ./packages/fairchem-core/pyproject.toml --suppress-no-test-exit-code
- name: codecov-test-results
if: always()
uses: codecov/test-results-action@v1
with:
files: ./junit-sweep-${{ matrix.shard.name }}-${{ matrix.sweep_model }}.xml,./junit-sweep-serial-${{ matrix.shard.name }}-${{ matrix.sweep_model }}.xml
token: ${{ secrets.CODECOV_TOKEN }}
commit_parent: ${{ env.HEAD_SHA }}
verbose: true
- name: Cleanup
if: always()
uses: ./.github/actions/multi-trigger-cleanup
with:
status-context: '${{ github.job }} (${{ matrix.python_version }}, ${{ matrix.shard.name }}, ${{ matrix.sweep_model }})'
test_gpu:
runs-on: 4-core-ubuntu-gpu-t4
# See `test` job above for the `name:` rationale.
name: 'test_gpu (${{ matrix.python_version }}, ${{ matrix.shard.name }})'
permissions:
contents: read
# Needed to manually set commit status
statuses: write
strategy:
fail-fast: false
matrix:
python_version: ['3.14']
# YAML anchor: shard list is reused by test_gpu_sweep below.
# Do not reorder jobs (the alias must follow the anchor textually).
shard: &gpu_shards
- name: models
paths: tests/core/models tests/core/graph tests/core/calculate tests/core/components tests/core/datasets tests/core/common tests/core/scripts
- name: units
paths: tests/core/units
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
ref: ${{ env.HEAD_SHA }}
# Required since actions/checkout began refusing fork PR code in
# workflow_run jobs. Safe here: fork PRs from all external
# contributors require maintainer approval before this trusted,
# secret-holding run can execute (repo Actions setting).
# See https://gh.io/securely-using-pull_request_target
allow-unsafe-pr-checkout: true
# Optional: get full history if needed
fetch-depth: 0
- name: Setup
uses: ./.github/actions/multi-trigger-setup
with:
status-context: '${{ github.job }} (${{ matrix.python_version }}, ${{ matrix.shard.name }})'
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Install core dependencies and package
run: |
python -m pip install --upgrade pip
pip install packages/fairchem-core[dev,extras] \
packages/fairchem-data-omol[dev] \
packages/fairchem-data-omat \
-r tests/requirements.txt # pin test packages
- name: Install torchsim (Python 3.12+)
if: ${{ matrix.python_version == '3.12' || matrix.python_version == '3.13' || matrix.python_version == '3.14' }}
run: |
pip install packages/fairchem-core[torchsim]
- name: Core GPU tests (${{ matrix.shard.name }})
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
# Note: These tests seem to fail if "-n auto" is added
# --exclude-models deselects tests locked to sweep models and
# removes sweep models from all-models parametrization. The
# sweep jobs (test_gpu_sweep) handle those models.
run: |
NCCL_DEBUG=INFO pytest ${{ matrix.shard.paths }} --durations=0 -vv -m "gpu and not compile_gpu" --exclude-models=uma-s-1p1,uma-s-1p2 -c ./packages/fairchem-core/pyproject.toml --junitxml=junit-gpu-${{ matrix.shard.name }}.xml --suppress-no-test-exit-code
- name: Core GPU compile tests (${{ matrix.shard.name }})
# compile_gpu tests exist in both models and units shards.
# Sweep-eligible compile_gpu tests (e.g. @pretrained-locked to
# UMA-S) run in test_gpu_sweep, not here.
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
NCCL_DEBUG=INFO pytest ${{ matrix.shard.paths }} --durations=0 -vv -m compile_gpu --exclude-models=uma-s-1p1,uma-s-1p2 -c ./packages/fairchem-core/pyproject.toml --junitxml=junit-gpu-compile-${{ matrix.shard.name }}.xml --suppress-no-test-exit-code
- name: codecov-test-results
if: always()
uses: codecov/test-results-action@v1
with:
files: ./junit-gpu-${{ matrix.shard.name }}.xml,./junit-gpu-compile-${{ matrix.shard.name }}.xml
token: ${{ secrets.CODECOV_TOKEN }}
commit_parent: ${{ env.HEAD_SHA }}
verbose: true
- name: Cleanup
if: always()
uses: ./.github/actions/multi-trigger-cleanup
with:
status-context: '${{ github.job }} (${{ matrix.python_version }}, ${{ matrix.shard.name }})'
test_gpu_sweep:
runs-on: 4-core-ubuntu-gpu-t4
# See `test` job above for the `name:` rationale.
name: 'test_gpu_sweep (${{ matrix.python_version }}, ${{ matrix.shard.name }}, ${{ matrix.sweep_model }})'
permissions:
contents: read
statuses: write
strategy:
fail-fast: false
matrix:
python_version: ['3.14']
sweep_model: [uma-s-1p1, uma-s-1p2]
shard: *gpu_shards
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
ref: ${{ env.HEAD_SHA }}
# See the checkout step in the `test` job for why this is set
# and why it is safe (external-contributor approval gate).
allow-unsafe-pr-checkout: true
fetch-depth: 0
- name: Setup
uses: ./.github/actions/multi-trigger-setup
with:
status-context: '${{ github.job }} (${{ matrix.python_version }}, ${{ matrix.shard.name }}, ${{ matrix.sweep_model }})'
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Install core dependencies and package
run: |
python -m pip install --upgrade pip
pip install packages/fairchem-core[dev,extras] \
packages/fairchem-data-omol[dev] \
packages/fairchem-data-omat \
-r tests/requirements.txt # pin test packages
- name: Install torchsim (Python 3.12+)
if: ${{ matrix.python_version == '3.12' || matrix.python_version == '3.13' || matrix.python_version == '3.14' }}
run: |
pip install packages/fairchem-core[torchsim]
- name: Sweep tests (${{ matrix.shard.name }}, ${{ matrix.sweep_model }})
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
NCCL_DEBUG=INFO pytest ${{ matrix.shard.paths }} --durations=0 -vv -m "gpu and not compile_gpu" --sweep-model=${{ matrix.sweep_model }} -c ./packages/fairchem-core/pyproject.toml --junitxml=junit-gpu-sweep-${{ matrix.shard.name }}-${{ matrix.sweep_model }}.xml --suppress-no-test-exit-code
- name: Sweep compile GPU tests (${{ matrix.shard.name }}, ${{ matrix.sweep_model }})
# Covers @compile_gpu + @pretrained-locked-to-UMA-S tests that
# the base test_gpu compile step excludes via --exclude-models.
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
NCCL_DEBUG=INFO pytest ${{ matrix.shard.paths }} --durations=0 -vv -m compile_gpu --sweep-model=${{ matrix.sweep_model }} -c ./packages/fairchem-core/pyproject.toml --junitxml=junit-gpu-sweep-compile-${{ matrix.shard.name }}-${{ matrix.sweep_model }}.xml --suppress-no-test-exit-code
- name: codecov-test-results
if: always()
uses: codecov/test-results-action@v1
with:
files: ./junit-gpu-sweep-${{ matrix.shard.name }}-${{ matrix.sweep_model }}.xml,./junit-gpu-sweep-compile-${{ matrix.shard.name }}-${{ matrix.sweep_model }}.xml
token: ${{ secrets.CODECOV_TOKEN }}
commit_parent: ${{ env.HEAD_SHA }}
verbose: true
- name: Cleanup
if: always()
uses: ./.github/actions/multi-trigger-cleanup
with:
status-context: '${{ github.job }} (${{ matrix.python_version }}, ${{ matrix.shard.name }}, ${{ matrix.sweep_model }})'
test_lammps_gpu:
runs-on: 4-core-ubuntu-gpu-t4
permissions:
contents: read
# Needed to manually set commit status
statuses: write
strategy:
max-parallel: 1
matrix:
python_version: ['3.14']
steps:
- uses: actions/checkout@v7
- uses: mamba-org/setup-micromamba@v3
with:
generate-run-shell: true # This is the default behavior
environment-name: test_env # Specifies a new environment to be created
create-args: python=3.14 # Specifies packages to install into the new environment
- name: Checkout code
uses: actions/checkout@v7
with:
ref: ${{ env.HEAD_SHA }}
# Required since actions/checkout began refusing fork PR code in
# workflow_run jobs. Safe here: fork PRs from all external
# contributors require maintainer approval before this trusted,
# secret-holding run can execute (repo Actions setting).
# See https://gh.io/securely-using-pull_request_target
allow-unsafe-pr-checkout: true
# Optional: get full history if needed
fetch-depth: 0
- name: Setup
uses: ./.github/actions/multi-trigger-setup
with:
status-context: '${{ github.job }} (${{ matrix.python_version }})'
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Install core dependencies and package
shell: micromamba-shell {0}
run: |
micromamba install lammps
python -m pip install --upgrade pip
pip install packages/fairchem-core[dev,extras] \
packages/fairchem-lammps \
-r tests/requirements.txt # pin test packages
- name: Core GPU tests
shell: micromamba-shell {0}
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
NCCL_DEBUG=INFO pytest tests/lammps --durations=0 -vv -m gpu
- name: Cleanup
if: always()
uses: ./.github/actions/multi-trigger-cleanup
with:
status-context: '${{ github.job }} (${{ matrix.python_version }})'