ci.yml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. name: Continuous Integration
  2. on: [push, pull_request]
  3. jobs:
  4. clang-format:
  5. name: Clang-Format
  6. runs-on: ubuntu-20.04
  7. steps:
  8. - name: Install
  9. run: sudo apt-get install -y clang-format
  10. - name: Checkout
  11. uses: actions/checkout@v2
  12. - name: Format
  13. run: find src/ extras/ -name '*.[ch]pp' | xargs clang-format -i --verbose --style=file
  14. - name: Diff
  15. run: git diff --exit-code
  16. gcc:
  17. name: GCC
  18. needs: clang-format
  19. runs-on: ubuntu-20.04
  20. strategy:
  21. fail-fast: false
  22. matrix:
  23. include:
  24. - gcc: "4.4"
  25. - gcc: "4.6"
  26. - gcc: "4.7"
  27. - gcc: "4.8"
  28. - gcc: "4.9"
  29. - gcc: "5"
  30. - gcc: "6"
  31. - gcc: "7"
  32. cxxflags: -fsanitize=leak -fno-sanitize-recover=all
  33. - gcc: "8"
  34. cxxflags: -fsanitize=undefined -fno-sanitize-recover=all
  35. - gcc: "9"
  36. cxxflags: -fsanitize=address -fno-sanitize-recover=all
  37. - gcc: "10"
  38. steps:
  39. - name: Install
  40. run: |
  41. sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ trusty main'
  42. sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ trusty universe'
  43. sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ xenial main'
  44. sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ xenial universe'
  45. sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ bionic main'
  46. sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ bionic universe'
  47. sudo apt-get update
  48. sudo apt-get install -y gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }}
  49. - name: Checkout
  50. uses: actions/checkout@v2
  51. - name: Configure
  52. run: cmake -DCMAKE_BUILD_TYPE=Debug .
  53. env:
  54. CC: gcc-${{ matrix.gcc }}
  55. CXX: g++-${{ matrix.gcc }}
  56. CXXFLAGS: ${{ matrix.cxxflags }}
  57. - name: Build
  58. run: cmake --build .
  59. - name: Test
  60. run: ctest --output-on-failure -C Debug .
  61. env:
  62. UBSAN_OPTIONS: print_stacktrace=1
  63. clang:
  64. name: Clang
  65. needs: clang-format
  66. runs-on: ubuntu-20.04
  67. strategy:
  68. fail-fast: false
  69. matrix:
  70. include:
  71. - clang: "3.5"
  72. cxxflags: "-stdlib=libc++"
  73. - clang: "3.6"
  74. cxxflags: "-stdlib=libc++"
  75. - clang: "3.7"
  76. cxxflags: "-stdlib=libc++"
  77. - clang: "3.8"
  78. cxxflags: "-stdlib=libc++"
  79. - clang: "3.9"
  80. cxxflags: "-stdlib=libc++"
  81. - clang: "4.0"
  82. cxxflags: "-stdlib=libc++"
  83. - clang: "5.0"
  84. - clang: "6.0"
  85. - clang: "7"
  86. - clang: "8"
  87. cxxflags: -fsanitize=leak -fno-sanitize-recover=all
  88. - clang: "9"
  89. cxxflags: -fsanitize=undefined -fno-sanitize-recover=all
  90. - clang: "10"
  91. cxxflags: -fsanitize=address -fno-sanitize-recover=all
  92. steps:
  93. - name: Install
  94. run: |
  95. sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ trusty main'
  96. sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ trusty universe'
  97. sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ xenial main'
  98. sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ xenial universe'
  99. sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ bionic main'
  100. sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ bionic universe'
  101. sudo apt-get update
  102. sudo apt-get install -y clang-${{ matrix.clang }}
  103. - name: Checkout
  104. uses: actions/checkout@v2
  105. - name: Configure
  106. run: cmake -DCMAKE_BUILD_TYPE=Debug .
  107. env:
  108. CC: clang-${{ matrix.clang }}
  109. CXX: clang++-${{ matrix.clang }}
  110. CXXFLAGS: >-
  111. ${{ matrix.cxxflags }}
  112. ${{ contains(matrix.cxxflags, 'libc++') && '-I/usr/lib/llvm-10/include/c++/v1/' || '' }}
  113. - name: Build
  114. run: cmake --build .
  115. - name: Test
  116. run: ctest --output-on-failure -C Debug .
  117. env:
  118. UBSAN_OPTIONS: print_stacktrace=1
  119. xcode:
  120. name: XCode
  121. needs: clang
  122. runs-on: macos-10.15
  123. strategy:
  124. fail-fast: false
  125. matrix:
  126. include:
  127. - xcode: "10.3"
  128. - xcode: "11.7"
  129. - xcode: "12.4"
  130. steps:
  131. - name: Checkout
  132. uses: actions/checkout@v2
  133. - name: Select XCode version
  134. run: sudo xcode-select --switch /Applications/Xcode_${{ matrix.xcode }}.app
  135. - name: Configure
  136. run: cmake -DCMAKE_BUILD_TYPE=Debug .
  137. - name: Build
  138. run: cmake --build .
  139. - name: Test
  140. run: ctest --output-on-failure -C Debug .
  141. # DISABLED: Running on AppVeyor instead because it supports older versions of the compiler
  142. # msvc:
  143. # name: Visual Studio
  144. # strategy:
  145. # fail-fast: false
  146. # matrix:
  147. # include:
  148. # - os: windows-2016
  149. # - os: windows-2019
  150. # runs-on: ${{ matrix.os }}
  151. # steps:
  152. # - name: Checkout
  153. # uses: actions/checkout@v2
  154. # - name: Configure
  155. # run: cmake -DCMAKE_BUILD_TYPE=Debug .
  156. # - name: Build
  157. # run: cmake --build .
  158. # - name: Test
  159. # run: ctest --output-on-failure -C Debug .
  160. arduino:
  161. name: Arduino
  162. needs: gcc
  163. strategy:
  164. fail-fast: false
  165. matrix:
  166. include:
  167. - arduino: "1.6.7"
  168. os: ubuntu-18.04 # java.lang.Error: Cannot load com.sun.java.swing.plaf.gtk.GTKLookAndFeel
  169. board: arduino:avr:uno
  170. - arduino: "1.8.2"
  171. board: arduino:samd:mkr1000
  172. runs-on: ${{ matrix.os || 'ubuntu-latest' }}
  173. steps:
  174. - name: Checkout
  175. uses: actions/checkout@v2
  176. - name: Build
  177. run: extras/ci/arduino.sh ${{ matrix.board }}
  178. env:
  179. BOARD: ${{ matrix.board }}
  180. VERSION: ${{ matrix.arduino }}
  181. platformio:
  182. name: PlatformIO
  183. needs: gcc
  184. runs-on: ubuntu-latest
  185. strategy:
  186. fail-fast: false
  187. matrix:
  188. include:
  189. - platform: atmelavr
  190. board: leonardo
  191. libraries:
  192. - SD
  193. - Ethernet
  194. - platform: espressif8266
  195. board: huzzah
  196. - platform: espressif32
  197. board: esp32dev
  198. libraries:
  199. - Ethernet
  200. - platform: atmelsam
  201. board: mkr1000USB
  202. libraries:
  203. - SD
  204. - Ethernet
  205. - platform: teensy
  206. board: teensy31
  207. - platform: ststm32
  208. board: adafruit_feather_f405
  209. libraries:
  210. - SD
  211. - Ethernet
  212. - platform: nordicnrf52
  213. board: adafruit_feather_nrf52840
  214. libraries:
  215. - SD
  216. - Ethernet
  217. steps:
  218. - name: Checkout
  219. uses: actions/checkout@v2
  220. - name: Set up cache for pip
  221. uses: actions/cache@v2
  222. with:
  223. path: ~/.cache/pip
  224. key: ${{ runner.os }}-pip
  225. - name: Set up Python 3.x
  226. uses: actions/setup-python@v2
  227. with:
  228. python-version: "3.x"
  229. - name: Install PlatformIO
  230. run: pip install platformio
  231. - name: Install adafruit-nrfutil
  232. if: ${{ matrix.platform == 'nordicnrf52' }}
  233. run: pip install adafruit-nrfutil
  234. - name: Set up cache for platformio
  235. uses: actions/cache@v2
  236. with:
  237. path: ~/.platformio
  238. key: ${{ runner.os }}-platformio-${{ matrix.platform }}
  239. - name: Install platform "${{ matrix.platform }}"
  240. run: platformio platform install ${{ matrix.platform }}
  241. - name: Install libraries
  242. if: ${{ matrix.libraries }}
  243. run: platformio lib install arduino-libraries/${{ join(matrix.libraries, ' arduino-libraries/') }}
  244. - name: Build JsonConfigFile
  245. run: platformio ci "examples/JsonConfigFile/JsonConfigFile.ino" -l '.' -b ${{ matrix.board }}
  246. - name: Build JsonFilterExample
  247. run: platformio ci "examples/JsonFilterExample/JsonFilterExample.ino" -l '.' -b ${{ matrix.board }}
  248. - name: Build JsonGeneratorExample
  249. run: platformio ci "examples/JsonGeneratorExample/JsonGeneratorExample.ino" -l '.' -b ${{ matrix.board }}
  250. - name: Build JsonHttpClient
  251. run: platformio ci "examples/JsonHttpClient/JsonHttpClient.ino" -l '.' -b ${{ matrix.board }}
  252. - name: Build JsonParserExample
  253. run: platformio ci "examples/JsonParserExample/JsonParserExample.ino" -l '.' -b ${{ matrix.board }}
  254. - name: Build JsonServer
  255. if: ${{ matrix.platform != 'espressif32' }}
  256. run: platformio ci "examples/JsonServer/JsonServer.ino" -l '.' -b ${{ matrix.board }}
  257. - name: Build JsonUdpBeacon
  258. run: platformio ci "examples/JsonUdpBeacon/JsonUdpBeacon.ino" -l '.' -b ${{ matrix.board }}
  259. - name: Build MsgPackParser
  260. run: platformio ci "examples/MsgPackParser/MsgPackParser.ino" -l '.' -b ${{ matrix.board }}
  261. - name: Build ProgmemExample
  262. run: platformio ci "examples/ProgmemExample/ProgmemExample.ino" -l '.' -b ${{ matrix.board }}
  263. - name: Build StringExample
  264. run: platformio ci "examples/StringExample/StringExample.ino" -l '.' -b ${{ matrix.board }}
  265. - name: PlatformIO prune
  266. if: ${{ always() }}
  267. run: platformio system prune -f
  268. particle:
  269. name: Particle
  270. needs: gcc
  271. runs-on: ubuntu-latest
  272. if: github.event_name == 'push'
  273. strategy:
  274. fail-fast: false
  275. matrix:
  276. include:
  277. - board: argon
  278. steps:
  279. - name: Checkout
  280. uses: actions/checkout@v2
  281. - name: Install Particle CLI
  282. run: sudo npm install -g particle-cli
  283. - name: Login to Particle
  284. run: particle login -t "${{ secrets.PARTICLE_TOKEN }}"
  285. - name: Compile
  286. run: extras/ci/particle.sh ${{ matrix.board }}
  287. arm:
  288. name: GCC for ARM processor
  289. needs: gcc
  290. runs-on: ubuntu-20.04
  291. steps:
  292. - name: Install
  293. run: sudo apt-get install -y g++-arm-linux-gnueabihf
  294. - name: Checkout
  295. uses: actions/checkout@v2
  296. - name: Configure
  297. run: cmake .
  298. env:
  299. CC: arm-linux-gnueabihf-gcc
  300. CXX: arm-linux-gnueabihf-g++
  301. - name: Build
  302. run: cmake --build .
  303. coverage:
  304. needs: gcc
  305. name: Coverage
  306. runs-on: ubuntu-20.04
  307. steps:
  308. - name: Install
  309. run: sudo apt-get install -y lcov ninja-build
  310. - name: Checkout
  311. uses: actions/checkout@v2
  312. - name: Configure
  313. run: cmake -G Ninja -DCOVERAGE=true .
  314. - name: Build
  315. run: ninja
  316. - name: Test
  317. run: ctest -LE 'WillFail|Fuzzing' -T test
  318. - name: lcov --capture
  319. run: lcov --capture --no-external --directory . --output-file coverage.info
  320. - name: lcov --remove
  321. run: lcov --remove coverage.info "$(pwd)/extras/*" --output-file coverage_filtered.info
  322. - name: genhtml
  323. run: mkdir coverage && genhtml coverage_filtered.info -o coverage -t ArduinoJson
  324. - name: Upload HTML report
  325. uses: actions/upload-artifact@v2
  326. with:
  327. name: coverage
  328. path: coverage
  329. - name: Upload to Coveralls
  330. uses: coverallsapp/github-action@master
  331. with:
  332. github-token: ${{ secrets.GITHUB_TOKEN }}
  333. path-to-lcov: coverage_filtered.info
  334. valgrind:
  335. needs: gcc
  336. name: Valgrind
  337. runs-on: ubuntu-20.04
  338. steps:
  339. - name: Install
  340. run: sudo apt-get install -y valgrind ninja-build
  341. - name: Checkout
  342. uses: actions/checkout@v2
  343. - name: Configure
  344. run: cmake -G Ninja -D MEMORYCHECK_COMMAND_OPTIONS="--error-exitcode=1 --leak-check=full" .
  345. - name: Build
  346. run: ninja
  347. - name: Memcheck
  348. run: ctest -LE WillFail -T memcheck
  349. id: memcheck
  350. - name: MemoryChecker.*.log
  351. run: cat Testing/Temporary/MemoryChecker.*.log
  352. if: failure()
  353. clang-tidy:
  354. needs: clang
  355. name: Clang-Tidy
  356. runs-on: ubuntu-20.04
  357. steps:
  358. - name: Install
  359. run: sudo apt-get install -y clang-tidy cmake ninja-build
  360. - name: Checkout
  361. uses: actions/checkout@v2
  362. - name: Configure
  363. run: cmake -G Ninja -DCMAKE_CXX_CLANG_TIDY="clang-tidy-10;--warnings-as-errors=*" -DCMAKE_BUILD_TYPE=Debug .
  364. env:
  365. CC: clang-10
  366. CXX: clang++-10
  367. - name: Check
  368. run: cmake --build . -- -k 0