Răsfoiți Sursa

CI: added ESP-IDF component build (closes #1599)

Andreas Kuster 4 ani în urmă
părinte
comite
52e856fa6f

+ 26 - 0
.github/workflows/ci.yml

@@ -449,3 +449,29 @@ jobs:
         with:
           name: Single headers
           path: ${{ steps.amalgamate.outputs.filename }}
+
+  esp-idf:
+    needs: gcc
+    name: ESP-IDF
+    runs-on: ubuntu-latest
+    steps:
+      - name: Setup cache
+        uses: actions/cache@v2
+        with:
+          path: ~/.espressif
+          key: ${{ runner.os }}-esp-idf
+      - name: Checkout ArduinoJson
+        uses: actions/checkout@v2
+      - name: Checkout ESP-IDF
+        uses: actions/checkout@v2
+        with:
+          repository: espressif/esp-idf
+          path: esp-idf
+          submodules: true
+      - name: Install ESP-IDF
+        run: ./esp-idf/install.sh
+      - name: Build example
+        run: |
+          source esp-idf/export.sh
+          cd extras/ci/espidf
+          idf.py build

+ 1 - 1
CHANGELOG.md

@@ -13,7 +13,7 @@ HEAD
 * Fixed warning `definition of implicit copy constructor for 'MsgPackDeserializer' is deprecated because it has a user-declared copy assignment operator`
 * Added `JsonArray::clear()` (issue #1597)
 * Fixed `JsonVariant::as<unsigned>()` (issue #1601)
-* Added support for ESP-IDF component build (PR #1562 by @qt1)
+* Added support for ESP-IDF component build (PR #1562 by @qt1, PR #1599 by @andreaskuster)
 
 v6.18.0 (2021-05-05)
 -------

+ 8 - 0
extras/ci/espidf/CMakeLists.txt

@@ -0,0 +1,8 @@
+# ArduinoJson - https://arduinojson.org
+# Copyright Benoit Blanchon 2014-2021
+# MIT License
+
+cmake_minimum_required(VERSION 3.5)
+
+include($ENV{IDF_PATH}/tools/cmake/project.cmake)
+project(example)

+ 1 - 0
extras/ci/espidf/components/ArduinoJson

@@ -0,0 +1 @@
+../../../..

+ 6 - 0
extras/ci/espidf/main/CMakeLists.txt

@@ -0,0 +1,6 @@
+# ArduinoJson - https://arduinojson.org
+# Copyright Benoit Blanchon 2014-2021
+# MIT License
+
+idf_component_register(SRCS "main.cpp"
+                       INCLUDE_DIRS "")

+ 4 - 0
extras/ci/espidf/main/component.mk

@@ -0,0 +1,4 @@
+#
+# "main" pseudo-component makefile.
+#
+# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)

+ 16 - 0
extras/ci/espidf/main/main.cpp

@@ -0,0 +1,16 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#include <ArduinoJson.h>
+
+extern "C" void app_main() {
+  char buffer[256];
+  StaticJsonDocument<200> doc;
+
+  doc["hello"] = "world";
+  serializeJson(doc, buffer);
+  deserializeJson(doc, buffer);
+  serializeMsgPack(doc, buffer);
+  deserializeMsgPack(doc, buffer);
+}