From e9a74d6f79adbca825707821cb88c5912ab0c888 Mon Sep 17 00:00:00 2001 From: Tomas Rezucha Date: Fri, 6 Sep 2024 18:33:22 +0200 Subject: [PATCH] feat(ci): Use conditional build of apps --- .build-test-rules.yml | 66 ++++++++++++------- ...ild_example.yml => build-applications.yml} | 37 ++++++----- .github/workflows/build_test.yml | 38 ----------- .idf_build_apps.toml | 4 +- Doxyfile | 4 +- 5 files changed, 68 insertions(+), 81 deletions(-) rename .github/workflows/{build_example.yml => build-applications.yml} (62%) delete mode 100644 .github/workflows/build_test.yml diff --git a/.build-test-rules.yml b/.build-test-rules.yml index d0c9d051..3ca05afc 100644 --- a/.build-test-rules.yml +++ b/.build-test-rules.yml @@ -1,46 +1,68 @@ +# Examples: Always build all examples: disable: - if: CONFIG_NAME in ["esp-box", "esp-box-lite"] reason: Do not build examples for deprecated BSPs - - if: IDF_VERSION_MAJOR < 5 and CONFIG_NAME in ["esp32_c3_lcdkit", "esp32_s3_lcd_ev_board", "esp32_s3_usb_otg", "m5stack_core_s3", "m5stack_core_2", "m5dial"] - reason: Example depends on BSP, which is supported only for IDF >= 5.0 - - if: IDF_VERSION_MAJOR < 5 and IDF_TARGET in ["esp32c2", "esp32p4", "esp32c5", "esp32c6"] - reason: Example depends on target, which is supported only for IDF >= 5.0 - if: IDF_VERSION_MAJOR < 5 and IDF_VERSION_MINOR < 3 and CONFIG_NAME == "esp32_p4_function_ev_board" reason: Example depends on BSP, which is supported only for IDF >= 5.3 +# Noglib test_app: Build only in CI, where ENV_BUILD_NOGLIB is set test_apps/noglib: disable: - if: ENV_BUILD_NOGLIB == 0 -components/lcd/esp_lcd_gc9503: - disable: - - if: IDF_VERSION_MAJOR < 5 or (IDF_VERSION_MAJOR == 5 and IDF_VERSION_MINOR == 0 and ESP_IDF_VERSION_PATCH < 5) or (IDF_VERSION_MAJOR == 5 and IDF_VERSION_MINOR == 1 and ESP_IDF_VERSION_PATCH == 1) - reason: Supported from version 5.0.5 and not supported in version 5.1.1 +# Common components test_app: Build for changes in components which do not have their own test_app or example +test_apps/components: + depends_filepatterns: + - "components/bh1750/**" + - "components/ds18b20/**" + - "components/fbm320/**" + - "components/hts221/**" + - "components/icm42670/**" + - "components/io_expander/**" + - "components/lcd/ra8875/**" + - "components/lcd/sh1107/**" + - "components/lcd_touch/**" + - "components/mag3110/**" + - "components/mpu6050/**" -components/lcd/esp_lcd_gc9503/test_apps: +# esp_lvgl_port: Build only on related changes and components used in examples +components/esp_lvgl_port: + depends_filepatterns: + - "components/esp_lvgl_port/**" + - "components/lcd_touch/esp_lcd_touch_tt21100/**" + - "components/lcd_touch/esp_lcd_touch_gt1151/**" + - "components/lcd/sh1107/**" + +# LCD components: Build only on related changes +components/lcd/esp_lcd_gc9a01: + depends_filepatterns: + - "components/lcd/esp_lcd_gc9a01/**" + +components/lcd/esp_lcd_gc9503: + depends_filepatterns: + - "components/lcd/esp_lcd_gc9503/**" disable: - if: IDF_VERSION_MAJOR < 5 or (IDF_VERSION_MAJOR == 5 and IDF_VERSION_MINOR == 0 and ESP_IDF_VERSION_PATCH < 5) or (IDF_VERSION_MAJOR == 5 and IDF_VERSION_MINOR == 1 and ESP_IDF_VERSION_PATCH == 1) reason: Supported from version 5.0.5 and not supported in version 5.1.1 -components/lcd/esp_lcd_ssd1681: - disable: - - if: IDF_VERSION_MAJOR < 5 - reason: Component is supported only for IDF >= 5.0 - -components/esp_lvgl_port/examples/rgb_lcd: - disable: - - if: IDF_VERSION_MAJOR < 5 - reason: Example for RGB LCD is supported only for IDF >= 5.0 +components/lcd/esp_lcd_ili9341: + depends_filepatterns: + - "components/lcd/esp_lcd_ili9341/**" components/lcd/esp_lcd_ili9881c: + depends_filepatterns: + - "components/lcd/esp_lcd_ili9881c/**" disable: - if: (IDF_VERSION_MAJOR == 5 and IDF_VERSION_MINOR < 3) or IDF_VERSION_MAJOR < 5 reason: Component is supported only for IDF >= 5.3 - if: IDF_TARGET not in ["esp32p4"] reason: Component is supported only for esp32p4 target -components/lcd/esp_lcd_st7796/test_apps: - disable: - - if: IDF_VERSION_MAJOR < 5 - reason: Component is supported only for IDF >= 5.0 +components/lcd/esp_lcd_ssd1681: + depends_filepatterns: + - "components/lcd/esp_lcd_ssd1681/**" + +components/lcd/esp_lcd_st7796: + depends_filepatterns: + - "components/lcd/esp_lcd_st7796/**" diff --git a/.github/workflows/build_example.yml b/.github/workflows/build-applications.yml similarity index 62% rename from .github/workflows/build_example.yml rename to .github/workflows/build-applications.yml index ed14ece4..0a3b011c 100644 --- a/.github/workflows/build_example.yml +++ b/.github/workflows/build-applications.yml @@ -1,4 +1,7 @@ -name: Build BSP examples +name: Build ESP-BSP apps + +# This job builds all examples and test_applications in this repo +# Applications are selected for build based on changes files and dependecies defined in .build-test-rules.yml on: pull_request: @@ -24,12 +27,6 @@ jobs: - idf_ver: "latest" parallel_count: 5 parallel_index: 5 - - idf_ver: "release-v4.4" - parallel_count: 2 - parallel_index: 1 - - idf_ver: "release-v4.4" - parallel_count: 2 - parallel_index: 2 - idf_ver: "release-v5.1" parallel_count: 2 parallel_index: 1 @@ -48,20 +45,24 @@ jobs: - idf_ver: "release-v5.3" parallel_count: 2 parallel_index: 2 - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest container: espressif/idf:${{ matrix.idf_ver }} steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - name: Build ESP-BSP examples + - uses: actions/checkout@v4 + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v45 + + - name: Build ESP-BSP applications shell: bash env: - extra_arguments: "${{ matrix.idf_ver == 'latest' && '--default-build-targets esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6 esp32h2 esp32p4' || '' }}" + IDF_EXTRA_ACTIONS_PATH: "${{ github.workspace }}/examples" + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} run: | - export IDF_EXTRA_ACTIONS_PATH=${GITHUB_WORKSPACE}/examples . ${IDF_PATH}/export.sh - pip install idf-component-manager==1.* ruamel.yaml idf-build-apps --upgrade - echo idf-build-apps extra arguments: ${{ env.extra_arguments }} - idf-build-apps find ${{ env.extra_arguments }} -p examples - idf-build-apps build --parallel-count ${{ matrix.parallel_count }} --parallel-index ${{ matrix.parallel_index }} ${{ env.extra_arguments }} -p examples + pip install idf-component-manager==1.* ruamel.yaml idf-build-apps==2.4.3 --upgrade + + echo "Files changed: ${ALL_CHANGED_FILES}" + idf-build-apps find --modified-files "${ALL_CHANGED_FILES}" + idf-build-apps build --parallel-count ${{ matrix.parallel_count }} --parallel-index ${{ matrix.parallel_index }} --modified-files "${ALL_CHANGED_FILES}" diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml deleted file mode 100644 index 8afce417..00000000 --- a/.github/workflows/build_test.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Build Test Application - -on: - pull_request: - types: [opened, reopened, synchronize] - paths: - - 'components/**' - - 'test_apps/components/**' - - '.github/workflows/build_test.yml' - -jobs: - build: - strategy: - matrix: - idf_ver: ["release-v4.4", "release-v5.1", "release-v5.2", "release-v5.3", "latest"] - idf_target: ["esp32", "esp32s2", "esp32c3", "esp32s3", "esp32p4"] - exclude: - - idf_ver: "release-v4.4" - idf_target: esp32p4 # ESP32P4 support started with version 5.2 - - idf_ver: "release-v5.0" - idf_target: esp32p4 # ESP32P4 support started with version 5.2 - - idf_ver: "release-v5.1" - idf_target: esp32p4 # ESP32P4 support started with version 5.2 - runs-on: ubuntu-20.04 - container: espressif/idf:${{ matrix.idf_ver }} - steps: - - uses: actions/checkout@v3 - - name: Build ESP-BSP Test Application - env: - IDF_TARGET: ${{ matrix.idf_target }} - working-directory: test_apps/components - shell: bash - run: | - . ${IDF_PATH}/export.sh - export PEDANTIC_FLAGS="-DIDF_CI_BUILD -Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function" - export EXTRA_CFLAGS="${PEDANTIC_FLAGS} -Wstrict-prototypes" - export EXTRA_CXXFLAGS="${PEDANTIC_FLAGS}" - idf.py build diff --git a/.idf_build_apps.toml b/.idf_build_apps.toml index 051972f3..b9b71aa9 100644 --- a/.idf_build_apps.toml +++ b/.idf_build_apps.toml @@ -1,5 +1,7 @@ -target = "all" recursive = true +exclude = [ + "SquareLine", +] manifest_file = ".build-test-rules.yml" check_warnings = true ignore_warning_file = ".ignore_build_warnings.txt" diff --git a/Doxyfile b/Doxyfile index 2259090b..e3a7d9d4 100644 --- a/Doxyfile +++ b/Doxyfile @@ -8,7 +8,7 @@ RECURSIVE = YES EXCLUDE = docu \ examples \ SquareLine \ - test_app + test_apps EXCLUDE_PATTERNS = */build/* \ */managed_components/* \ */dist/* @@ -21,4 +21,4 @@ PREDEFINED = \ ESP_LVGL_PORT_TOUCH_COMPONENT=1 \ ESP_LVGL_PORT_BUTTON_COMPONENT=1 \ ESP_LVGL_PORT_KNOB_COMPONENT=1 \ - ESP_LVGL_PORT_USB_HOST_HID_COMPONENT=1 \ No newline at end of file + ESP_LVGL_PORT_USB_HOST_HID_COMPONENT=1