Skip to content

Commit 33b9913

Browse files
mitsudome-rxmfcx
andauthored
ci: pass run condition to reusable workflow (#9771)
Signed-off-by: Ryohsuke Mitsudome <ryohsuke.mitsudome@tier4.jp> Co-authored-by: M. Fatih Cırıt <mfc@autoware.org>
1 parent 58df2a1 commit 33b9913

File tree

4 files changed

+19
-108
lines changed

4 files changed

+19
-108
lines changed

.github/actions/evaluate-job-result/action.yaml

-45
This file was deleted.

.github/workflows/build-and-test-differential.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ on:
1414
default: humble
1515
required: false
1616
type: string
17+
run-condition:
18+
default: true
19+
required: false
20+
type: boolean
1721
container-suffix:
1822
required: false
1923
default: ""
@@ -28,6 +32,7 @@ env:
2832

2933
jobs:
3034
build-and-test-differential:
35+
if: ${{ inputs.run-condition }}
3136
runs-on: ${{ inputs.runner }}
3237
container: ${{ inputs.container }}${{ inputs.container-suffix }}
3338
steps:

.github/workflows/build-test-tidy-pr.yaml

+9-63
Original file line numberDiff line numberDiff line change
@@ -40,98 +40,44 @@ jobs:
4040
shell: bash
4141

4242
build-and-test-differential:
43+
if: ${{ always() }}
4344
needs:
4445
- require-label
4546
uses: ./.github/workflows/build-and-test-differential.yaml
4647
with:
4748
container: ghcr.io/autowarefoundation/autoware:universe-devel
49+
run-condition: ${{ needs.require-label.outputs.result == 'true' }}
4850
secrets:
4951
codecov-token: ${{ secrets.CODECOV_TOKEN }}
5052

5153
build-and-test-differential-cuda:
54+
if: ${{ always() }}
5255
needs: check-if-cuda-job-is-needed
53-
if: ${{ needs.check-if-cuda-job-is-needed.outputs.cuda_job_is_needed == 'true' }}
5456
uses: ./.github/workflows/build-and-test-differential.yaml
5557
with:
5658
container: ghcr.io/autowarefoundation/autoware:universe-devel
5759
container-suffix: -cuda
60+
run-condition: ${{ needs.check-if-cuda-job-is-needed.outputs.cuda_job_is_needed == 'true' }}
5861
secrets:
5962
codecov-token: ${{ secrets.CODECOV_TOKEN }}
6063

61-
build-test-pr:
62-
needs:
63-
- build-and-test-differential
64-
- build-and-test-differential-cuda
65-
if: ${{ always() }}
66-
runs-on: ubuntu-latest
67-
steps:
68-
- uses: actions/checkout@v4
69-
70-
- name: Initialize Summary
71-
run: echo "### Build Test PR Results" > $GITHUB_STEP_SUMMARY
72-
shell: bash
73-
74-
- name: Evaluate build-and-test-differential
75-
uses: ./.github/actions/evaluate-job-result
76-
with:
77-
job_result: ${{ needs.build-and-test-differential.result }}
78-
job_name: build-and-test-differential
79-
expected_results: success
80-
81-
- name: Evaluate build-and-test-differential-cuda
82-
if: ${{ always() }}
83-
uses: ./.github/actions/evaluate-job-result
84-
with:
85-
job_result: ${{ needs.build-and-test-differential-cuda.result }}
86-
job_name: build-and-test-differential-cuda
87-
expected_results: success,skipped
88-
8964
clang-tidy-differential:
65+
if: ${{ always() }} # always run to provide report for status check
9066
needs:
9167
- check-if-cuda-job-is-needed
9268
- build-and-test-differential
93-
if: ${{ needs.check-if-cuda-job-is-needed.outputs.cuda_job_is_needed == 'false' }}
9469
uses: ./.github/workflows/clang-tidy-differential.yaml
9570
with:
9671
container: ghcr.io/autowarefoundation/autoware:universe-devel
72+
run-condition: ${{ needs.check-if-cuda-job-is-needed.outputs.cuda_job_is_needed == 'false' && needs.build-and-test-differential.result == 'success' }}
9773

9874
clang-tidy-differential-cuda:
75+
if: ${{ always() }} # always run to provide report for status check
9976
needs:
77+
- check-if-cuda-job-is-needed
10078
- build-and-test-differential-cuda
10179
uses: ./.github/workflows/clang-tidy-differential.yaml
10280
with:
10381
container: ghcr.io/autowarefoundation/autoware:universe-devel
10482
container-suffix: -cuda
105-
106-
clang-tidy-pr:
107-
needs:
108-
- clang-tidy-differential
109-
- clang-tidy-differential-cuda
110-
if: ${{ always() }}
111-
runs-on: ubuntu-latest
112-
steps:
113-
- name: Initialize Summary
114-
run: echo "### Clang Tidy PR Results" > $GITHUB_STEP_SUMMARY
115-
shell: bash
116-
117-
- name: Check clang-tidy success
118-
if: ${{ needs.clang-tidy-differential.result == 'success' || needs.clang-tidy-differential-cuda.result == 'success' }}
119-
run: |
120-
echo "✅ Either one of the following has succeeded:" >> $GITHUB_STEP_SUMMARY
121-
122-
- name: Fail if conditions not met
123-
if: ${{ !(needs.clang-tidy-differential.result == 'success' || needs.clang-tidy-differential-cuda.result == 'success') }}
124-
run: |
125-
echo "::error::❌ Either one of the following should have succeeded:"
126-
echo "::error::clang-tidy-differential: ${{ needs.clang-tidy-differential.result }}"
127-
echo "::error::clang-tidy-differential-cuda: ${{ needs.clang-tidy-differential-cuda.result }}"
128-
129-
echo "❌ Either one of the following should have succeeded:" >> $GITHUB_STEP_SUMMARY
130-
131-
exit 1
132-
133-
- name: Print the results
134-
if: ${{ always() }}
135-
run: |
136-
echo "- **clang-tidy-differential:** ${{ needs.clang-tidy-differential.result }}" >> $GITHUB_STEP_SUMMARY
137-
echo "- **clang-tidy-differential-cuda:** ${{ needs.clang-tidy-differential-cuda.result }}" >> $GITHUB_STEP_SUMMARY
83+
run-condition: ${{ needs.check-if-cuda-job-is-needed.outputs.cuda_job_is_needed == 'true' && needs.build-and-test-differential-cuda.result == 'success' }}

.github/workflows/clang-tidy-differential.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,14 @@ on:
1414
default: ubuntu-24.04
1515
required: false
1616
type: string
17+
run-condition:
18+
default: true
19+
required: false
20+
type: boolean
1721

1822
jobs:
1923
clang-tidy-differential:
24+
if: ${{ inputs.run-condition }}
2025
runs-on: ${{ inputs.runner }}
2126
container: ${{ inputs.container }}${{ inputs.container-suffix }}
2227
steps:

0 commit comments

Comments
 (0)