Skip to content

Commit

Permalink
[FIX] Merge with main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
elodiegermani1 committed Sep 21, 2023
2 parents 208f42a + 2589123 commit ab00ac3
Show file tree
Hide file tree
Showing 86 changed files with 1,785 additions and 660 deletions.
4 changes: 4 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[codespell]
skip = .git,*.pdf,*.svg,analysis_pipelines_full_descriptions.tsv
# softwares - key in data structures etc
ignore-words-list = te,fpr,fwe,softwares
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/pipeline_reproduction.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ body:
Please tick the boxes below once the corresponding task is finished. :+1:
- [ ] :ok_hand: A maintainer of the project approved the issue, by assigning a :checkered_flag:`status: ready for dev` label to it.
- [ ] :deciduous_tree: Create a branch on your fork to start the reproduction.
- [ ] :sunrise: Create a file `team_{team_id}.py` inside the [`narps_open/pipelines/`](https://github.com/Inria-Empenn/narps_open_pipelines/blob/main/narps_open/pipelines) directory. You can use a file inside [`narps_open/pipelines/templates`](https://github.com/Inria-Empenn/narps_open_pipelines/blob/main/narps_open/pipelines/templates) file as a template if needed.
- [ ] :sunrise: Create a file `team_{team_id}.py` inside the [`narps_open/pipelines/`](https://github.com/Inria-Empenn/narps_open_pipelines/blob/main/narps_open/pipelines) directory. You can use a file inside [`narps_open/pipelines/templates`](https://github.com/Inria-Empenn/narps_open_pipelines/blob/main/narps_open/pipelines/templates) as a template if needed.
- [ ] :inbox_tray: Create a [pull request](https://github.com/Inria-Empenn/narps_open_pipelines/blob/main/CONTRIBUTING.md#pull_requests) as soon as you completed the previous task.
- [ ] :brain: Write the code for the pipeline, using Nipype and the file architecture described in [docs/pipelines.md](https://github.com/Inria-Empenn/narps_open_pipelines/blob/main/docs/pipelines.md).
- [ ] :blue_book: Make sure your code is documented enough.
- [ ] :snake: Make sure your code is explicit and conforms with PEP8.
- [ ] :microscope: Create tests for your pipeline. You can use files in [`tests/pipelines/test_team_*`](https://github.com/Inria-Empenn/narps_open_pipelines/blob/main/tests/pipelines/) as examples.
- [ ] :microscope: Make sure your code passes all the tests you created (see [docs/testing.md](https://github.com/Inria-Empenn/narps_open_pipelines/blob/main/docs/testing.md)).
- [ ] :inbox_tray: create a [pull request](https://github.com/Inria-Empenn/narps_open_pipelines/blob/main/CONTRIBUTING.md#pull_requests) from your code.
validations:
required: true
2 changes: 1 addition & 1 deletion .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Analyse the code with pylint
run: |
pylint --exit-zero narps_open > pylint_report_narps_open.txt
pylint --exit-zero tests > pylint_report_narps_open.txt
pylint --exit-zero tests > pylint_report_tests.txt
- name: Archive pylint results
uses: actions/upload-artifact@v3
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Disclaimer - This GitHub Actions workflow performs a check for spelling errors inside code comments and documentation
name: codespell

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Codespell
uses: codespell-project/actions-codespell@v2
77 changes: 48 additions & 29 deletions .github/workflows/pipeline_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ name: pipeline_tests

# Define when it runs
on:
push:
paths:
- 'narps_open/pipelines/team**'
pull_request:
paths:
- 'narps_open/pipelines/team**'
Expand All @@ -19,14 +16,9 @@ jobs:
identify-tests:
runs-on: ubuntu-latest
outputs:
teams: ${{ steps.identify.outputs.teams }}
tests: ${{ steps.identify.outputs.tests }}
steps:
- name: Checkout main branch for comparison
uses: actions/checkout@v3
with:
ref: main
fetch-depth: 0

- name: Checkout current branch
uses: actions/checkout@v3
with:
Expand All @@ -35,48 +27,75 @@ jobs:
- name: Create a list of tests for changed pipelines
id: identify
run: |
# Loop through modified files
for file in $(git diff --name-only remotes/origin/main...$GITHUB_SHA)
# 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
# echo each file
echo $file
# List team id corresponding to team_* files
if [[ "$file" =~ .*"narps_open/pipelines/team_".* ]]; then
if [[ "$file" =~ narps_open/pipelines/team_[A-Z0-9]{4}.py ]]; then
echo "Modified pipeline = $file"
tmp=${file#*"team_"} # remove prefix ending in "team_"
team_id=${tmp%".py"*} # remove suffix starting with ".py"
# Populate the list of test files
# Populate the lists of test files and teams
test_files="$test_files tests/pipelines/test_team_$team_id.py"
teams="$teams $team_id"
fi
done
# Send the test list as job output
echo $test_files
echo "tests=$test_files" >> $GITHUB_OUTPUT
echo "teams=$teams" >> $GITHUB_OUTPUT
# A job to run the identified tests
# A job to identify and run the tests
pytest:
needs: identify-tests
runs-on: ubuntu-latest
runs-on: self-hosted
timeout-minutes: 2880 # 48h
steps:
- name: Checkout repository
- name: Checkout PR branch
uses: actions/checkout@v3

- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9

- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- 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: Collect tests with pytest
run: pytest --collect-only -q -m "pipeline_test" ${{ needs.identify-tests.outputs.tests }}
- name: Remove test reports if any existing
run: rm -f test_pipeline-*.txt

- name: Execute tests with pytest
run: |
if [[ "${{ needs.identify-tests.outputs.tests }}" != "" ]]; then
pytest -s -q -m "pipeline_test" ${{ needs.identify-tests.outputs.tests }}
fi
- name: Archive pipeline execution failures
if: ${{ failure() }} # Run only if previous job fails
uses: actions/upload-artifact@v3
with:
name: pipeline_tests-reports
path: |
crash-*.pklz
retention-days: 15

- name: Report results on GitHub
if: ${{ always() }}
run: |
# Start report
echo "# Correlation values" >> $GITHUB_STEP_SUMMARY
echo "Unthresholded maps, reproduced vs. results" >> $GITHUB_STEP_SUMMARY
echo "Correlation values are sorted from hypotheses 1 to 9" >> $GITHUB_STEP_SUMMARY
# Start report table
echo "| Team | Number of subjects | Test status | Correlation values |" >> $GITHUB_STEP_SUMMARY
echo "| -------- | ------- | ------- | ------- |" >> $GITHUB_STEP_SUMMARY
# Loop through test report files
for team in ${{ needs.identify-tests.outputs.teams }}
do
cat test_pipeline-$team.txt >> $GITHUB_STEP_SUMMARY
done
48 changes: 22 additions & 26 deletions .github/workflows/test_changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ name: test_changes

# Define when it runs
on:
push:
paths:
- 'tests/**/test_*.py'
pull_request:
paths:
- 'tests/**/test_*.py'
Expand All @@ -16,37 +13,21 @@ on:
jobs:

# A job to list the tests to be run
pytest:
identify-tests:
runs-on: ubuntu-latest
outputs:
tests: ${{ steps.identify.outputs.tests }}
steps:
- name: Checkout main branch for comparison
uses: actions/checkout@v3
with:
ref: main
fetch-depth: 0

- name: Checkout current branch
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9

- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Create a list of tests for changed tests
id: identify
run: |
# Loop through modified files
for file in $(git diff --name-only remotes/origin/main...$GITHUB_SHA)
# 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
Expand All @@ -57,10 +38,25 @@ jobs:
echo $test_files
echo "tests=$test_files" >> $GITHUB_OUTPUT
# A job to list the tests to be run
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: Collect tests with pytest
run: pytest --collect-only -q ${{ steps.identify.outputs.tests }}
- name: Execute tests with pytest
run: |
if [[ "${{ needs.identify-tests.outputs.tests }}" != "" ]]; then
pytest -s -q ${{ needs.identify-tests.outputs.tests }}
fi
16 changes: 4 additions & 12 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,15 @@ jobs:
pytest:

# Define the runner for this job
runs-on: ubuntu-latest
runs-on: self-hosted

# Steps that define the job
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9

- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- 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: |
Expand All @@ -58,6 +49,7 @@ jobs:
coverage xml
- name: Archive pytest results
if: ${{ failure() }} # Run only if previous job fails
uses: actions/upload-artifact@v3
with:
name: unit_tests-reports
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

# to avoid commiting data
data/
tests/data/
./data/

# neuro user in docker image
neuro
Expand Down
Loading

0 comments on commit ab00ac3

Please sign in to comment.