|
| 1 | +name: Ncpi Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, master, ncpi-tests ] |
| 6 | + pull_request: |
| 7 | + branches: [ main, master, ncpi-tests ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + |
| 15 | + - name: Cache downloaded file |
| 16 | + uses: actions/cache@v4 |
| 17 | + id: file-cache |
| 18 | + with: |
| 19 | + path: | |
| 20 | + tests/data/zenodo_test_files_LFP/zenodo_sim_files |
| 21 | + tests/data/zenodo_test_files_LFP/zenodo_emp_files |
| 22 | + key: ${{ runner.os }}-file-${{ hashFiles('requirements.txt') }}-v1 |
| 23 | + |
| 24 | + - name: Create directory for tests data (empty in repo) |
| 25 | + if: steps.file-cache.outputs.cache-hit != 'true' |
| 26 | + run: | |
| 27 | + mkdir -p tests/data/zenodo_test_files_LFP |
| 28 | +
|
| 29 | + - name: Download files (if they are not cached) |
| 30 | + if: steps.file-cache.outputs.cache-hit != 'true' |
| 31 | + run: | |
| 32 | + # Download partial zenodo simulation test data (~196 MB) and extract files |
| 33 | + wget -O tests/data/zenodo_test_files_LFP/zenodo_sim_test_files_LFP.7z https://zenodo.org/records/17427470/files/zenodo_sim_test_files_LFP.7z |
| 34 | + 7z x tests/data/zenodo_test_files_LFP/zenodo_sim_test_files_LFP.7z -otests/data/zenodo_test_files_LFP/ |
| 35 | + rm tests/data/zenodo_test_files_LFP/zenodo_sim_test_files_LFP.7z # Free space immediately |
| 36 | +
|
| 37 | + # Download partial zenodo empirical test data (~490 MB) and extract files |
| 38 | + wget -O tests/data/zenodo_test_files_LFP/zenodo_emp_test_files_LFP.7z https://zenodo.org/records/17427470/files/zenodo_emp_test_files_LFP.7z |
| 39 | + 7z x tests/data/zenodo_test_files_LFP/zenodo_emp_test_files_LFP.7z -otests/data/zenodo_test_files_LFP/ |
| 40 | + rm tests/data/zenodo_test_files_LFP/zenodo_emp_test_files_LFP.7z # Free space immediately |
| 41 | + |
| 42 | + |
| 43 | + - name: List test data files |
| 44 | + run: | |
| 45 | + ls -lhat tests/data/zenodo_test_files_LFP |
| 46 | + echo "Data size:" |
| 47 | + du -sh tests/data/zenodo_test_files_LFP # Check size |
| 48 | + |
| 49 | + - name: Install dependencies |
| 50 | + run: | |
| 51 | + python -m pip install --upgrade pip setuptools |
| 52 | + pip install pytest |
| 53 | + pip install -r requirements.txt |
| 54 | + pip install . # overwrites ncpi python package. It installs the current version of this repository |
| 55 | + |
| 56 | + - name: Run tests with pytest |
| 57 | + run: | |
| 58 | + pytest -v |
0 commit comments