From b6fdd43a5faa422fc80add615d56c9dc76387966 Mon Sep 17 00:00:00 2001
From: Tomas Rezucha <tomas.rezucha@espressif.com>
Date: Mon, 2 Dec 2024 15:52:08 +0100
Subject: [PATCH] ci: Build test_apps/components only for compoenets without
 test_app or example

---
 .build-test-rules.yml               |  4 +--
 test_apps/components/CMakeLists.txt | 45 ++++++++++-------------------
 2 files changed, 18 insertions(+), 31 deletions(-)

diff --git a/.build-test-rules.yml b/.build-test-rules.yml
index 6d9f22741..a879f1e14 100644
--- a/.build-test-rules.yml
+++ b/.build-test-rules.yml
@@ -26,8 +26,8 @@ test_apps/components:
     - "components/bh1750/**"
     - "components/fbm320/**"
     - "components/hts221/**"
-    - "components/lcd/ra8875/**"
-    - "components/lcd/sh1107/**"
+    - "components/lcd/esp_lcd_ra8875/**"
+    - "components/lcd/esp_lcd_sh1107/**"
     - "components/lcd_touch/**"
     - "components/mag3110/**"
     - "components/mpu6050/**"
diff --git a/test_apps/components/CMakeLists.txt b/test_apps/components/CMakeLists.txt
index f33855ac2..a4d2e322b 100644
--- a/test_apps/components/CMakeLists.txt
+++ b/test_apps/components/CMakeLists.txt
@@ -2,37 +2,24 @@
 # CMakeLists in this exact order for cmake to work correctly
 cmake_minimum_required(VERSION 3.5)
 
-set(EXTRA_COMPONENT_DIRS "../../components" "../../components/lcd" "../../components/lcd_touch" "../../components/io_expander")
-set(EXCLUDE_COMPONENTS "es8311 es7210") # Deprecated components
+# lcd_touch components do not have their own dedicated test_app
+# so we add them to build here to have at least compilation test
+set(EXTRA_COMPONENT_DIRS "../../components/lcd_touch")
+
+# Explicitly add components that do not have an test_app
+# Must be kept in sync with list in .build-test-rules.yml
+list(APPEND EXTRA_COMPONENT_DIRS
+    "../../components/lcd/esp_lcd_sh1107"
+    "../../components/lcd/esp_lcd_ra8875"
+    "../../components/bh1750"
+    "../../components/fbm320"
+    "../../components/hts221"
+    "../../components/mag3110"
+    "../../components/mpu6050"
+    )
 
-include($ENV{IDF_PATH}/tools/cmake/version.cmake) # $ENV{IDF_VERSION} was added after v4.3...
-
-# Components only for IDF5.0 and greater
-if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_LESS "5.0")
-    list(APPEND EXCLUDE_COMPONENTS "esp_lcd_touch_stmpe610" "ds18b20" "esp_lcd_ssd1681")
-elseif("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_LESS "5.3")
-    list(APPEND EXCLUDE_COMPONENTS "esp_lcd_ili9881c")
-endif()
-
-# Test rgb lcd components only in IDF 5.0.5 or greater
-if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_LESS "5.0.4")
-    list(APPEND EXCLUDE_COMPONENTS "esp_lcd_gc9503")
-endif()
 
-# Test rgb lcd components only in esp32s3
-if(NOT "${IDF_TARGET}" STREQUAL "esp32s3")
-    list(APPEND EXCLUDE_COMPONENTS "esp_lcd_gc9503")
-endif()
-
-# Test mipi dsi lcd components only in esp32p4
-if(NOT "${IDF_TARGET}" STREQUAL "esp32p4")
-    list(APPEND EXCLUDE_COMPONENTS "esp_lcd_ili9881c")
-endif()
-
-# Test i80 lcd components only in esp32s2, esp32s3
-if(NOT "${IDF_TARGET}" STREQUAL "esp32s2" AND NOT "${IDF_TARGET}" STREQUAL "esp32s3")
-    list(APPEND EXCLUDE_COMPONENTS "esp_lcd_st7796")
-endif()
+include($ENV{IDF_PATH}/tools/cmake/version.cmake) # $ENV{IDF_VERSION} was added after v4.3...
 
 # Set the components to include the tests for.
 set(TEST_COMPONENTS bh1750 mpu6050 mag3110 hts221 fbm320 CACHE STRING "List of components to test")