|
| 1 | +name: NeoPlexon2Test |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + schedule: |
| 6 | + - cron: "0 12 * * 0" # weekly at noon UTC on Sundays |
| 7 | + |
| 8 | + |
| 9 | +jobs: |
| 10 | + build-and-test: |
| 11 | + name: Test on (${{ inputs.os }}) (${{ matrix.python-version}}) (${{ matrix.numpy-version }}) |
| 12 | + runs-on: ${{ inputs.os }} |
| 13 | + strategy: |
| 14 | + fail-fast: true |
| 15 | + matrix: |
| 16 | + python-version: ['3.9', '3.12'] |
| 17 | + numpy-version: ['1.26', '2.0'] |
| 18 | + defaults: |
| 19 | + # by default run in bash mode (required for conda usage) |
| 20 | + run: |
| 21 | + shell: bash -l {0} |
| 22 | + steps: |
| 23 | + |
| 24 | + - name: Checkout repository |
| 25 | + uses: actions/checkout@v4 |
| 26 | + |
| 27 | + - name: Get current year-month |
| 28 | + id: date |
| 29 | + run: echo "date=$(date +'%Y-%m')" >> $GITHUB_OUTPUT |
| 30 | + |
| 31 | + - name: Get ephy_testing_data current head hash |
| 32 | + # the key depend on the last commit repo https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git |
| 33 | + id: ephy_testing_data |
| 34 | + run: | |
| 35 | + echo "dataset_hash=$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)" >> $GITHUB_OUTPUT |
| 36 | +
|
| 37 | + - uses: actions/cache/restore@v4 |
| 38 | + # Loading cache of ephys_testing_dataset |
| 39 | + id: cache-datasets |
| 40 | + with: |
| 41 | + path: ~/ephy_testing_data |
| 42 | + key: ${{ runner.os }}-datasets-${{ steps.ephy_testing_data.outputs.dataset_hash }} |
| 43 | + restore-keys: ${{ runner.os }}-datasets- |
| 44 | + |
| 45 | + - uses: conda-incubator/setup-miniconda@v3 |
| 46 | + with: |
| 47 | + activate-environment: neo-test-env-${{ matrix.python-version }} |
| 48 | + python-version: "${{ matrix.python-version }}" |
| 49 | + |
| 50 | + - name: Install testing dependencies |
| 51 | + # testing environment is only created from yml if no cache was found |
| 52 | + # restore-key hits should result in `cache-hit` == 'false' |
| 53 | + #if: steps.cache-conda-env.outputs.cache-hit != 'true' |
| 54 | + run: | |
| 55 | + conda install pip numpy=${{ matrix.numpy-version }} -c conda-forge |
| 56 | + # this command is for updating cache. We are resting removal. |
| 57 | + # conda env update --name neo-test-env-${{ matrix.python-version }} --file environment_testing.yml --prune |
| 58 | + |
| 59 | + - name: Install git-annex |
| 60 | + # this is the trick from the spikeinterface repo for getting git-annex to work with datalad |
| 61 | + # see https://github.com/SpikeInterface/spikeinterface/pull/3877 for more info |
| 62 | + shell: bash |
| 63 | + run: | |
| 64 | + pip install datalad-installer |
| 65 | + datalad-installer --sudo ok git-annex --method datalad/packages |
| 66 | + git config --global filter.annex.process "git-annex filter-process" # recommended for efficiency |
| 67 | +
|
| 68 | + - name: Configure git |
| 69 | + run: | |
| 70 | + git config --global user.email "neo_ci@fake_mail.com" |
| 71 | + git config --global user.name "neo CI" |
| 72 | +
|
| 73 | + - name: Python version |
| 74 | + run: | |
| 75 | + which python |
| 76 | + python --version |
| 77 | +
|
| 78 | + - name: Install neo including dependencies |
| 79 | + # installation with dependencies is only required if no cache was found |
| 80 | + # restore-key hits should result in `cache-hit` == 'false' |
| 81 | + # if: steps.cache-conda-env.outputs.cache-hit != 'true' |
| 82 | + run: | |
| 83 | + pip install --upgrade -e . |
| 84 | + pip install .[test] |
| 85 | +
|
| 86 | +
|
| 87 | + - name: Install wine |
| 88 | + run: | |
| 89 | + sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list |
| 90 | + sudo dpkg --add-architecture i386 |
| 91 | + sudo apt-get update -qq |
| 92 | + sudo apt-get install -yqq --allow-downgrades libc6:i386 libgcc-s1:i386 libstdc++6:i386 wine |
| 93 | +
|
| 94 | + - name: Pip list |
| 95 | + run: | |
| 96 | + pip list |
| 97 | +
|
| 98 | + - name: Conda list |
| 99 | + run: | |
| 100 | + conda list |
| 101 | +
|
| 102 | + - name: Test with pytest |
| 103 | + env: |
| 104 | + HDF5_PLUGIN_PATH: ${{ github.workspace }}/hdf5_local_plugin_path |
| 105 | + PLEXON2_TEST: true |
| 106 | + run: | |
| 107 | + # only neo.rawio and neo.io |
| 108 | + pytest --cov=neo neo/test/rawiotest |
| 109 | + pytest --cov=neo neo/test/iotest |
0 commit comments