-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (67 loc) · 2.75 KB
/
pr-check_compliance.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Check compliance
on:
pull_request:
paths:
- "**.c"
- "**.h"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
ncs:
name: Determine NCS version
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "18.x"
- uses: actions/cache@v3
name: Cache dependencies
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
- name: Get NCS version
id: version
run: echo "version=`node .github/ncs-version.mjs`" >> $GITHUB_OUTPUT
checkpatch:
runs-on: ubuntu-22.04
needs: [ncs]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Fetch all history for all tags and branches
run: git fetch --prune --tags
- name: Clone ci tools
run:
git clone https://github.com/zephyrproject-rtos/ci-tools ../ci-tools
- name: Install dependencies
run: |
python3 -m pip install --upgrade --user pip 'setuptools<58' urllib3 chardet
python3 -m pip install --upgrade --user wheel pylint junitparser
python3 -m pip install --upgrade --user -r ../ci-tools/requirements.txt
sudo apt-get install httpie jq gitlint
- name: Check compliance
env:
BUILD_NUMBER: ${{ github.event.pull_request.head.sha }}
GH_USERNAME: github-actions[bot]
run: |
export PATH=$PATH:/home/runner/.local/bin
curl -s https://raw.githubusercontent.com/nrfconnect/sdk-nrf/${{ needs.ncs.outputs.version }}/.checkpatch.conf > .checkpatch.conf
mkdir -p scripts/checkpatch
curl -s https://raw.githubusercontent.com/zephyrproject-rtos/zephyr/${{ needs.ncs.outputs.version }}/scripts/checkpatch.pl > scripts/checkpatch.pl
chmod +x scripts/checkpatch.pl
curl -s https://raw.githubusercontent.com/zephyrproject-rtos/zephyr/${{ needs.ncs.outputs.version }}/scripts/spelling.txt > scripts/spelling.txt
curl -s https://raw.githubusercontent.com/zephyrproject-rtos/zephyr/${{ needs.ncs.outputs.version }}/scripts/checkpatch/typedefsfile > scripts/checkpatch/typedefsfile
../ci-tools/scripts/check_compliance.py -p ${{ github.event.pull_request.number }} \
-S ${{ github.event.pull_request.head.sha }} \
-g \
--commits origin/${{ github.event.pull_request.base.ref }}..HEAD \
--repo ${{ github.event.repository.full_name }}