forked from NeuralEnsemble/python-neo
-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (117 loc) · 4.88 KB
/
Copy pathio-test.yml
File metadata and controls
136 lines (117 loc) · 4.88 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
name: NeoIoTest
on:
workflow_call:
inputs:
os:
required: true
type: string
concurrency: # Cancel previous workflows on the same pull request
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-test:
name: Test on (${{ inputs.os }}) (${{ matrix.python-version}}) (${{ matrix.numpy-version }})
runs-on: ${{ inputs.os }}
strategy:
fail-fast: true
matrix:
python-version: ['3.10', '3.14']
numpy-version: ['1.26', '2.3.3']
exclude:
- python-version: '3.10'
numpy-version: '2.3.3'
- python-version: '3.14'
numpy-version: '1.26'
defaults:
# by default run in bash mode (required for conda usage)
run:
shell: bash -l {0}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get current year-month
id: date
run: echo "date=$(date +'%Y-%m')" >> $GITHUB_OUTPUT
- name: Get ephy_testing_data current head hash
# the key depend on the last commit repo https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git
id: ephy_testing_data
run: |
echo "dataset_hash=$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)" >> $GITHUB_OUTPUT
- uses: actions/cache/restore@v4
# Loading cache of ephys_testing_dataset
id: cache-datasets
with:
path: ~/ephy_testing_data
key: ${{ runner.os }}-datasets-${{ steps.ephy_testing_data.outputs.dataset_hash }}
restore-keys: ${{ runner.os }}-datasets-
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: neo-test-env-${{ matrix.python-version }}
python-version: "${{ matrix.python-version }}"
# TEST NOT USING CACHE
#- name: Get current dependencies hash
# id: dependencies
# run: |
# echo "hash=${{hashFiles('**/pyproject.toml', '**/environment_testing.yml')}}" >> $GITHUB_OUTPUT
#- uses: actions/cache/restore@v3
# the cache for python package is reset:
# * every month
# * when package dependencies change
# id: cache-conda-env
# with:
# path: /usr/share/miniconda/envs/neo-test-env-${{ matrix.python-version }}
# key: ${{ runner.os }}-conda-env-${{ steps.dependencies.outputs.hash }}-${{ steps.date.outputs.date }}
# restore-keys match any key that starts with the restore-key
# restore-keys: |
# ${{ runner.os }}-conda-env-${{ steps.dependencies.outputs.hash }}-
# ${{ runner.os }}-conda-env-
- name: Install testing dependencies
# testing environment is only created from yml if no cache was found
# restore-key hits should result in `cache-hit` == 'false'
#if: steps.cache-conda-env.outputs.cache-hit != 'true'
run: |
conda install pip numpy=${{ matrix.numpy-version }} -c conda-forge
# this command is for updating cache. We are resting removal.
# conda env update --name neo-test-env-${{ matrix.python-version }} --file environment_testing.yml --prune
- name: Install git-annex
# this is the trick from the spikeinterface repo for getting git-annex to work with datalad
# see https://github.com/SpikeInterface/spikeinterface/pull/3877 for more info
shell: bash
run: |
pip install datalad-installer
datalad-installer --sudo ok git-annex --method datalad/packages
git config --global filter.annex.process "git-annex filter-process" # recommended for efficiency
- name: Configure git
run: |
git config --global user.email "neo_ci@fake_mail.com"
git config --global user.name "neo CI"
- name: Python version
run: |
which python
python --version
- name: Install neo including dependencies
# installation with dependencies is only required if no cache was found
# restore-key hits should result in `cache-hit` == 'false'
# if: steps.cache-conda-env.outputs.cache-hit != 'true'
run: |
pip install --upgrade -e .
pip install .[test]
# TEST NOT USING CACHE
#- name: Install neo without dependencies
# only installing neo version to test as dependencies should be in cached conda env already
# if: steps.cache-conda-env.outputs.cache-hit == 'true'
# run: |
# pip install --no-dependencies -e .
- name: Pip list
run: |
pip list
- name: Conda list
run: |
conda list
- name: Test with pytest
env:
HDF5_PLUGIN_PATH: ${{ github.workspace }}/hdf5_local_plugin_path
run: |
# only neo.rawio and neo.io
pytest --cov=neo neo/test/rawiotest
pytest --cov=neo neo/test/iotest