[DOC] Adding test suite organization documentation #1864
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Management of the action do made during a pull request | |
| name: 'CI' | |
| on: | |
| pull_request_target: | |
| # Using 'pull_request_target' instead of 'pull_request': | |
| # 1. Uses configuration from the main branch | |
| # 2. Provides access to secrets from the main repository | |
| # 3. Prevents using potentially malicious workflow from forked PRs | |
| branches: main | |
| # allows to push on branches | |
| push: | |
| branches: main | |
| # disable all the permission for the workflow | |
| permissions: {} | |
| # Cancel existing runs | |
| concurrency: | |
| group: ${{ github.workflow }}-pr-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| get_information: | |
| name: Get Information | |
| # information is: commit message for PR | |
| runs-on: ubuntu-latest | |
| outputs: | |
| COMMIT_MSG: ${{ steps.get_commit_message.outputs.COMMIT_MSG }} | |
| BRANCH_NAME: ${{ steps.get_branch_name.outputs.BRANCH_NAME }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 3 | |
| ref: ${{ github.event.pull_request.head.sha || github.ref }} | |
| # require to get the previous commit for getting their messages | |
| # in a PR the last commit is the commit merge with main | |
| - name: Get commit message | |
| id: get_commit_message | |
| # return an empty message when the event is not from a PR | |
| run: | | |
| EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
| echo "COMMIT_MSG<<$EOF" >> $GITHUB_OUTPUT | |
| if [ "${{ github.event_name }}" == "pull_request_target" ]; then | |
| echo "COMMIT_MSG=$(git log -1 --pretty=%B ${{ github.event.pull_request.head.sha }})" # use for debugging | |
| echo "$(git log -1 --pretty=%B ${{ github.event.pull_request.head.sha }})" >> $GITHUB_OUTPUT | |
| echo "$EOF" >> $GITHUB_OUTPUT | |
| else | |
| echo "$EOF" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Get branch name | |
| id: get_branch_name | |
| run: | | |
| echo "BRANCH_NAME=${{ github.event.pull_request.head.ref || github.ref_name }}" >> $GITHUB_OUTPUT | |
| tests: | |
| name: tests | |
| needs: [get_information] | |
| uses: ./.github/workflows/call_test_package.yml | |
| with: | |
| skip_test: ${{ contains(needs.get_information.outputs.COMMIT_MSG, '[skip tests]') }} | |
| tests_minimal: | |
| name: tests minimal | |
| needs: [get_information] | |
| uses: ./.github/workflows/call_test_minimal.yml | |
| with: | |
| skip_test: ${{ contains(needs.get_information.outputs.COMMIT_MSG, '[skip tests]') }} | |
| tests_publish: | |
| name: tests_publish | |
| needs: [tests, get_information] | |
| if: | | |
| ${{ github.event.pull_request.draft == false | |
| || contains(needs.get_information.outputs.COMMIT_MSG, '[doc ') | |
| }} | |
| permissions: | |
| pull-requests: write | |
| secrets: inherit | |
| uses: ./.github/workflows/call_publish_result.yml | |
| with: | |
| BRANCH_NAME: ${{ needs.get_information.outputs.BRANCH_NAME }} |