-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (46 loc) · 1.52 KB
/
pr-clang-format.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
name: ClangFormat
on:
pull_request:
paths:
- "**.c"
- "**.h"
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-
- name: Install dependencies
run: npm ci
- name: Get NCS version
id: version
run: echo "version=`node .github/ncs-version.mjs`" >> $GITHUB_OUTPUT
clang-format:
runs-on: ubuntu-22.04
needs: [ncs]
steps:
- uses: actions/checkout@v4
- name: Install run-clang-format.py
run: |
curl -s https://raw.githubusercontent.com/Sarcasm/run-clang-format/50a5250a2666218595ee21d68c71f50ac39866d2/run-clang-format.py > run-clang-format.py
chmod +x run-clang-format.py
- name: Run ClangFormat
# In NCS there is no formatting enforced, therefore we ignore errors here.
# This action then serves as reference how to use it in CI.
continue-on-error: true
run: |
clang-format --version
curl -s https://raw.githubusercontent.com/nrfconnect/sdk-nrf/${{ needs.ncs.outputs.version }}/.clang-format > .clang-format
./run-clang-format.py -r src