Skip to content

Commit

Permalink
ci: pass run condition to reusable workflow (#9771)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryohsuke Mitsudome <[email protected]>
Co-authored-by: M. Fatih Cırıt <[email protected]>
  • Loading branch information
mitsudome-r and xmfcx authored Dec 31, 2024
1 parent 58df2a1 commit 33b9913
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 108 deletions.
45 changes: 0 additions & 45 deletions .github/actions/evaluate-job-result/action.yaml

This file was deleted.

5 changes: 5 additions & 0 deletions .github/workflows/build-and-test-differential.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ on:
default: humble
required: false
type: string
run-condition:
default: true
required: false
type: boolean
container-suffix:
required: false
default: ""
Expand All @@ -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:
Expand Down
72 changes: 9 additions & 63 deletions .github/workflows/build-test-tidy-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
5 changes: 5 additions & 0 deletions .github/workflows/clang-tidy-differential.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 33b9913

Please sign in to comment.