1name: CI Checks
2
3on:
4  push:
5    branches: ["**"]
6  pull_request:
7    branches: ["**"]
8  workflow_dispatch:
9
10jobs:
11  unittest:
12    runs-on: ubuntu-latest
13    steps:
14      - name: Clone This Repo
15        uses: actions/checkout@v2
16        with:
17          submodules: recursive
18      - name: Build
19        run: |
20          git submodule update --checkout
21          cd tools/CMock
22          git submodule update --init vendor/unity
23          cd ../..
24          sudo apt-get install -y lcov
25          sudo apt-get install -y unifdef
26          cmake -S test/unit-test -B test/unit-test/build/
27          make -C test/unit-test/build/ all
28      - name: Test
29        run: |
30          cd test/unit-test/build/
31          ctest -E system --output-on-failure
32          cd ..
33      - name: Coverage
34        run: |
35          make -C test/unit-test/build/ coverage
36          lcov --list --rc lcov_branch_coverage=1 test/unit-test/build/coverage.info
37      - name: Check Coverage
38        uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@main
39        with:
40          path: ./test/unit-test/build/coverage.info
41
42  spell-check:
43    runs-on: ubuntu-latest
44    steps:
45      - name: Checkout Parent Repo
46        uses: actions/checkout@v2
47        with:
48          ref: main
49          repository: aws/aws-iot-device-sdk-embedded-C
50          path: main
51      - name: Clone This Repo
52        uses: actions/checkout@v2
53        with:
54          path: ./tcp
55      - name: Install spell
56        run: |
57          sudo apt-get install spell
58          sudo apt-get install util-linux
59      - name: Check spelling
60        run: |
61          PATH=$PATH:main/tools/spell
62          # Make sure that the portable directory is not included in the spellcheck.
63          sed -i 's/find $DIRNAME/find $DIRNAME -not -path '*portable*'/g' main/tools/spell/find-unknown-comment-words
64          find-unknown-comment-words --directory tcp/ --lexicon tcp/lexicon.txt
65          if [ "$?" = "0" ]; then
66            exit 0
67          else
68            exit 1
69          fi
70
71  formatting:
72    runs-on: ubuntu-20.04
73    steps:
74      - uses: actions/checkout@v2
75      - name: Check formatting
76        uses: FreeRTOS/CI-CD-Github-Actions/formatting@main
77        with:
78          path: ./
79
80  doxygen:
81    runs-on: ubuntu-latest
82    steps:
83      - uses: actions/checkout@v2
84      - name: Run doxygen build
85        uses: FreeRTOS/CI-CD-Github-Actions/doxygen@main
86        with:
87          path: ./
88
89  build-checks:
90    runs-on: ubuntu-latest
91    steps:
92      - uses: actions/checkout@v2
93      - name: Build Install Dependencies
94        run: |
95          sudo apt-get install -y libpcap-dev
96      - name: Build checks (Enable all functionalities)
97        run: |
98          cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL
99          cmake --build build --target freertos_plus_tcp_build_test
100      - name: Build checks (Enable all functionalities IPv4)
101        run: |
102          cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL_IPV4
103          cmake --build build --target clean
104          cmake --build build --target freertos_plus_tcp_build_test
105      - name: Build checks (Enable all functionalities IPv6)
106        run: |
107          cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL_IPV6
108          cmake --build build --target freertos_plus_tcp_build_test
109      - name: Build checks (Enable all functionalities IPv4 IPv6)
110        run: |
111          cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL_IPV4_IPV6
112          cmake --build build --target clean
113          cmake --build build --target freertos_plus_tcp_build_test
114      - name: Build checks (Enable all functionalities IPv4 TCP)
115        run: |
116          cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL_IPV4_TCP
117          cmake --build build --target clean
118          cmake --build build --target freertos_plus_tcp_build_test
119      - name: Build checks (Enable all functionalities IPv6 TCP)
120        run: |
121          cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=ENABLE_ALL_IPV6_TCP
122          cmake --build build --target freertos_plus_tcp_build_test
123      - name: Build checks (Disable all functionalities)
124        run: |
125          cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DISABLE_ALL
126          cmake --build build --target clean
127          cmake --build build --target freertos_plus_tcp_build_test
128      - name: Build checks (Default configuration)
129        run: |
130          cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DEFAULT_CONF
131          cmake --build build --target clean
132          cmake --build build --target freertos_plus_tcp_build_test
133      - name: Build checks (Header Self Contain)
134        run: |
135          cmake -S . -B build -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=HEADER_SELF_CONTAIN
136          cmake --build build --target clean
137          cmake --build build --target freertos_plus_tcp_build_test_FreeRTOS_DHCP
138          cmake --build build --target freertos_plus_tcp_build_test_FreeRTOS_DNS
139          cmake --build build --target freertos_plus_tcp_build_test_FreeRTOS_IP
140          cmake --build build --target freertos_plus_tcp_build_test_FreeRTOS_ND
141          cmake --build build --target freertos_plus_tcp_build_test_FreeRTOS_Routing
142          cmake --build build --target freertos_plus_tcp_build_test_FreeRTOS_Sockets
143          cmake --build build --target freertos_plus_tcp_build_test_NetworkBufferManagement
144          cmake --build build --target freertos_plus_tcp_build_test_NetworkInterface
145
146  complexity:
147    runs-on: ubuntu-latest
148    steps:
149      - uses: actions/checkout@v2
150      - name: Setup
151        run: sudo apt-get install complexity
152      - name: Install Uncrustify
153        run: sudo apt-get install uncrustify
154      - name: Complexity
155        run: |
156          COMPLEXITY_PARAMS="--scores --threshold=10 --horrid-threshold=283"
157          TEMP_DIR=./temp
158          mkdir -p ${TEMP_DIR}
159          for SOURCE_FILE in source/portable/BufferManagement/*.c source/*.c
160          do
161              TARGET_DIR=${TEMP_DIR}/`dirname ${SOURCE_FILE}`
162              TARGET_FILE=${TARGET_DIR}/`basename ${SOURCE_FILE}`
163              mkdir -p ${TARGET_DIR}
164              uncrustify -c tools/uncrustify.complexity.cfg -f ${SOURCE_FILE} > ${TARGET_FILE}
165          done
166          find ${TEMP_DIR} -iname '*.c' | xargs complexity ${COMPLEXITY_PARAMS}
167          RESULT=$?
168          rm -rf ${TEMP_DIR}
169          if [ "${RESULT}" = "0" ]; then
170              echo "All is good."
171              exit 0
172          else
173              echo "Sources are too complex, rc = " ${RESULT}
174              exit 1
175          fi
176
177  git-secrets:
178    runs-on: ubuntu-latest
179    steps:
180      - uses: actions/checkout@v2
181        with:
182          submodules: recursive
183      - name: Checkout awslabs/git-secrets
184        uses: actions/checkout@v2
185        with:
186          repository: awslabs/git-secrets
187          ref: master
188          path: git-secrets
189      - name: Install git-secrets
190        run: cd git-secrets && sudo make install && cd ..
191      - name: Run git-secrets
192        run: |
193          git-secrets --register-aws
194          git-secrets --scan
195  proof_ci:
196    runs-on: cbmc_ubuntu-latest_16-core
197    steps:
198      - name: Set up CBMC runner
199        uses: FreeRTOS/CI-CD-Github-Actions/set_up_cbmc_runner@main
200        with:
201          cbmc_version: "5.61.0"
202      - run: |
203          git submodule update --init --checkout --recursive
204          sudo apt-get update
205          sudo apt-get install --yes --no-install-recommends gcc-multilib
206      - name: Run CBMC
207        uses: FreeRTOS/CI-CD-Github-Actions/run_cbmc@main
208        with:
209          proofs_dir: test/cbmc/proofs
210