diff --git a/.github/actions/evaluate-job-result/action.yaml b/.github/actions/evaluate-job-result/action.yaml deleted file mode 100644 index c5c013080fd27..0000000000000 --- a/.github/actions/evaluate-job-result/action.yaml +++ /dev/null @@ -1,45 +0,0 @@ -name: Evaluate Job Result -description: Evaluates the result of a job and updates the summary. -inputs: - job_result: - description: Result of the job to evaluate (e.g., success, failure, skipped) - required: true - type: string - job_name: - description: Name of the job to evaluate - required: true - type: string - expected_results: - description: Comma-separated list of acceptable results (e.g., success,skipped) - required: true - type: string -outputs: - failed: - description: Indicates if the job failed - value: ${{ steps.evaluate.outputs.failed }} - -runs: - using: composite - steps: - - name: Evaluate Job Result - id: evaluate - run: | - JOB_RESULT="${{ inputs.job_result }}" - IFS=',' read -ra EXPECTED <<< "${{ inputs.expected_results }}" - FAILED=false - - for RESULT in "${EXPECTED[@]}"; do - if [[ "$JOB_RESULT" == "$RESULT" ]]; then - echo "- **${{ inputs.job_name }}:** "$JOB_RESULT" ✅" >> "$GITHUB_STEP_SUMMARY" - echo "failed=false" >> "$GITHUB_OUTPUT" - exit 0 - fi - done - - # If no expected result matched - echo "::error::${{ inputs.job_name }} failed. ❌" - echo "- **${{ inputs.job_name }}:** failed ❌" >> "$GITHUB_STEP_SUMMARY" - echo "failed=true" >> "$GITHUB_OUTPUT" - - exit 1 - shell: bash diff --git a/.github/workflows/build-and-test-differential.yaml b/.github/workflows/build-and-test-differential.yaml index 0925cb0f53930..c25f6b24c5e47 100644 --- a/.github/workflows/build-and-test-differential.yaml +++ b/.github/workflows/build-and-test-differential.yaml @@ -14,6 +14,10 @@ on: default: humble required: false type: string + run-condition: + default: true + required: false + type: boolean container-suffix: required: false default: "" @@ -28,6 +32,7 @@ env: jobs: build-and-test-differential: + if: ${{ inputs.run-condition }} runs-on: ${{ inputs.runner }} container: ${{ inputs.container }}${{ inputs.container-suffix }} steps: diff --git a/.github/workflows/build-test-tidy-pr.yaml b/.github/workflows/build-test-tidy-pr.yaml index d1ea9b2d0f79d..c0442694b5c77 100644 --- a/.github/workflows/build-test-tidy-pr.yaml +++ b/.github/workflows/build-test-tidy-pr.yaml @@ -40,98 +40,44 @@ jobs: shell: bash build-and-test-differential: + if: ${{ always() }} needs: - require-label uses: ./.github/workflows/build-and-test-differential.yaml with: container: ghcr.io/autowarefoundation/autoware:universe-devel + run-condition: ${{ needs.require-label.outputs.result == 'true' }} secrets: codecov-token: ${{ secrets.CODECOV_TOKEN }} build-and-test-differential-cuda: + if: ${{ always() }} needs: check-if-cuda-job-is-needed - if: ${{ needs.check-if-cuda-job-is-needed.outputs.cuda_job_is_needed == 'true' }} uses: ./.github/workflows/build-and-test-differential.yaml with: container: ghcr.io/autowarefoundation/autoware:universe-devel container-suffix: -cuda + run-condition: ${{ needs.check-if-cuda-job-is-needed.outputs.cuda_job_is_needed == 'true' }} secrets: codecov-token: ${{ secrets.CODECOV_TOKEN }} - build-test-pr: - needs: - - build-and-test-differential - - build-and-test-differential-cuda - if: ${{ always() }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Initialize Summary - run: echo "### Build Test PR Results" > $GITHUB_STEP_SUMMARY - shell: bash - - - name: Evaluate build-and-test-differential - uses: ./.github/actions/evaluate-job-result - with: - job_result: ${{ needs.build-and-test-differential.result }} - job_name: build-and-test-differential - expected_results: success - - - name: Evaluate build-and-test-differential-cuda - if: ${{ always() }} - uses: ./.github/actions/evaluate-job-result - with: - job_result: ${{ needs.build-and-test-differential-cuda.result }} - job_name: build-and-test-differential-cuda - expected_results: success,skipped - clang-tidy-differential: + if: ${{ always() }} # always run to provide report for status check needs: - check-if-cuda-job-is-needed - build-and-test-differential - if: ${{ needs.check-if-cuda-job-is-needed.outputs.cuda_job_is_needed == 'false' }} uses: ./.github/workflows/clang-tidy-differential.yaml with: container: ghcr.io/autowarefoundation/autoware:universe-devel + run-condition: ${{ needs.check-if-cuda-job-is-needed.outputs.cuda_job_is_needed == 'false' && needs.build-and-test-differential.result == 'success' }} clang-tidy-differential-cuda: + if: ${{ always() }} # always run to provide report for status check needs: + - check-if-cuda-job-is-needed - build-and-test-differential-cuda uses: ./.github/workflows/clang-tidy-differential.yaml with: container: ghcr.io/autowarefoundation/autoware:universe-devel container-suffix: -cuda - - clang-tidy-pr: - needs: - - clang-tidy-differential - - clang-tidy-differential-cuda - if: ${{ always() }} - runs-on: ubuntu-latest - steps: - - name: Initialize Summary - run: echo "### Clang Tidy PR Results" > $GITHUB_STEP_SUMMARY - shell: bash - - - name: Check clang-tidy success - if: ${{ needs.clang-tidy-differential.result == 'success' || needs.clang-tidy-differential-cuda.result == 'success' }} - run: | - echo "✅ Either one of the following has succeeded:" >> $GITHUB_STEP_SUMMARY - - - name: Fail if conditions not met - if: ${{ !(needs.clang-tidy-differential.result == 'success' || needs.clang-tidy-differential-cuda.result == 'success') }} - run: | - echo "::error::❌ Either one of the following should have succeeded:" - echo "::error::clang-tidy-differential: ${{ needs.clang-tidy-differential.result }}" - echo "::error::clang-tidy-differential-cuda: ${{ needs.clang-tidy-differential-cuda.result }}" - - echo "❌ Either one of the following should have succeeded:" >> $GITHUB_STEP_SUMMARY - - exit 1 - - - name: Print the results - if: ${{ always() }} - run: | - echo "- **clang-tidy-differential:** ${{ needs.clang-tidy-differential.result }}" >> $GITHUB_STEP_SUMMARY - echo "- **clang-tidy-differential-cuda:** ${{ needs.clang-tidy-differential-cuda.result }}" >> $GITHUB_STEP_SUMMARY + run-condition: ${{ needs.check-if-cuda-job-is-needed.outputs.cuda_job_is_needed == 'true' && needs.build-and-test-differential-cuda.result == 'success' }} diff --git a/.github/workflows/clang-tidy-differential.yaml b/.github/workflows/clang-tidy-differential.yaml index 51e0a8408468c..41d722c8e07b0 100644 --- a/.github/workflows/clang-tidy-differential.yaml +++ b/.github/workflows/clang-tidy-differential.yaml @@ -14,9 +14,14 @@ on: default: ubuntu-24.04 required: false type: string + run-condition: + default: true + required: false + type: boolean jobs: clang-tidy-differential: + if: ${{ inputs.run-condition }} runs-on: ${{ inputs.runner }} container: ${{ inputs.container }}${{ inputs.container-suffix }} steps: