Skip to content

Commit 9139e82

Browse files
committed
ci: compliance: convert compliance to workflow_call
Add compliance to twister workflow as a the first step. If compliance fials, no twister will run. Signed-off-by: Anas Nashif <[email protected]>
1 parent df15fc8 commit 9139e82

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

.github/workflows/compliance.yml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
name: Compliance Checks
22

33
on:
4-
pull_request:
5-
types:
6-
- edited
7-
- opened
8-
- reopened
9-
- synchronize
4+
workflow_call:
105

116
jobs:
7+
check_compliance_push:
8+
if: github.event_name == 'push'
9+
runs-on: ubuntu-22.04
10+
name: Run compliance checks on patch series (PR)
11+
steps:
12+
- name: Do nothing
13+
run: |
14+
echo "Doing nothing"
15+
1216
check_compliance:
17+
if: github.event_name == 'pull_request'
1318
runs-on: ubuntu-22.04
1419
name: Run compliance checks on patch series (PR)
1520
steps:
@@ -93,6 +98,8 @@ jobs:
9398
path: compliance.xml
9499

95100
- name: check-warns
101+
id: check-warns
102+
continue-on-error: true
96103
run: |
97104
if [[ ! -s "compliance.xml" ]]; then
98105
exit 1;
@@ -121,10 +128,12 @@ jobs:
121128
if [ "${exit}" == "1" ]; then
122129
echo "Compliance error, check for error messages in the \"Run Compliance Tests\" step"
123130
echo "You can run this step locally with the ./scripts/ci/check_compliance.py script."
131+
echo "exit_code=${exit}" >> $GITHUB_OUTPUT
124132
exit 1;
125133
fi
126-
127-
if [ "${{ steps.pr_description.outcome }}" == "failure" ]; then
128-
echo "PR description cannot be empty"
129-
exit 1;
130-
fi
134+
- name: resolve
135+
if: |
136+
steps.check-warns.outputs.exit_code != 0 &&
137+
! contains(github.event.pull_request.labels.*.name, 'Compliance: False Positive')
138+
run: |
139+
exit ${{ steps.check-warns.outputs.exit_code }}

.github/workflows/twister.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ concurrency:
2020
cancel-in-progress: true
2121

2222
jobs:
23+
compliance-check:
24+
uses: ./.github/workflows/compliance.yml
25+
2326
twister-build-prep:
27+
needs: compliance-check
2428
uses: ./.github/workflows/twister-prep.yaml
2529

2630
twister-build:
@@ -214,7 +218,7 @@ jobs:
214218
- twister-build
215219
runs-on: ubuntu-22.04
216220
# the build-and-test job might be skipped, we don't need to run this job then
217-
if: success() || failure()
221+
if: (success() || failure()) && needs.twister-build.result != 'skipped'
218222

219223
steps:
220224
- name: Check out source code
@@ -231,6 +235,7 @@ jobs:
231235
path: artifacts
232236

233237
- name: Merge Test Results
238+
if: needs.twister-build.result != 'skipped'
234239
run: |
235240
pip install junitparser junit2html
236241
junitparser merge artifacts/*/*/twister.xml junit.xml
@@ -275,6 +280,7 @@ jobs:
275280
if: always()
276281
name: "Check Twister Status"
277282
needs:
283+
- compliance-check
278284
- twister-build-prep
279285
- twister-build
280286
uses: ./.github/workflows/ready-to-merge.yml

0 commit comments

Comments
 (0)