Просмотр исходного кода

ci(pre-commit): add check that build-test-rule paths must exist

Xiao Xufeng 2 лет назад
Родитель
Сommit
f51258ec18

+ 9 - 0
.pre-commit-config.yaml

@@ -152,6 +152,15 @@ repos:
         additional_dependencies:
           - PyYAML == 5.3.1
           - ruamel.yaml
+      - id: check-build-test-rules-path-exists
+        name: check path in .build-test-rules.yml exists
+        entry: tools/ci/check_build_test_rules.py check-exist
+        language: python
+        additional_dependencies:
+          - PyYAML == 5.3.1
+        always_run: true
+        pass_filenames: false
+        require_serial: true
       - id: submodule-sbom-hash-check
         name: Check if sbom-hash values for submodules in .gitmodules match submodules checkout hash in git tree
         entry: python tools/test_sbom/test_submodules.py

+ 0 - 5
components/esp_rom/.build-test-rules.yml

@@ -1,10 +1,5 @@
 # Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
 
-components/esp_rom/host_test/rom_test:
-  enable:
-    - if: IDF_TARGET == "linux"
-      reason: only test on linux
-
 components/esp_rom/test_apps:
   disable_test:
     - if: IDF_TARGET in ["esp32", "esp32c2"]

+ 0 - 8
examples/peripherals/.build-test-rules.yml

@@ -48,10 +48,6 @@ examples/peripherals/i2c/i2c_tools:
       reason: lack of runners
   <<: *i2c_dependencies
 
-examples/peripherals/i2s/i2s_adc_dac:
-  disable:
-    - if: SOC_I2S_SUPPORTS_ADC_DAC != 1
-
 examples/peripherals/i2s/i2s_basic/i2s_pdm:
   disable:
     - if: SOC_I2S_SUPPORTS_PDM != 1
@@ -158,10 +154,6 @@ examples/peripherals/rmt/musical_buzzer:
   disable:
     - if: SOC_RMT_SUPPORT_TX_LOOP_COUNT != 1
 
-examples/peripherals/rmt/onewire_ds18b20:
-  disable:
-    - if: SOC_RMT_SUPPORTED != 1
-
 examples/peripherals/rmt/stepper_motor:
   disable:
     - if: SOC_RMT_SUPPORT_TX_LOOP_AUTO_STOP != 1

+ 0 - 6
examples/protocols/.build-test-rules.yml

@@ -122,12 +122,6 @@ examples/protocols/mqtt5:
       temporary: true
       reason: lack of runners
 
-examples/protocols/slip/slip_udp:
-  disable:
-    - if: IDF_TARGET == "esp32c2"
-      temporary: true
-      reason: target esp32c2 is not supported yet
-
 examples/protocols/sntp:
   enable:
     - if: IDF_TARGET == "esp32"

+ 21 - 0
tools/ci/check_build_test_rules.py

@@ -413,6 +413,23 @@ def sort_yaml(files: List[str]) -> None:
     sys.exit(exit_code)
 
 
+def check_exist() -> None:
+    exit_code = 0
+
+    config_files = [str(p) for p in Path(IDF_PATH).glob('**/.build-test-rules.yml')]
+    for file in config_files:
+        with open(file) as fr:
+            configs = yaml.load(fr)
+            for path in configs.keys():
+                if path.startswith('.'):
+                    continue
+                if not os.path.isdir(path):
+                    print(f'Path \'{path}\' referred in \'{file}\' does not exist!')
+                    exit_code = 1
+
+    sys.exit(exit_code)
+
+
 if __name__ == '__main__':
     if 'CI_JOB_ID' not in os.environ:
         os.environ['CI_JOB_ID'] = 'fake'  # this is a CI script
@@ -441,6 +458,8 @@ if __name__ == '__main__':
     _sort_yaml = action.add_parser('sort-yaml')
     _sort_yaml.add_argument('files', nargs='+', help='all specified yaml files')
 
+    _check_exist = action.add_parser('check-exist')
+
     arg = parser.parse_args()
 
     # Since this script is executed from the pre-commit hook environment, make sure IDF_PATH is set
@@ -450,6 +469,8 @@ if __name__ == '__main__':
 
     if arg.action == 'sort-yaml':
         sort_yaml(arg.files)
+    elif arg.action == 'check-exist':
+        check_exist()
     else:
         check_dirs = set()
 

+ 0 - 26
tools/test_apps/.build-test-rules.yml

@@ -23,20 +23,10 @@ tools/test_apps/linux_compatible/linux_freertos:
   enable:
     - if: IDF_TARGET == "linux"
 
-tools/test_apps/linux_compatible/rmt_mock_build_test:
-  enable:
-    - if: IDF_TARGET == "linux"
-
 tools/test_apps/peripherals/i2c_wifi:
   disable:
     - if: SOC_I2C_SUPPORTED != 1 or SOC_WIFI_SUPPORTED != 1
 
-tools/test_apps/peripherals/usb:
-  enable:
-    - if: IDF_TARGET in ["esp32s2", "esp32s3"]
-      temporary: true
-      reason: the other targets are not tested yet
-
 tools/test_apps/phy/phy_multi_init_data_test:
   disable:
     - if: SOC_WIFI_SUPPORTED != 1
@@ -57,16 +47,6 @@ tools/test_apps/protocols/esp_netif/build_config:
       temporary: false
       reason: No need to test on all targets
 
-tools/test_apps/protocols/mdns:
-  enable:
-    - if: IDF_TARGET in ["esp32", "esp32c3", "esp32s2"]
-      temporary: true
-      reason: the other targets are not tested yet
-  disable_test:
-    - if: IDF_TARGET == "esp32s2" or IDF_TARGET == "esp32c3"
-      temporary: true
-      reason: lack of runners
-
 tools/test_apps/protocols/mqtt/publish_connect_test:
   enable:
     - if: IDF_TARGET in ["esp32", "esp32c3", "esp32s2"]
@@ -118,12 +98,6 @@ tools/test_apps/system/eh_frame:
       temporary: true
       reason: the other targets are not tested yet
 
-tools/test_apps/system/flash_psram:
-  enable:
-    - if: IDF_TARGET == "esp32s3"
-      temporary: true
-      reason: the other targets are not tested yet
-
 tools/test_apps/system/g0_components:
   enable:
     - if: INCLUDE_DEFAULT == 1 or IDF_TARGET in ["esp32p4"] # preview targets