diff --git a/.github/workflows/pipeline_tests.yml b/.github/workflows/pipeline_tests.yml index 132a7662..2673c3bb 100644 --- a/.github/workflows/pipeline_tests.yml +++ b/.github/workflows/pipeline_tests.yml @@ -73,6 +73,13 @@ jobs: pytest -s -q -m "pipeline_test" ${{ needs.identify-tests.outputs.tests }} fi + - name: Cache test results + if: ${{ always() }} + uses: actions/cache@v3 + with: + key: cache-test-results-${{github.run_id}} + path: test_pipeline-*.txt + - name: Archive pipeline execution failures if: ${{ failure() }} # Run only if previous job fails uses: actions/upload-artifact@v3 @@ -82,8 +89,20 @@ jobs: crash-*.pklz retention-days: 15 - - name: Report results on GitHub - if: ${{ always() }} + # A job to report the test results + tests-report: + needs: [identify-tests, pytest] + runs-on: ubuntu-latest + if: ${{ always() }} + steps: + + - name: Restore cache with test results + uses: actions/cache@v3 + with: + key: cache-test-results-${{github.run_id}} + path: test_pipeline-*.txt + + - name: Report results on step summary run: | # Start report echo "# Correlation values" >> $GITHUB_STEP_SUMMARY @@ -97,5 +116,40 @@ jobs: # Loop through test report files for team in ${{ needs.identify-tests.outputs.teams }} do + # Retrieve the report from GITHUB_ENV, as set up by the pytest job cat test_pipeline-$team.txt >> $GITHUB_STEP_SUMMARY done + + - name: Checkout wiki + uses: actions/checkout@v3 + with: + repository: ${{github.repository}}.wiki + path: wiki + + - name: Report results on the project's wiki + run: | + # Loop through test report files & write them to the corresponding wiki page + for team in ${{ needs.identify-tests.outputs.teams }} + do + echo "# Correlation values for pipeline $team \n" > wiki/pipeline_$team.md + echo "Unthresholded maps, reproduced vs. results \n" >> wiki/pipeline_$team.md + echo "Correlation values are sorted from hypotheses 1 to 9 \n" >> wiki/pipeline_$team.md + echo "These values were calculated by GitHub Actions run [# $GITHUB_RUN_ID]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID) \n" >> wiki/pipeline_$team.md + echo "| Team | Number of subjects | Test status | Correlation values |" >> wiki/pipeline_$team.md + echo "| -------- | ------- | ------- | ------- |" >> wiki/pipeline_$team.md + + # Retrieve the report from GITHUB_ENV, as set up by the pytest job + cat test_pipeline-$team.txt >> wiki/pipeline_$team.md + done + + # Push changes + cd wiki + git config user.name github-actions + git config user.email github-actions@github.com + + # Test if there are changes in the repository before commiting + if [[ $(git diff --name-only) ]]; then + git add . + git commit -m "Pipeline status updated" + git push + fi diff --git a/docs/ci-cd.md b/docs/ci-cd.md index c292eed1..662649cb 100644 --- a/docs/ci-cd.md +++ b/docs/ci-cd.md @@ -36,7 +36,8 @@ For now, the following workflows are set up: | ----------- | ----------- | ----------- | ----------- | ----------- | | [code_quality](/.github/workflows/code_quality.yml) | A static analysis of the python code (see the [testing](/docs/testing.md) topic of the documentation for more information). | For every push or pull_request if there are changes on `.py` files. | On GitHub servers. | Outputs (logs of pylint) are stored as [downloadable artifacts](https://docs.github.com/en/actions/managing-workflow-runs/downloading-workflow-artifacts) during 15 days after the push. | | [codespell](/.github/workflows/codespell.yml) | A static analysis of the text files for commonly made typos using [codespell](codespell-project/codespell: check code for common misspellings). | For every push or pull_request to the `maint` branch. | On GitHub servers. | Outputs (logs of codespell) are stored as [downloadable artifacts](https://docs.github.com/en/actions/managing-workflow-runs/downloading-workflow-artifacts) during 15 days after the push. | -| [pipeline_tests](/.github/workflows/pipelines.yml) | Runs all the tests for changed pipelines. | For every push or pull_request, if a pipeline file changed. | On Empenn runners. | Outputs (logs of pytest) are stored as downloadable artifacts during 15 days after the push. | +| [pipeline_status](/.github/workflows/pipeline_status.yml) | Generates a page with pipelines statuses. | For every push on the `main` branch, if a pipeline file changed. Or if issues changed. | On GitHub servers. | Outputs (status table) is pushed to the dedicated [page](https://github.com/Inria-Empenn/narps_open_pipelines/wiki/pipeline_status) on the project's wiki. | +| [pipeline_tests](/.github/workflows/pipeline_tests.yml) | Runs all the tests for changed pipelines. | For every push or pull_request, if a pipeline file changed. | On Empenn runners. | Outputs (logs of pytest) are stored as downloadable artifacts during 15 days after the push. Results of pipeline are pushed to a dedicated page on the project's wiki. | | [test_changes](/.github/workflows/test_changes.yml) | It runs all the changed tests for the project. | For every push or pull_request, if a test file changed. | On Empenn runners. | Outputs (logs of pytest) are stored as downloadable artifacts during 15 days after the push. | | [unit_testing](/.github/workflows/unit_testing.yml) | It runs all the unit tests for the project (see the [testing](/docs/testing.md) topic of the documentation for more information). | For every push or pull_request, if a file changed inside `narps_open/`, or a file related to test execution. | On GitHub servers. | Outputs (logs of pytest) are stored as downloadable artifacts during 15 days after the push. | diff --git a/narps_open/pipelines/team_2T6S.py b/narps_open/pipelines/team_2T6S.py index 6c42201a..7293947b 100755 --- a/narps_open/pipelines/team_2T6S.py +++ b/narps_open/pipelines/team_2T6S.py @@ -1,7 +1,7 @@ #!/usr/bin/python # coding: utf-8 -""" Write the work of NARPS team 2T6S using Nipype """ +""" Write the work of NARPS' team 2T6S using Nipype """ from os.path import join from itertools import product