|
| 1 | +name: Complete tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + schedule: |
| 6 | + - cron: "0 12 * * 0" # Weekly on Sunday at noon UTC |
| 7 | + pull_request: |
| 8 | + types: [synchronize, opened, reopened] |
| 9 | + branches: |
| 10 | + - main |
| 11 | + |
| 12 | +env: |
| 13 | + KACHERY_CLOUD_CLIENT_ID: ${{ secrets.KACHERY_CLOUD_CLIENT_ID }} |
| 14 | + KACHERY_CLOUD_PRIVATE_KEY: ${{ secrets.KACHERY_CLOUD_PRIVATE_KEY }} |
| 15 | + |
| 16 | +concurrency: # Cancel previous workflows on the same pull request |
| 17 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 18 | + cancel-in-progress: true |
| 19 | + |
| 20 | +jobs: |
| 21 | + run: |
| 22 | + name: ${{ matrix.os }} Python ${{ matrix.python-version }} |
| 23 | + runs-on: ${{ matrix.os }} |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + python-version: ["3.9", "3.12"] # Lower and higher versions we support |
| 28 | + os: [macos-13, windows-latest, ubuntu-latest] |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + - name: Setup Python ${{ matrix.python-version }} |
| 32 | + uses: actions/setup-python@v5 |
| 33 | + with: |
| 34 | + python-version: ${{ matrix.python-version }} |
| 35 | + |
| 36 | + - name: Get changed files |
| 37 | + id: changed-files |
| 38 | + uses: tj-actions/changed-files@v41 |
| 39 | + |
| 40 | + - name: List all changed files |
| 41 | + shell: bash |
| 42 | + env: |
| 43 | + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} |
| 44 | + run: | |
| 45 | + for file in ${ALL_CHANGED_FILES}; do |
| 46 | + echo "$file was changed" |
| 47 | + done |
| 48 | +
|
| 49 | + - name: Set testing environment # This decides which tests are run and whether to install especial dependencies |
| 50 | + shell: bash |
| 51 | + run: | |
| 52 | + changed_files="${{ steps.changed-files.outputs.all_changed_files }}" |
| 53 | + python .github/determine_testing_environment.py $changed_files |
| 54 | +
|
| 55 | + - name: Display testing environment |
| 56 | + shell: bash |
| 57 | + run: | |
| 58 | + echo "RUN_EXTRACTORS_TESTS=${RUN_EXTRACTORS_TESTS}" |
| 59 | + echo "RUN_PREPROCESSING_TESTS=${RUN_PREPROCESSING_TESTS}" |
| 60 | + echo "RUN_POSTPROCESSING_TESTS=${RUN_POSTPROCESSING_TESTS}" |
| 61 | + echo "RUN_QUALITYMETRICS_TESTS=${RUN_QUALITYMETRICS_TESTS}" |
| 62 | + echo "RUN_CURATION_TESTS=${RUN_CURATION_TESTS}" |
| 63 | + echo "RUN_SORTINGCOMPONENTS_TESTS=${RUN_SORTINGCOMPONENTS_TESTS}" |
| 64 | + echo "RUN_GENERATION_TESTS=${RUN_GENERATION_TESTS}" |
| 65 | + echo "RUN_COMPARISON_TESTS=${RUN_COMPARISON_TESTS}" |
| 66 | + echo "RUN_WIDGETS_TESTS=${RUN_WIDGETS_TESTS}" |
| 67 | + echo "RUN_EXPORTERS_TESTS=${RUN_EXPORTERS_TESTS}" |
| 68 | + echo "RUN_SORTERS_TESTS=${RUN_SORTERS_TESTS}" |
| 69 | + echo "RUN_INTERNAL_SORTERS_TESTS=${RUN_INTERNAL_SORTERS_TESTS}" |
| 70 | + echo "INSTALL_PLEXON_DEPENDENCIES=${INSTALL_PLEXON_DEPENDENCIES}" |
| 71 | +
|
| 72 | + - name: Install packages |
| 73 | + run: | |
| 74 | + pip install -e .[test_core] |
| 75 | + shell: bash |
| 76 | + |
| 77 | + - name: Test core |
| 78 | + run: pytest -m "core" |
| 79 | + shell: bash |
| 80 | + |
| 81 | + - name: Install Other Testing Dependencies |
| 82 | + run: | |
| 83 | + pip install -e .[test] |
| 84 | + pip install tabulate |
| 85 | + pip install pandas |
| 86 | + shell: bash |
| 87 | + |
| 88 | + - name: Get current hash (SHA) of the ephy_testing_data repo |
| 89 | + shell: bash |
| 90 | + id: repo_hash |
| 91 | + run: echo "dataset_hash=$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)" >> $GITHUB_OUTPUT |
| 92 | + |
| 93 | + - name: Cache datasets |
| 94 | + id: cache-datasets |
| 95 | + uses: actions/cache/restore@v4 |
| 96 | + with: |
| 97 | + path: ~/spikeinterface_datasets |
| 98 | + key: ${{ runner.os }}-datasets-${{ steps.repo_hash.outputs.dataset_hash }} |
| 99 | + restore-keys: ${{ runner.os }}-datasets |
| 100 | + |
| 101 | + - name: Install git-annex |
| 102 | + shell: bash |
| 103 | + if: env.RUN_EXTRACTORS_TESTS == 'true' |
| 104 | + run: | |
| 105 | + pip install datalad-installer |
| 106 | + if [ ${{ runner.os }} = 'Linux' ]; then |
| 107 | + wget https://downloads.kitenet.net/git-annex/linux/current/git-annex-standalone-amd64.tar.gz |
| 108 | + mkdir /home/runner/work/installation |
| 109 | + mv git-annex-standalone-amd64.tar.gz /home/runner/work/installation/ |
| 110 | + workdir=$(pwd) |
| 111 | + cd /home/runner/work/installation |
| 112 | + tar xvzf git-annex-standalone-amd64.tar.gz |
| 113 | + echo "$(pwd)/git-annex.linux" >> $GITHUB_PATH |
| 114 | + cd $workdir |
| 115 | + elif [ ${{ runner.os }} = 'macOS' ]; then |
| 116 | + datalad-installer --sudo ok git-annex --method brew |
| 117 | + elif [ ${{ runner.os }} = 'Windows' ]; then |
| 118 | + datalad-installer --sudo ok git-annex --method datalad/git-annex:release |
| 119 | + fi |
| 120 | + git config --global filter.annex.process "git-annex filter-process" # recommended for efficiency |
| 121 | +
|
| 122 | +
|
| 123 | + - name: Set execute permissions on run_tests.sh |
| 124 | + shell: bash |
| 125 | + run: chmod +x .github/run_tests.sh |
| 126 | + |
| 127 | + - name: Test extractors |
| 128 | + shell: bash |
| 129 | + env: |
| 130 | + HDF5_PLUGIN_PATH: ${{ github.workspace }}/hdf5_plugin_path_maxwell |
| 131 | + if: env.RUN_EXTRACTORS_TESTS == 'true' |
| 132 | + run: | |
| 133 | + pip install -e .[extractors,streaming_extractors] |
| 134 | + ./.github/run_tests.sh "extractors and not streaming_extractors" --no-virtual-env |
| 135 | +
|
| 136 | + - name: Test preprocessing |
| 137 | + shell: bash |
| 138 | + if: env.RUN_PREPROCESSING_TESTS == 'true' |
| 139 | + run: | |
| 140 | + pip install -e .[preprocessing] |
| 141 | + ./.github/run_tests.sh "preprocessing and not deepinterpolation" --no-virtual-env |
| 142 | +
|
| 143 | + - name: Test postprocessing |
| 144 | + shell: bash |
| 145 | + if: env.RUN_POSTPROCESSING_TESTS == 'true' |
| 146 | + run: | |
| 147 | + pip install -e .[full] |
| 148 | + ./.github/run_tests.sh postprocessing --no-virtual-env |
| 149 | +
|
| 150 | + - name: Test quality metrics |
| 151 | + shell: bash |
| 152 | + if: env.RUN_QUALITYMETRICS_TESTS == 'true' |
| 153 | + run: | |
| 154 | + pip install -e .[qualitymetrics] |
| 155 | + ./.github/run_tests.sh qualitymetrics --no-virtual-env |
| 156 | +
|
| 157 | + - name: Test comparison |
| 158 | + shell: bash |
| 159 | + if: env.RUN_COMPARISON_TESTS == 'true' |
| 160 | + run: | |
| 161 | + pip install -e .[full] |
| 162 | + ./.github/run_tests.sh comparison --no-virtual-env |
| 163 | +
|
| 164 | + - name: Test core sorters |
| 165 | + shell: bash |
| 166 | + if: env.RUN_SORTERS_TESTS == 'true' |
| 167 | + run: | |
| 168 | + pip install -e .[full] |
| 169 | + ./.github/run_tests.sh sorters --no-virtual-env |
| 170 | +
|
| 171 | + - name: Test internal sorters |
| 172 | + shell: bash |
| 173 | + if: env.RUN_INTERNAL_SORTERS_TESTS == 'true' |
| 174 | + run: | |
| 175 | + pip install -e .[full] |
| 176 | + ./.github/run_tests.sh sorters_internal --no-virtual-env |
| 177 | +
|
| 178 | + - name: Test curation |
| 179 | + shell: bash |
| 180 | + if: env.RUN_CURATION_TESTS == 'true' |
| 181 | + run: | |
| 182 | + pip install -e .[full] |
| 183 | + ./.github/run_tests.sh curation --no-virtual-env |
| 184 | +
|
| 185 | + - name: Test widgets |
| 186 | + shell: bash |
| 187 | + if: env.RUN_WIDGETS_TESTS == 'true' |
| 188 | + run: | |
| 189 | + pip install -e .[full] |
| 190 | + ./.github/run_tests.sh widgets --no-virtual-env |
| 191 | +
|
| 192 | + - name: Test exporters |
| 193 | + shell: bash |
| 194 | + if: env.RUN_EXPORTERS_TESTS == 'true' |
| 195 | + run: | |
| 196 | + pip install -e .[full] |
| 197 | + ./.github/run_tests.sh exporters --no-virtual-env |
| 198 | +
|
| 199 | + - name: Test sortingcomponents |
| 200 | + shell: bash |
| 201 | + if: env.RUN_SORTINGCOMPONENTS_TESTS == 'true' |
| 202 | + run: | |
| 203 | + pip install -e .[full] |
| 204 | + ./.github/run_tests.sh sortingcomponents --no-virtual-env |
| 205 | +
|
| 206 | + - name: Test generation |
| 207 | + shell: bash |
| 208 | + if: env.RUN_GENERATION_TESTS == 'true' |
| 209 | + run: | |
| 210 | + pip install -e .[full] |
| 211 | + ./.github/run_tests.sh generation --no-virtual-env |
0 commit comments