xref: /Kernel-v10.6.2/.github/workflows/ci.yml (revision 01820d3ed93c735e5e8460a282971a7725fae44c)
1name: CI Checks
2on:
3  push:
4    branches: ["**"]
5  pull_request:
6    branches: [main]
7  workflow_dispatch:
8jobs:
9  spell-check:
10    runs-on: ubuntu-latest
11    steps:
12      - name: Checkout Parent Repo
13        uses: actions/checkout@v2
14        with:
15          ref: main
16          repository: aws/aws-iot-device-sdk-embedded-C
17          path: main
18      - name: Clone This Repo
19        uses: actions/checkout@v2
20        with:
21            path: ./kernel
22      - name: Install spell
23        run: |
24          sudo apt-get install spell
25          sudo apt-get install util-linux
26      - name: Check spelling
27        run: |
28          PATH=$PATH:main/tools/spell
29          # Make sure that the portable directory is not included in the spellcheck.
30          sed -i 's/find $DIRNAME/find $DIRNAME -not -path '*portable*'/g' main/tools/spell/find-unknown-comment-words
31          find-unknown-comment-words --directory kernel/ --lexicon ./kernel/.github/lexicon.txt
32          if [ "$?" = "0" ]; then
33            exit 0
34          else
35            exit 1
36          fi
37  formatting:
38    runs-on: ubuntu-20.04
39    steps:
40      - uses: actions/checkout@v2
41      - name: Install Uncrustify
42        run: sudo apt-get install uncrustify=0.69.0+dfsg1-1build1
43      - name: Run Uncrustify
44        run: |
45          uncrustify --version
46          find . portable/MemMang/* portable/Common/* \( -name portable \) -prune -false -o -iname "*.[hc]" -exec uncrustify --check -c .github/uncrustify.cfg {} +
47      - name: Check For Trailing Whitespace
48        run: |
49          set +e
50          grep --exclude="*.md" --exclude-dir=".git"  -rnI -e "[[:blank:]]$" .
51          if [ "$?" = "0" ]; then
52            echo "Files have trailing whitespace."
53            exit 1
54          else
55            exit 0
56          fi
57        shell: bash
58      - name: Check for CRLF
59        working-directory: ${{ inputs.path }}
60        run: |
61          set +e
62          find . -path ./.git -prune -o -exec file {} + |  grep "CRLF"
63          if [ "$?" = "0" ]; then
64            echo "Files have CRLF line endings."
65            exit 1
66          else
67            exit 0
68          fi
69        shell: bash
70
71  url-check:
72    runs-on: ubuntu-latest
73    steps:
74      - name: Clone This Repo
75        uses: actions/checkout@v2
76        with:
77            path: ./kernel
78      - name: URL Checker
79        run: |
80            bash kernel/.github/actions/url_verifier.sh kernel
81