Skip to content

4SZ2 reproduction

4SZ2 reproduction #334

Workflow file for this run

## Disclaimer - This GitHub Actions workflow runs all the changed tests for the project.
# Name the workflow
name: test_changes
# Define when it runs
on:
pull_request:
paths:
- 'tests/**/test_*.py'
# Jobs that define the workflow
jobs:
# A job to list the tests to be run
identify-tests:
runs-on: ubuntu-latest
outputs:
tests: ${{ steps.identify.outputs.tests }}
steps:
- name: Checkout main branch for comparison
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create a list of tests for changed tests
id: identify
run: |
# Loop through modified files between PR base and last head
for file in $(git diff --name-only --diff-filter=d remotes/origin/main...$GITHUB_SHA)
do
# List files corresponding to tests/**/test_**.py
if [[ "$file" =~ .*"tests".*"test_".*".py" ]]; then
test_files="$test_files $file"
fi
done
# Send the test list as step output
echo $test_files
echo "tests=$test_files" >> $GITHUB_OUTPUT
# A job to run the tests
pytest:
needs: identify-tests
runs-on: self-hosted
timeout-minutes: 2880 # 48h
steps:
- name: Checkout PR branch
uses: actions/checkout@v3
- name: Load configuration for self-hosted runner
run: cp /home/neuro/local_testing_config.toml narps_open/utils/configuration/testing_config.toml
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[tests]
- name: Execute tests with pytest
run: |
if [[ "${{ needs.identify-tests.outputs.tests }}" != "" ]]; then
pytest -s -q ${{ needs.identify-tests.outputs.tests }} -m "not pipeline_test"
fi