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

Merge branch 'feature/submodules_precommit' into 'master'

tools: add sbom-hash check to pre-commit

Closes IDF-7440

See merge request espressif/esp-idf!24178
Roland Dobai 2 лет назад
Родитель
Сommit
dc43567af3
2 измененных файлов с 10 добавлено и 0 удалено
  1. 6 0
      .pre-commit-config.yaml
  2. 4 0
      tools/test_sbom/test_submodules.py

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

@@ -152,6 +152,12 @@ repos:
         additional_dependencies:
           - PyYAML == 5.3.1
           - ruamel.yaml
+      - 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
+        language: python
+        always_run: true
+        pass_filenames: false
   - repo: https://github.com/pre-commit/pre-commit-hooks
     rev: v4.0.1
     hooks:

+ 4 - 0
tools/test_sbom/test_submodules.py

@@ -67,3 +67,7 @@ def test_sha() -> None:
                f'information if necessary. It is important to keep this information '
                f'up-to-date for SBOM generation.')
         assert submodule['hash'] == sbom_hash, msg
+
+
+if __name__ == '__main__':
+    test_sha()