diff --git a/.github/workflows/platformio.yml b/.github/workflows/platformio.yaml similarity index 71% rename from .github/workflows/platformio.yml rename to .github/workflows/platformio.yaml index e6f865e..ad5c30c 100644 --- a/.github/workflows/platformio.yml +++ b/.github/workflows/platformio.yaml @@ -1,5 +1,5 @@ name: PlatformIO CI -description: Build the project with PlatformIO for every environment +description: Build the project with PlatformIO on: push: @@ -13,10 +13,6 @@ jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - pio-env: [ "Example1_FastStartup", "Example2_Debug", "Example3_WithWifi", "Example4_HandleCommand"] - steps: - uses: actions/checkout@v4 with: @@ -36,5 +32,5 @@ jobs: # otherwise compilation might fail to find the just-installed libraries # - name: Install platformIO libraries # run: pio lib install - - name: Build PlatformIO Project - run: pio run --environment ${{ matrix.pio-env }} + - name: PlatformIO Build All + run: pio run diff --git a/README.md b/README.md index 6b2be43..d0e96ff 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,9 @@ Can also print array or structure ## Debugger +## Unit Testing + +From [official documentation](https://piolabs.com/blog/insights/unit-testing-part-1.html) + +Running local unit tests (native unit tests) is not feasible because the library is too tightly integrated with Arduino and FreeRTOS. +We need to setup a remote device to make the pipeline run on it. \ No newline at end of file diff --git a/examples/Example2_Debug/Example2_Debug.cpp b/examples/Debug/main.cpp similarity index 100% rename from examples/Example2_Debug/Example2_Debug.cpp rename to examples/Debug/main.cpp diff --git a/examples/Example1_FastStartup/Example1_FastStartup.cpp b/examples/FastStartup/main.cpp similarity index 100% rename from examples/Example1_FastStartup/Example1_FastStartup.cpp rename to examples/FastStartup/main.cpp diff --git a/examples/Example4_HandleCommand/Example4_HandleCommand.cpp b/examples/HandleCommand/main.cpp similarity index 100% rename from examples/Example4_HandleCommand/Example4_HandleCommand.cpp rename to examples/HandleCommand/main.cpp diff --git a/examples/Example3_WithWifi/Example3_WithWifi.cpp b/examples/WiFi/main.cpp similarity index 100% rename from examples/Example3_WithWifi/Example3_WithWifi.cpp rename to examples/WiFi/main.cpp diff --git a/platformio.ini b/platformio.ini index d32b48f..24d38c2 100644 --- a/platformio.ini +++ b/platformio.ini @@ -10,9 +10,9 @@ [platformio] name = ESP32-Helper -description = Librairy for esp32 +description = Library for esp32 ; Leave default_envs empty so it will build all env -default_envs = +default_envs = ; build_dir = ${PROJECT_DIR}/.pio/build [env] @@ -23,24 +23,26 @@ upload_protocol = esptool build_type = debug monitor_filters = esp32_exception_decoder build_src_filter = +<*> - +<../examples/${PIOENV}/${PIOENV}.cpp> + +<../examples/${PIOENV}/main.cpp> monitor_speed = 921600 +check_tool = clangtidy +check_flags = + clangtidy: --enable=all --fix --format-style=google -[env:Example1_FastStartup] -build_flags = - -D NO_WIFI +;examples -[env:Example2_Debug] -build_flags = - -D NO_WIFI - -[env:Example3_WithWifi] -build_flags = - -D WITH_WIFI -; -D WITH_OTA -;upload_protocol = espota -;upload_port = 192.168.137.110 - -[env:Example4_HandleCommand] -build_flags = - -D NO_WIFI \ No newline at end of file +[env:Debug] +build_flags = + -D NO_WIFI + +[env:FastStartup] +build_flags = + -D NO_WIFI + +[env:HandleCommand] +build_flags = + -D NO_WIFI + +[env:WiFi] +build_flags = + -D WITH_WIFI diff --git a/test/test_template.cpp b/test/test_template.cpp new file mode 100644 index 0000000..d14ff6d --- /dev/null +++ b/test/test_template.cpp @@ -0,0 +1,18 @@ +#include + +// setup and teardown are executed respectively before and after each test +void setUp(void) +{ + // set stuff up here +} + +void tearDown(void) +{ + // clean stuff up here +} + +int main(int argc, char **argv) +{ + UNITY_BEGIN(); + UNITY_END(); +}