diff --git a/.github/workflows/all-tests.yml b/.github/workflows/all-tests.yml index 1c426ba11c..1f6660e015 100644 --- a/.github/workflows/all-tests.yml +++ b/.github/workflows/all-tests.yml @@ -36,9 +36,7 @@ jobs: - name: Get current hash (SHA) of the ephy_testing_data repo id: repo_hash - run: | - echo "dataset_hash=$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)" - echo "dataset_hash=$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)" >> $GITHUB_OUTPUT + run: echo "dataset_hash=$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)" >> $GITHUB_OUTPUT shell: bash - name: Cache datasets id: cache-datasets @@ -70,6 +68,41 @@ jobs: git config --global filter.annex.process "git-annex filter-process" # recommended for efficiency shell: bash + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v41 + + - name: Set environment variables based on changed files + run: | + declare -A changes + changes=( + ["pyproject.toml"]="CORE_CHANGED" + ["/core/"]="CORE_CHANGED" + ["/extractors/neoextractors/neobaseextractor.py"]="CORE_CHANGED" + ["/extractors/"]="EXTRACTORS_CHANGED" + ["plexon2"]="PLEXON2_CHANGED" + ["/preprocessing/"]="PREPROCESSING_CHANGED" + ["/postprocessing/"]="POSTPROCESSING_CHANGED" + ["/qualitymetrics/"]="QUALITYMETRICS_CHANGED" + ["/sorters/"]="SORTERS_CHANGED" + ["/sorters/external"]="SORTERS_EXTERNAL_CHANGED" + ["/sorters/internal"]="SORTERS_INTERNAL_CHANGED" + ["/comparison/"]="COMPARISON_CHANGED" + ["/curation/"]="CURATION_CHANGED" + ["/widgets/"]="WIDGETS_CHANGED" + ["/exporters/"]="EXPORTERS_CHANGED" + ["/sortingcomponents/"]="SORTINGCOMPONENTS_CHANGED" + ["/generation/"]="GENERATION_CHANGED" + ) + + for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + for pattern in "${!changes[@]}"; do + if [[ $file == *$pattern* ]]; then + echo "${changes[$pattern]}=true" >> $GITHUB_ENV + fi + done + done + - name: Set execute permissions on run_tests.sh run: chmod +x .github/run_tests.sh shell: bash @@ -81,49 +114,61 @@ jobs: - name: Test extractors env: HDF5_PLUGIN_PATH: ${{ github.workspace }}/hdf5_plugin_path_maxwell + if: env.EXTRACTORS_CHANGED == 'true' || env.CORE_CHANGED == 'true' run: pytest -m "extractors" shell: bash - name: Test preprocessing + if: env.PREPROCESSING_CHANGED == 'true' || env.CORE_CHANGED == 'true' run: ./.github/run_tests.sh "preprocessing and not deepinterpolation" --no-virtual-env shell: bash - name: Test postprocessing + if: env.POSTPROCESSING_CHANGED == 'true' || env.CORE_CHANGED == 'true' run: ./.github/run_tests.sh postprocessing --no-virtual-env shell: bash - name: Test quality metrics + if: env.QUALITYMETRICS_CHANGED == 'true' || env.CORE_CHANGED == 'true' run: ./.github/run_tests.sh qualitymetrics --no-virtual-env shell: bash - name: Test comparison + if: env.COMPARISON_CHANGED == 'true' || env.GENERATION_CHANGED == 'true' || env.CORE_CHANGED == 'true' run: ./.github/run_tests.sh comparison --no-virtual-env shell: bash - name: Test core sorters + if: env.SORTERS_CHANGED == 'true' || env.CORE_CHANGED == 'true' run: ./.github/run_tests.sh sorters --no-virtual-env shell: bash - name: Test internal sorters + if: env.SORTERS_INTERNAL_CHANGED == 'true' || env.SORTINGCOMPONENTS_CHANGED == 'true' || env.CORE_CHANGED == 'true' run: ./.github/run_tests.sh sorters_internal --no-virtual-env shell: bash - name: Test curation + if: env.CURATION_CHANGED == 'true' || env.CORE_CHANGED == 'true' run: ./.github/run_tests.sh curation --no-virtual-env shell: bash - name: Test widgets + if: env.WIDGETS_CHANGED == 'true' || env.CORE_CHANGED == 'true' || env.QUALITYMETRICS_CHANGED == 'true' || env.PREPROCESSING_CHANGED == 'true' run: ./.github/run_tests.sh widgets --no-virtual-env shell: bash - name: Test exporters + if: env.EXPORTERS_CHANGED == 'true' || env.CORE_CHANGED == 'true' || env.WIDGETS_CHANGED == 'true' run: ./.github/run_tests.sh exporters --no-virtual-env shell: bash - name: Test sortingcomponents + if: env.SORTINGCOMPONENTS_CHANGED == 'true' || env.CORE_CHANGED == 'true' run: ./.github/run_tests.sh sortingcomponents --no-virtual-env shell: bash - name: Test generation + if: env.GENERATION_CHANGED == 'true' || env.CORE_CHANGED == 'true' run: ./.github/run_tests.sh generation --no-virtual-env shell: bash