@@ -20,11 +20,11 @@ jobs:
2020 # "macos-latest", "windows-latest"
2121 os : ["ubuntu-latest", ]
2222 python-version : ['3.8', ]
23+ defaults :
24+ # by default run in bash mode (required for conda usage)
25+ run :
26+ shell : bash -l {0}
2327 steps :
24- - name : Set up Python ${{ matrix.python-version }}
25- uses : actions/setup-python@v2
26- with :
27- python-version : ${{ matrix.python-version }}
2828
2929 - name : Checkout repository
3030 uses : actions/checkout@v2
@@ -33,49 +33,51 @@ jobs:
3333 id : date
3434 run : echo "::set-output name=date::$(date +'%Y-%m')"
3535
36- - uses : actions/cache@v2
36+ - name : Get ephy_testing_data current head hash
37+ # the key depend on the last commit repo https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git
38+ id : vars
39+ run : |
40+ echo "::set-output name=HASH_EPHY_DATASET::$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)"
41+
42+ - uses : actions/cache@v3
43+ # Loading cache of ephys_testing_dataset
44+ id : cache-datasets
45+ with :
46+ path : ~/ephy_testing_data
47+ key : ${{ runner.os }}-datasets-${{ steps.vars.outputs.HASH_EPHY_DATASET }}
48+
49+ - uses : conda-incubator/setup-miniconda@v2
50+ with :
51+ activate-environment : neo-test-env
52+ python-version : ${{ matrix.python-version }}
53+ clean-patched-environment-file : false
54+
55+ - uses : actions/cache@v3
3756 # the cache for python package is reset:
3857 # * every month
3958 # * when requirements/requirements_testing change
40- id : cache-venv
59+ id : cache-conda-env
4160 with :
42- path : ~/test_env
43- key : ${{ runner.os }}-venv-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/requirements_testing.txt') }}-${{ steps.date.outputs.date }}
44- restore-keys : |
45- ${{ runner.os }}-venv-
61+ path : /usr/share/miniconda/envs/neo-test-env
62+ key : ${{ runner.os }}-conda-env-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/requirements_testing.txt') }}-${{ hashFiles('**/environment_testing.txt') }}-${{ steps.date.outputs.date }}
63+
64+ - name : Install testing dependencies
65+ # testing environment is only installed if no cache was found
66+ if : steps.cache-conda-env.outputs.cache-hit != 'true'
67+ run : |
68+ conda env update neo-test-env --file environment_testing.yml
4669
47- - name : Install dependencies
70+ - name : Configure git
4871 run : |
49- # this is for datalad and download testing datasets
50- sudo apt install git git-annex
51- # needed for correct operation of git/git-annex/DataLad
5272 git config --global user.email "neo_ci@fake_mail.com"
5373 git config --global user.name "neo CI"
54- # create an environment and install everything
55- python -m venv ~/test_env
56- source ~/test_env/bin/activate
57- python -m pip install --upgrade pip
58- # pip install -r requirements.txt
59- pip install -r requirements_testing.txt
60- pip install -e .
6174
62- - name : Get ephy_testing_data current head hash
63- # the key depend on the last comit repo https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git
64- id : vars
75+ - name : Install neo
6576 run : |
66- echo "::set-output name=HASH_EPHY_DATASET::$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)"
67-
68- - uses : actions/cache@v2
69- id : cache-datasets
70- with :
71- path : ~/ephy_testing_data
72- key : ${{ runner.os }}-datasets-${{ steps.vars.outputs.HASH_EPHY_DATASET }}
73- restore-keys : |
74- ${{ runner.os }}-datasets
77+ pip install --upgrade -e .
7578
7679 - name : Test with pytest
7780 run : |
78- source ~/test_env/bin/activate
7981 # only neo.rawio and neo.io
8082 pytest --cov=neo neo/test/rawiotest
8183 pytest --cov=neo neo/test/iotest
0 commit comments