ci.yml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. name: Continuous Integration
  2. on: [push, pull_request]
  3. jobs:
  4. lint:
  5. name: Lint
  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@v3
  12. - name: Symlinks
  13. run: find * -type l -printf "::error::%p is a symlink. This is forbidden by the Arduino Library Specification." -exec false {} +
  14. - name: Clang-format
  15. run: |
  16. find src/ extras/ -name '*.[ch]pp' | xargs clang-format -i --verbose --style=file
  17. git diff --exit-code
  18. - name: Check URLs
  19. run: |
  20. grep -hREo "(http|https)://[a-zA-Z0-9./?=_%:-]*" src/ | sort -u | while read -r URL
  21. do
  22. STATUS=$(curl -s -o /dev/null -I -w "%{http_code}" "$URL")
  23. [ "$STATUS" -ge 400 ] && echo "::warning title=HTTP $STATUS::$URL returned $STATUS"
  24. done || true
  25. gcc:
  26. name: GCC
  27. needs: lint
  28. runs-on: ubuntu-22.04
  29. strategy:
  30. fail-fast: false
  31. matrix:
  32. include:
  33. - gcc: "4.8"
  34. - gcc: "5"
  35. - gcc: "6"
  36. - gcc: "7"
  37. cxxflags: -fsanitize=leak -fno-sanitize-recover=all
  38. - gcc: "8"
  39. cxxflags: -fsanitize=undefined -fno-sanitize-recover=all
  40. - gcc: "9"
  41. cxxflags: -fsanitize=address -fno-sanitize-recover=all
  42. - gcc: "10"
  43. cxxflags: -funsigned-char # Issue #1715
  44. - gcc: "11"
  45. - gcc: "12"
  46. steps:
  47. - name: Install
  48. run: |
  49. sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5 3B4FE6ACC0B21F32
  50. sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ xenial main universe'
  51. sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ bionic main universe'
  52. sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ focal main universe'
  53. sudo apt-get update
  54. sudo apt-get install -y gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }}
  55. - name: Checkout
  56. uses: actions/checkout@v3
  57. - name: Configure
  58. run: cmake -DCMAKE_BUILD_TYPE=Debug .
  59. env:
  60. CC: gcc-${{ matrix.gcc }}
  61. CXX: g++-${{ matrix.gcc }}
  62. CXXFLAGS: ${{ matrix.cxxflags }}
  63. - name: Build
  64. run: cmake --build .
  65. - name: Test
  66. run: |
  67. echo "## CTest output" >> $GITHUB_STEP_SUMMARY
  68. echo '```' >> $GITHUB_STEP_SUMMARY
  69. ctest --output-on-failure -C Debug . | tee -a $GITHUB_STEP_SUMMARY
  70. echo '```' >> $GITHUB_STEP_SUMMARY
  71. env:
  72. UBSAN_OPTIONS: print_stacktrace=1
  73. clang:
  74. name: Clang
  75. needs: lint
  76. strategy:
  77. fail-fast: false
  78. matrix:
  79. include:
  80. - clang: "3.9"
  81. runner: ubuntu-20.04
  82. archive: bionic
  83. - clang: "4.0"
  84. runner: ubuntu-20.04
  85. archive: bionic
  86. - clang: "5.0"
  87. runner: ubuntu-20.04
  88. archive: bionic
  89. - clang: "6.0"
  90. runner: ubuntu-20.04
  91. archive: bionic
  92. - clang: "7"
  93. runner: ubuntu-20.04
  94. - clang: "8"
  95. cxxflags: -fsanitize=leak -fno-sanitize-recover=all
  96. runner: ubuntu-20.04
  97. - clang: "9"
  98. cxxflags: -fsanitize=undefined -fno-sanitize-recover=all
  99. runner: ubuntu-20.04
  100. - clang: "10"
  101. cxxflags: -fsanitize=address -fno-sanitize-recover=all
  102. runner: ubuntu-20.04
  103. - clang: "11"
  104. runner: ubuntu-22.04
  105. - clang: "12"
  106. runner: ubuntu-22.04
  107. - clang: "13"
  108. runner: ubuntu-22.04
  109. - clang: "14"
  110. runner: ubuntu-22.04
  111. - clang: "15"
  112. runner: ubuntu-22.04
  113. runs-on: ${{ matrix.runner }}
  114. steps:
  115. - name: Add archive repositories
  116. if: matrix.archive
  117. run: |
  118. sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ ${{ matrix.archive }} main'
  119. sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ ${{ matrix.archive }} universe'
  120. - name: Install Clang ${{ matrix.clang }}
  121. run: |
  122. sudo apt-get update
  123. sudo apt-get install -y clang-${{ matrix.clang }}
  124. - name: Install libc++ ${{ matrix.clang }}
  125. if: matrix.clang >= 11
  126. run: sudo apt-get install -y libc++-${{ matrix.clang }}-dev libc++abi-${{ matrix.clang }}-dev
  127. - name: Install libunwind ${{ matrix.clang }}
  128. if: matrix.clang == 12 # dependency is missing in Ubuntu 22.04
  129. run: sudo apt-get install -y libunwind-${{ matrix.clang }}-dev
  130. - name: Checkout
  131. uses: actions/checkout@v3
  132. - name: Configure
  133. run: cmake -DCMAKE_BUILD_TYPE=Debug .
  134. env:
  135. CC: clang-${{ matrix.clang }}
  136. CXX: clang++-${{ matrix.clang }}
  137. CXXFLAGS: >-
  138. ${{ matrix.cxxflags }}
  139. ${{ matrix.clang < 11 && '-I/usr/lib/llvm-10/include/c++/v1/' || '' }}
  140. - name: Build
  141. run: cmake --build .
  142. - name: Test
  143. run: |
  144. echo "## CTest output" >> $GITHUB_STEP_SUMMARY
  145. echo '```' >> $GITHUB_STEP_SUMMARY
  146. ctest --output-on-failure -C Debug . | tee -a $GITHUB_STEP_SUMMARY
  147. echo '```' >> $GITHUB_STEP_SUMMARY
  148. env:
  149. UBSAN_OPTIONS: print_stacktrace=1
  150. conf_test:
  151. name: Test configuration on Linux
  152. needs: [gcc, clang]
  153. runs-on: ubuntu-20.04
  154. steps:
  155. - name: Install
  156. run: |
  157. sudo apt-get update
  158. sudo apt-get install -y g++-multilib gcc-avr avr-libc
  159. - name: Checkout
  160. uses: actions/checkout@v3
  161. - name: AVR
  162. run: avr-g++ -std=c++11 -Isrc extras/conf_test/avr.cpp
  163. - name: GCC 32-bit
  164. run: g++ -std=c++11 -m32 -Isrc extras/conf_test/x86.cpp
  165. - name: GCC 64-bit
  166. run: g++ -std=c++11 -m64 -Isrc extras/conf_test/x64.cpp
  167. - name: Clang 32-bit
  168. run: clang++ -std=c++11 -m32 -Isrc extras/conf_test/x86.cpp
  169. - name: Clang 64-bit
  170. run: clang++ -std=c++11 -m64 -Isrc extras/conf_test/x64.cpp
  171. conf_test_windows:
  172. name: Test configuration on Windows
  173. runs-on: windows-2019
  174. needs: [gcc, clang]
  175. steps:
  176. - name: Checkout
  177. uses: actions/checkout@v3
  178. - name: 32-bit
  179. run: |
  180. call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
  181. cl /Isrc extras/conf_test/x86.cpp
  182. shell: cmd
  183. - name: 64-bit
  184. run: |
  185. call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
  186. cl /Isrc extras/conf_test/x64.cpp
  187. shell: cmd
  188. xcode:
  189. name: XCode
  190. needs: clang
  191. runs-on: macos-11
  192. strategy:
  193. fail-fast: false
  194. matrix:
  195. include:
  196. - xcode: "11.7"
  197. - xcode: "12.4"
  198. - xcode: "13.2.1"
  199. steps:
  200. - name: Checkout
  201. uses: actions/checkout@v3
  202. - name: Select XCode version
  203. run: sudo xcode-select --switch /Applications/Xcode_${{ matrix.xcode }}.app
  204. - name: Configure
  205. run: cmake -DCMAKE_BUILD_TYPE=Debug .
  206. - name: Build
  207. run: cmake --build .
  208. - name: Test
  209. run: ctest --output-on-failure -C Debug .
  210. # DISABLED: Running on AppVeyor instead because it supports older versions of the compiler
  211. # msvc:
  212. # name: Visual Studio
  213. # strategy:
  214. # fail-fast: false
  215. # matrix:
  216. # include:
  217. # - os: windows-2016
  218. # - os: windows-2019
  219. # runs-on: ${{ matrix.os }}
  220. # steps:
  221. # - name: Checkout
  222. # uses: actions/checkout@v3
  223. # - name: Configure
  224. # run: cmake -DCMAKE_BUILD_TYPE=Debug .
  225. # - name: Build
  226. # run: cmake --build .
  227. # - name: Test
  228. # run: ctest --output-on-failure -C Debug .
  229. arduino:
  230. name: Arduino
  231. needs: gcc
  232. strategy:
  233. fail-fast: false
  234. matrix:
  235. include:
  236. - core: arduino:avr
  237. board: arduino:avr:uno
  238. - core: arduino:samd
  239. board: arduino:samd:mkr1000
  240. runs-on: ubuntu-20.04
  241. steps:
  242. - name: Checkout
  243. uses: actions/checkout@v3
  244. - name: Install arduino-cli
  245. run: curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=/usr/local/bin sh
  246. - name: Install core
  247. run: arduino-cli core install ${{ matrix.core }}
  248. - name: Install libraries
  249. run: arduino-cli lib install SD Ethernet
  250. - name: Build JsonConfigFile
  251. run: arduino-cli compile --library . --warnings all -b ${{ matrix.board }} "examples/JsonConfigFile/JsonConfigFile.ino"
  252. - name: Build JsonFilterExample
  253. run: arduino-cli compile --library . --warnings all -b ${{ matrix.board }} "examples/JsonFilterExample/JsonFilterExample.ino"
  254. - name: Build JsonGeneratorExample
  255. run: arduino-cli compile --library . --warnings all -b ${{ matrix.board }} "examples/JsonGeneratorExample/JsonGeneratorExample.ino"
  256. - name: Build JsonHttpClient
  257. run: arduino-cli compile --library . --warnings all -b ${{ matrix.board }} "examples/JsonHttpClient/JsonHttpClient.ino"
  258. - name: Build JsonParserExample
  259. run: arduino-cli compile --library . --warnings all -b ${{ matrix.board }} "examples/JsonParserExample/JsonParserExample.ino"
  260. - name: Build JsonServer
  261. run: arduino-cli compile --library . --warnings all -b ${{ matrix.board }} "examples/JsonServer/JsonServer.ino"
  262. - name: Build JsonUdpBeacon
  263. run: arduino-cli compile --library . --warnings all -b ${{ matrix.board }} "examples/JsonUdpBeacon/JsonUdpBeacon.ino"
  264. - name: Build MsgPackParser
  265. run: arduino-cli compile --library . --warnings all -b ${{ matrix.board }} "examples/MsgPackParser/MsgPackParser.ino"
  266. - name: Build ProgmemExample
  267. run: arduino-cli compile --library . --warnings all -b ${{ matrix.board }} "examples/ProgmemExample/ProgmemExample.ino"
  268. - name: Build StringExample
  269. run: arduino-cli compile --library . --warnings all -b ${{ matrix.board }} "examples/StringExample/StringExample.ino"
  270. platformio:
  271. name: PlatformIO
  272. needs: gcc
  273. runs-on: ubuntu-latest
  274. strategy:
  275. fail-fast: false
  276. matrix:
  277. include:
  278. - platform: atmelavr
  279. board: leonardo
  280. libraries:
  281. - SD
  282. - Ethernet
  283. conf_test: avr
  284. - platform: espressif8266
  285. board: huzzah
  286. conf_test: esp8266
  287. - platform: espressif32
  288. board: esp32dev
  289. libraries:
  290. - Ethernet
  291. conf_test: esp8266
  292. - platform: atmelsam
  293. board: mkr1000USB
  294. libraries:
  295. - SD
  296. - Ethernet
  297. conf_test: esp8266
  298. - platform: teensy
  299. board: teensy31
  300. conf_test: esp8266
  301. - platform: ststm32
  302. board: adafruit_feather_f405
  303. libraries:
  304. - SD
  305. - Ethernet
  306. conf_test: esp8266
  307. - platform: nordicnrf52
  308. board: adafruit_feather_nrf52840
  309. libraries:
  310. - SD
  311. - Ethernet
  312. conf_test: esp8266
  313. steps:
  314. - name: Checkout
  315. uses: actions/checkout@v3
  316. - name: Set up cache for pip
  317. uses: actions/cache@v3
  318. with:
  319. path: ~/.cache/pip
  320. key: ${{ runner.os }}-pip
  321. - name: Set up Python 3.x
  322. uses: actions/setup-python@v4
  323. with:
  324. python-version: "3.x"
  325. - name: Install PlatformIO
  326. run: pip install platformio
  327. - name: Install adafruit-nrfutil
  328. if: ${{ matrix.platform == 'nordicnrf52' }}
  329. run: pip install adafruit-nrfutil
  330. - name: Include Adafruit_TinyUSB.h # https://github.com/adafruit/Adafruit_nRF52_Arduino/issues/653
  331. if: ${{ matrix.platform == 'nordicnrf52' }}
  332. run: find examples/ -name '*.ino' -exec sed -i 's/\(#include <ArduinoJson.h>\)/\1\n#include <Adafruit_TinyUSB.h>/' {} +
  333. - name: Set up cache for platformio
  334. uses: actions/cache@v3
  335. with:
  336. path: ~/.platformio
  337. key: ${{ runner.os }}-platformio-${{ matrix.platform }}
  338. - name: Install platform "${{ matrix.platform }}"
  339. run: platformio platform install ${{ matrix.platform }}
  340. - name: Install libraries
  341. if: ${{ matrix.libraries }}
  342. run: platformio lib install arduino-libraries/${{ join(matrix.libraries, ' arduino-libraries/') }}
  343. - name: Test configuration
  344. run: platformio ci "extras/conf_test/${{ matrix.conf_test }}.cpp" -l '.' -b ${{ matrix.board }}
  345. if: ${{ matrix.conf_test }}
  346. - name: Build JsonConfigFile
  347. run: platformio ci "examples/JsonConfigFile/JsonConfigFile.ino" -l '.' -b ${{ matrix.board }}
  348. - name: Build JsonFilterExample
  349. run: platformio ci "examples/JsonFilterExample/JsonFilterExample.ino" -l '.' -b ${{ matrix.board }}
  350. - name: Build JsonGeneratorExample
  351. run: platformio ci "examples/JsonGeneratorExample/JsonGeneratorExample.ino" -l '.' -b ${{ matrix.board }}
  352. - name: Build JsonHttpClient
  353. run: platformio ci "examples/JsonHttpClient/JsonHttpClient.ino" -l '.' -b ${{ matrix.board }}
  354. - name: Build JsonParserExample
  355. run: platformio ci "examples/JsonParserExample/JsonParserExample.ino" -l '.' -b ${{ matrix.board }}
  356. - name: Build JsonServer
  357. if: ${{ matrix.platform != 'espressif32' }}
  358. run: platformio ci "examples/JsonServer/JsonServer.ino" -l '.' -b ${{ matrix.board }}
  359. - name: Build JsonUdpBeacon
  360. run: platformio ci "examples/JsonUdpBeacon/JsonUdpBeacon.ino" -l '.' -b ${{ matrix.board }}
  361. - name: Build MsgPackParser
  362. run: platformio ci "examples/MsgPackParser/MsgPackParser.ino" -l '.' -b ${{ matrix.board }}
  363. - name: Build ProgmemExample
  364. run: platformio ci "examples/ProgmemExample/ProgmemExample.ino" -l '.' -b ${{ matrix.board }}
  365. - name: Build StringExample
  366. run: platformio ci "examples/StringExample/StringExample.ino" -l '.' -b ${{ matrix.board }}
  367. - name: PlatformIO prune
  368. if: ${{ always() }}
  369. run: platformio system prune -f
  370. particle:
  371. name: Particle
  372. needs: gcc
  373. runs-on: ubuntu-latest
  374. if: github.event_name == 'push'
  375. strategy:
  376. fail-fast: false
  377. matrix:
  378. include:
  379. - board: argon
  380. steps:
  381. - name: Checkout
  382. uses: actions/checkout@v3
  383. - name: Install Particle CLI
  384. run: sudo npm install -g particle-cli
  385. - name: Login to Particle
  386. run: particle login -t "${{ secrets.PARTICLE_TOKEN }}"
  387. - name: Compile
  388. run: extras/ci/particle.sh ${{ matrix.board }}
  389. arm:
  390. name: GCC for ARM processor
  391. needs: gcc
  392. runs-on: ubuntu-20.04
  393. steps:
  394. - name: Install
  395. run: |
  396. sudo apt-get update
  397. sudo apt-get install -y g++-arm-linux-gnueabihf
  398. - name: Checkout
  399. uses: actions/checkout@v3
  400. - name: Configure
  401. run: cmake .
  402. env:
  403. CC: arm-linux-gnueabihf-gcc
  404. CXX: arm-linux-gnueabihf-g++
  405. - name: Build
  406. run: cmake --build .
  407. coverage:
  408. needs: gcc
  409. name: Coverage
  410. runs-on: ubuntu-20.04
  411. steps:
  412. - name: Install
  413. run: sudo apt-get install -y lcov ninja-build
  414. - name: Checkout
  415. uses: actions/checkout@v3
  416. - name: Configure
  417. run: cmake -G Ninja -DCOVERAGE=true .
  418. - name: Build
  419. run: ninja
  420. - name: Test
  421. run: ctest --output-on-failure -LE 'WillFail|Fuzzing' -T test
  422. - name: lcov --capture
  423. run: lcov --capture --no-external --directory . --output-file coverage.info
  424. - name: lcov --remove
  425. run: lcov --remove coverage.info "$(pwd)/extras/*" --output-file coverage_filtered.info
  426. - name: genhtml
  427. run: mkdir coverage && genhtml coverage_filtered.info -o coverage -t ArduinoJson
  428. - name: Upload HTML report
  429. uses: actions/upload-artifact@v3
  430. with:
  431. name: Coverage report
  432. path: coverage
  433. - name: Upload to Coveralls
  434. uses: coverallsapp/github-action@master
  435. with:
  436. github-token: ${{ secrets.GITHUB_TOKEN }}
  437. path-to-lcov: coverage_filtered.info
  438. valgrind:
  439. needs: gcc
  440. name: Valgrind
  441. runs-on: ubuntu-20.04
  442. steps:
  443. - name: Install
  444. run: |
  445. sudo apt-get update
  446. sudo apt-get install -y valgrind ninja-build
  447. - name: Checkout
  448. uses: actions/checkout@v3
  449. - name: Configure
  450. run: cmake -G Ninja -D MEMORYCHECK_COMMAND_OPTIONS="--error-exitcode=1 --leak-check=full" .
  451. - name: Build
  452. run: ninja
  453. - name: Memcheck
  454. run: ctest --output-on-failure -LE WillFail -T memcheck
  455. id: memcheck
  456. - name: MemoryChecker.*.log
  457. run: cat Testing/Temporary/MemoryChecker.*.log
  458. if: failure()
  459. clang-tidy:
  460. needs: clang
  461. name: Clang-Tidy
  462. runs-on: ubuntu-20.04
  463. steps:
  464. - name: Install
  465. run: sudo apt-get install -y clang-tidy cmake ninja-build
  466. - name: Checkout
  467. uses: actions/checkout@v3
  468. - name: Configure
  469. run: cmake -G Ninja -DCMAKE_CXX_CLANG_TIDY="clang-tidy-10;--warnings-as-errors=*" -DCMAKE_BUILD_TYPE=Debug .
  470. env:
  471. CC: clang-10
  472. CXX: clang++-10
  473. - name: Check
  474. run: cmake --build . -- -k 0
  475. amalgamate-h:
  476. needs: gcc
  477. name: Amalgamate ArduinoJson.h
  478. runs-on: ubuntu-20.04
  479. steps:
  480. - name: Checkout
  481. uses: actions/checkout@v3
  482. - name: Amalgamate
  483. id: amalgamate
  484. run: |
  485. if [[ $GITHUB_REF == refs/tags/* ]]; then
  486. VERSION=${GITHUB_REF#refs/tags/}
  487. else
  488. VERSION=${GITHUB_SHA::7}
  489. fi
  490. INPUT=src/ArduinoJson.h
  491. OUTPUT=ArduinoJson-$VERSION.h
  492. extras/scripts/build-single-header.sh "$INPUT" "$OUTPUT"
  493. echo "filename=${OUTPUT}" >> $GITHUB_OUTPUT
  494. - name: Smoke test
  495. run: |
  496. g++ -x c++ - <<END
  497. #include "${{ steps.amalgamate.outputs.filename }}"
  498. int main() {
  499. JsonDocument doc;
  500. deserializeJson(doc, "{}");
  501. }
  502. END
  503. - name: Upload artifact
  504. uses: actions/upload-artifact@v3
  505. with:
  506. name: Single headers
  507. path: ${{ steps.amalgamate.outputs.filename }}
  508. amalgamate-hpp:
  509. needs: gcc
  510. name: Amalgamate ArduinoJson.hpp
  511. runs-on: ubuntu-20.04
  512. steps:
  513. - name: Checkout
  514. uses: actions/checkout@v3
  515. - name: Amalgamate
  516. id: amalgamate
  517. run: |
  518. if [[ $GITHUB_REF == refs/tags/* ]]; then
  519. VERSION=${GITHUB_REF#refs/tags/}
  520. else
  521. VERSION=${GITHUB_SHA::7}
  522. fi
  523. INPUT=src/ArduinoJson.hpp
  524. OUTPUT=ArduinoJson-$VERSION.hpp
  525. extras/scripts/build-single-header.sh "$INPUT" "$OUTPUT"
  526. echo "filename=${OUTPUT}" >> $GITHUB_OUTPUT
  527. - name: Smoke test
  528. run: |
  529. g++ -x c++ - <<END
  530. #include "${{ steps.amalgamate.outputs.filename }}"
  531. int main() {
  532. ArduinoJson::JsonDocument doc;
  533. deserializeJson(doc, "{}");
  534. }
  535. END
  536. - name: Upload artifact
  537. uses: actions/upload-artifact@v3
  538. with:
  539. name: Single headers
  540. path: ${{ steps.amalgamate.outputs.filename }}
  541. esp-idf:
  542. needs: gcc
  543. name: ESP-IDF
  544. runs-on: ubuntu-latest
  545. steps:
  546. - name: Setup cache
  547. uses: actions/cache@v3
  548. with:
  549. path: ~/.espressif
  550. key: ${{ runner.os }}-esp-idf
  551. - name: Checkout ArduinoJson
  552. uses: actions/checkout@v3
  553. - name: Checkout ESP-IDF
  554. uses: actions/checkout@v3
  555. with:
  556. repository: espressif/esp-idf
  557. path: esp-idf
  558. submodules: true
  559. - name: Install ESP-IDF
  560. run: ./esp-idf/install.sh
  561. - name: Add component
  562. # NOTE: we cannot commit the symlink because the Arduino Library Specification forbids it.
  563. run: |
  564. mkdir -p extras/ci/espidf/components
  565. ln -s $PWD extras/ci/espidf/components/ArduinoJson
  566. - name: Build example
  567. run: |
  568. source esp-idf/export.sh
  569. cd extras/ci/espidf
  570. idf.py build
  571. codeql:
  572. name: CodeQL
  573. runs-on: ubuntu-20.04
  574. needs: gcc
  575. permissions:
  576. actions: read
  577. contents: read
  578. security-events: write
  579. steps:
  580. - name: Checkout repository
  581. uses: actions/checkout@v3
  582. - name: Initialize CodeQL
  583. uses: github/codeql-action/init@v2
  584. with:
  585. languages: cpp
  586. - name: Build
  587. run: |
  588. cmake -DCMAKE_BUILD_TYPE=Debug .
  589. cmake --build .
  590. - name: Perform CodeQL Analysis
  591. uses: github/codeql-action/analyze@v2
  592. with:
  593. category: "/language:cpp"