Skip to content

Commit 23a2540

Browse files
committed
use beta 22
1 parent 78f9162 commit 23a2540

File tree

1 file changed

+116
-113
lines changed

1 file changed

+116
-113
lines changed

.github/workflows/compliance.yml

Lines changed: 116 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ name: Compliance Checks
33
on:
44
pull_request:
55
types:
6-
- edited
7-
- opened
8-
- reopened
9-
- synchronize
6+
- edited
7+
- opened
8+
- reopened
9+
- synchronize
1010

1111
permissions:
1212
contents: read
@@ -16,116 +16,119 @@ jobs:
1616
runs-on: ubuntu-24.04
1717
name: Run compliance checks on patch series (PR)
1818
steps:
19-
- name: Update PATH for west
20-
run: |
21-
echo "$HOME/.local/bin" >> $GITHUB_PATH
22-
- name: Checkout the code
23-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24-
with:
25-
ref: ${{ github.event.pull_request.head.sha }}
26-
fetch-depth: 0
27-
28-
- name: Rebase onto the target branch
29-
env:
30-
BASE_REF: ${{ github.base_ref }}
31-
run: |
32-
git config --global user.email "[email protected]"
33-
git config --global user.name "Your Name"
34-
git remote -v
35-
# Ensure there's no merge commits in the PR
36-
[[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \
37-
(echo "::error ::Merge commits not allowed, rebase instead";false)
38-
rm -fr ".git/rebase-apply"
39-
rm -fr ".git/rebase-merge"
40-
git rebase origin/${BASE_REF}
41-
git clean -f -d
42-
# debug
43-
git log --pretty=oneline | head -n 10
44-
45-
- name: Set up Python
46-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
47-
with:
48-
python-version: 3.12
49-
cache: pip
50-
cache-dependency-path: scripts/requirements-actions.txt
51-
52-
- name: Install Python packages
53-
run: |
54-
pip install -r scripts/requirements-actions.txt --require-hashes
55-
56-
- name: west setup
57-
run: |
58-
west init -l . || true
59-
west config manifest.group-filter -- +ci,-optional
60-
west update -o=--depth=1 -n 2>&1 1> west.update.log || west update -o=--depth=1 -n 2>&1 1> west.update2.log
61-
62-
- name: Setup Node.js
63-
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
64-
with:
65-
node-version: "20"
66-
67-
- name: Install dependencies
68-
run: npm i -g [email protected]
69-
70-
- name: Run Compliance Tests
71-
continue-on-error: true
72-
id: compliance
73-
env:
74-
BASE_REF: ${{ github.base_ref }}
75-
run: |
76-
export ZEPHYR_BASE=$PWD
77-
# debug
78-
ls -la
79-
git log --pretty=oneline | head -n 10
80-
# Increase rename limit to allow for large PRs
81-
git config diff.renameLimit 10000
82-
excludes="-e KconfigBasic -e SysbuildKconfigBasic -e ClangFormat"
83-
# The signed-off-by check for dependabot should be skipped
84-
if [ "${{ github.actor }}" == "dependabot[bot]" ]; then
85-
excludes="$excludes -e Identity"
86-
fi
87-
./scripts/ci/check_compliance.py --annotate $excludes -c origin/${BASE_REF}..
88-
89-
- name: upload-results
90-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
91-
continue-on-error: true
92-
with:
93-
name: compliance.xml
94-
path: compliance.xml
95-
96-
- name: check-warns
97-
run: |
98-
if [[ ! -s "compliance.xml" ]]; then
99-
exit 1;
100-
fi
101-
102-
warns=("ClangFormat")
103-
files=($(./scripts/ci/check_compliance.py -l))
104-
105-
for file in "${files[@]}"; do
106-
f="${file}.txt"
107-
if [[ -s $f ]]; then
108-
results=$(cat $f)
109-
results="${results//'%'/'%25'}"
110-
results="${results//$'\n'/'%0A'}"
111-
results="${results//$'\r'/'%0D'}"
19+
- name: Update PATH for west
20+
run: |
21+
echo "$HOME/.local/bin" >> $GITHUB_PATH
22+
- name: Checkout the code
23+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24+
with:
25+
ref: ${{ github.event.pull_request.head.sha }}
26+
fetch-depth: 0
27+
28+
- name: Rebase onto the target branch
29+
env:
30+
BASE_REF: ${{ github.base_ref }}
31+
run: |
32+
git config --global user.email "[email protected]"
33+
git config --global user.name "Your Name"
34+
git remote -v
35+
# Ensure there's no merge commits in the PR
36+
[[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \
37+
(echo "::error ::Merge commits not allowed, rebase instead";false)
38+
rm -fr ".git/rebase-apply"
39+
rm -fr ".git/rebase-merge"
40+
git rebase origin/${BASE_REF}
41+
git clean -f -d
42+
# debug
43+
git log --pretty=oneline | head -n 10
44+
45+
- name: Set up Python
46+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
47+
with:
48+
python-version: 3.12
49+
cache: pip
50+
cache-dependency-path: scripts/requirements-actions.txt
51+
52+
- name: Install Python packages
53+
run: |
54+
pip install -r scripts/requirements-actions.txt --require-hashes
55+
56+
- name: west setup
57+
run: |
58+
west init -l . || true
59+
west config manifest.group-filter -- +ci,-optional
60+
west update -o=--depth=1 -n 2>&1 1> west.update.log || west update -o=--depth=1 -n 2>&1 1> west.update2.log
61+
62+
- name: Setup Node.js
63+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
64+
with:
65+
node-version: "20"
66+
67+
- name: Install dependencies
68+
run: npm i -g [email protected]
69+
- name: Run Compliance Tests
70+
continue-on-error: true
71+
id: compliance
72+
env:
73+
BASE_REF: ${{ github.base_ref }}
74+
run: |
75+
export ZEPHYR_BASE=$PWD
76+
# debug
77+
ls -la
78+
git log --pretty=oneline | head -n 10
79+
# Increase rename limit to allow for large PRs
80+
git config diff.renameLimit 10000
81+
excludes="-e KconfigBasic -e SysbuildKconfigBasic -e ClangFormat"
82+
# The signed-off-by check for dependabot should be skipped
83+
if [ "${{ github.actor }}" == "dependabot[bot]" ]; then
84+
excludes="$excludes -e Identity"
85+
fi
86+
./scripts/ci/check_compliance.py --annotate $excludes -c origin/${BASE_REF}..
87+
- name: fake errors
88+
run: |
89+
echo "::error file=boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp.dts,line=12,endLine=12,col=9,endColumn=48::Expected ';'"
90+
echo "::error file=boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp.dts,line=30,endLine=30,col=11,endColumn=18::Expected ';'"
91+
echo "::error file=boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp.dts,line=31,endLine=31,col=16,endColumn=17::Missing ','"
92+
- name: upload-results
93+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
94+
continue-on-error: true
95+
with:
96+
name: compliance.xml
97+
path: compliance.xml
98+
99+
- name: check-warns
100+
run: |
101+
if [[ ! -s "compliance.xml" ]]; then
102+
exit 1;
103+
fi
112104
113-
if [[ "${warns[@]}" =~ "${file}" ]]; then
114-
echo "::warning file=${f}::$results"
115-
else
116-
echo "::error file=${f}::$results"
117-
exit=1
105+
warns=("ClangFormat")
106+
files=($(./scripts/ci/check_compliance.py -l))
107+
108+
for file in "${files[@]}"; do
109+
f="${file}.txt"
110+
if [[ -s $f ]]; then
111+
results=$(cat $f)
112+
results="${results//'%'/'%25'}"
113+
results="${results//$'\n'/'%0A'}"
114+
results="${results//$'\r'/'%0D'}"
115+
116+
if [[ "${warns[@]}" =~ "${file}" ]]; then
117+
echo "::warning file=${f}::$results"
118+
else
119+
echo "::error file=${f}::$results"
120+
exit=1
121+
fi
118122
fi
119-
fi
120-
done
123+
done
121124
122-
if [ "${exit}" == "1" ]; then
123-
echo "Compliance error, check for error messages in the \"Run Compliance Tests\" step"
124-
echo "You can run this step locally with the ./scripts/ci/check_compliance.py script."
125-
exit 1;
126-
fi
125+
if [ "${exit}" == "1" ]; then
126+
echo "Compliance error, check for error messages in the \"Run Compliance Tests\" step"
127+
echo "You can run this step locally with the ./scripts/ci/check_compliance.py script."
128+
exit 1;
129+
fi
127130
128-
if [ "${{ steps.pr_description.outcome }}" == "failure" ]; then
129-
echo "PR description cannot be empty"
130-
exit 1;
131-
fi
131+
if [ "${{ steps.pr_description.outcome }}" == "failure" ]; then
132+
echo "PR description cannot be empty"
133+
exit 1;
134+
fi

0 commit comments

Comments
 (0)