Repository navigation
87 lines (75 loc) · 3.85 KB
/
Copy pathtesting.yml
File metadata and controls
87 lines (75 loc) · 3.85 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
name: Dev tests
on:
workflow_call:
env:
TSHARK_PATH: ""
NWB_BENCHMARKS_NETWORK_INTERFACE: ""
jobs:
run:
# Will read on PR dashboard as 'Deploy / DevTests / ubuntu'
# Action dashboard identified by 'Dev tests'
# Requirement settings identified as 'DevTests / ubuntu'
name: ubuntu
runs-on: ubuntu-latest
strategy:
fail-fast: false
defaults:
run:
shell: bash -el {0}
steps:
- name: Clone repository
run: |
git clone https://github.com/neurodatawithoutborders/nwb_benchmarks.git
cd nwb_benchmarks
BRANCH="${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}"
git checkout $BRANCH
- name: Install conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: nwb_benchmarks
auto-activate-base: false
# `$CONDA` is set by the runner image, but `${{ env.* }}` expressions only see variables written to GITHUB_ENV
- name: Collect the conda environment cache key inputs
id: cache-inputs
run: |
echo "week=$(date -u '+%G-W%V')" >> "$GITHUB_OUTPUT"
echo "CONDA=$CONDA" >> "$GITHUB_ENV"
# Reuse the environment built by an earlier run with the same dependency files. The pip dependencies are
# unpinned, so the key also includes the ISO week to pick up new upstream releases at least weekly.
- name: Restore cached conda environment
id: env-cache
uses: actions/cache@v4
with:
path: ${{ env.CONDA }}/envs/nwb_benchmarks
key: conda-env-${{ runner.os }}-${{ runner.arch }}-${{ steps.cache-inputs.outputs.week }}-${{ hashFiles('nwb_benchmarks/environments/nwb_benchmarks.yaml', 'nwb_benchmarks/pyproject.toml') }}
- name: Install special conda environment
if: steps.env-cache.outputs.cache-hit != 'true'
run: conda env update --name nwb_benchmarks --file nwb_benchmarks/environments/nwb_benchmarks.yaml
- name: Display installed packages and their sources for debugging
run: |
conda info
conda list
# `params.py` hardcodes the DANDI API download URLs so that importing the benchmark suite does not look every asset
# up. Check they still match what the API resolves to, so a replaced asset shows up here instead of in a benchmark.
- name: Check the hardcoded DANDI URLs are current
working-directory: nwb_benchmarks
run: python -m nwb_benchmarks.scripts.check_dandi_urls
# `--group` installs a dependency group from `pyproject.toml` and needs pip 25.1 or newer.
- name: Run unit tests
working-directory: nwb_benchmarks
run: |
python -m pip install --upgrade "pip>=25.1"
python -m pip install --group test
python -m pytest tests
# This run is a smoke test of the benchmark machinery, not a measurement, so each benchmark is restricted to a
# single parameter set. ASV matches the `--bench` pattern against `module.Class.method({parameters})`, which
# lets the pattern pick one parametrization. Every parameter set opens the full remote NWB file in `setup`,
# and the ophys file is by far the fastest of the three test files to open. Both benchmarks are selected in
# one run, with `|` joining the two patterns, because ASV discovers and imports the suite once per run; the
# benchmarks themselves still execute one after another.
- name: Run basic file read and slicing tests
working-directory: nwb_benchmarks
run: |
READ="time_remote_file_reading.HDF5PyNWBRemfilePreloadedNoCacheFileReadBenchmark.time_read_hdf5_pynwb_remfile_preloaded_no_cache\(\{'name': 'OphysTestCase'"
SLICE="time_remote_slicing.HDF5PyNWBRemfilePreloadedNoCacheContinuousSliceBenchmark.time_slice\(\{'name': 'OphysTestCase1'"
nwb_benchmarks run --bench "$READ|$SLICE" --debug