Commit Graph

50 Commits

Author SHA1 Message Date
Frantisek Hrbata
a537dafa74 fix: do sbom manifest validation in post-commit
Following commit c3afbebf23 ("fix: bump esp-idf-sbom to v0.13.0 in pre-commit"),
the validation of submodule hash now relies solely on the information recorded
in the git-tree. Previously, the hash verification used submodule's
working tree hash if available. Since the new submodule hash is recorded
in git-tree only after the commit is created, we need to move the check
into post-commit, otherwise the hash validation checks the old value.

For example:

1. in .gitmodules

	[submodule "components/json/cJSON"]
	   sbom-hash = cb8693b058ba302f4829ec6d03f609ac6f848546

2. update the cJSON

	$ git -C components/json/cJSON checkout b45f48e600671feade0b6bd65d1c69de7899f2be

3. update cJSON hash in .gitmodules

	[submodule "components/json/cJSON"]
	   sbom-hash = b45f48e600671feade0b6bd65d1c69de7899f2be

4. commit the changes

	$ git commit -a -s

Step 4. will fail, because the validation is currently started in pre-commit stage,
where the hash for cJSON recorded in git-tree is still
cb8693b058ba302f4829ec6d03f609ac6f848546. The new hash b45f48e600671feade0b6bd65d1c69de7899f2be
will be stored in git-tree after the new commit is created.

Note that this means we cannot prevent the commit creation, but only
notify user about the hash inconsistency. If he/she still decides to
push it, it will fail in pre-commit checks in CI.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-12-19 12:30:37 +01:00
Frantisek Hrbata
09ac0b47f9 fix: bump esp-idf-sbom to v0.13.0 in pre-commit
v0.13.0 contains fix for the submodule hash validation. Let's
bump its version in pre-commit, so the fix is used.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-12-13 07:31:22 +01:00
Frantisek Hrbata
db25ec2a37 feat: use esp-idf-sbom pre-commit plugin
Currently sbom manifest is checked only in .gitmodules and
this check is done in pre-commit and also in CI. Meaning it's running
three times(pre-commit before push if user has it enabled, in CI
as there is the pre-commit run again and again with test in CI). Since
esp-idf-sbom contains a full manifest validation support and pre-commit
plugin for it, let's use it. This removes all the current sbom testing
and replaces it with a signle pre-commit plugin which validates all
manifests files(sbom.yml, idf_component.yml, .gitmodules and also
referenced manifests) in repository. Note that this checks all
manifests, not only ones which were modified. The check is reasonably
fast though, so it should not cause any problem. The reason for
validating all manifest files is that we want to make sure that the sbom
information in .gitmodules is updated too and that the hash
recorded in .gitmodules is up-to-date. Meaning submodule update
would not trigger this plugin, because no manifest was changed.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-12-07 13:36:00 +01:00
Roland Dobai
1b2b046f9a ci(pre-commit): Use the newest copyright checker 2023-07-21 04:41:18 +00:00
Frantisek Hrbata
fbbc548e7f tools: bump check-copyright in .pre-commit-config.yaml
Newer check-copyright version 1.0.2 contains fixes for copyrights
with single year and also the proposed date update is applied only
if number of changed lines is greater or equal to a limit. The default
limit is 5 and can be changed with the --lines-changed option if needed.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-06-21 07:06:01 +02:00
Fu Hanxi
0f8bf38913 ci: run readme check when constants.py or check script updated 2023-04-25 08:51:22 +08:00
Cao Sen Miao
0f8f13d21d spi_flash: only link flash vendor which is officially supported to save IRAM 2023-02-09 10:28:54 +08:00
Roland Dobai
4bd5ebb4a1 Merge branch 'tools/monitor_move' into 'master'
Tools(idf_monitor): Move idf_monitor to separate repo

Closes IDF-4109

See merge request espressif/esp-idf!22050
2023-02-07 19:47:46 +08:00
Fu Hanxi
bfb29022de ci: fix isort py37 incompatible issue 2023-02-06 10:30:12 +08:00
Peter Dragun
3e3533f918 feat(idf_monitor): move idf_monitor to separate repo 2023-02-03 11:20:15 +01:00
David Cermak
6e29d3c8ad ci: Fix pre-commit hook per isort deps deprecation
isorts dependecy became deprecated. Fixed to use 5.12.0 version of isort pre-commit
2023-02-02 08:44:09 +01:00
Fu Hanxi
9e25fff9d3 ci: fix pre-commit check hook 2023-01-05 12:52:45 +08:00
Marius Vikhammer
73367a9eb2 precommit: update flake8 repo url to use github
Gitlab mirror repo has been deprecated.
2022-11-15 13:33:02 +08:00
zhangwenxu
0066649684 CI: fix pre-commit ci dependencie file pattern 2022-10-12 15:42:22 +08:00
Fu Hanxi
2d27e09b4f ci: make bringup process for check_build_test_rules.py more friendly 2022-10-10 16:58:11 +08:00
Fu Hanxi
27e199605a ci: remove unused rules 2022-10-10 16:58:11 +08:00
morris
fc1aa2848b rgb_lcd: support yuv converter 2022-08-17 06:33:06 +00:00
Roland Dobai
bab3830797 Tools: Fix flake8 version 5 warnings 2022-08-12 08:13:13 +00:00
Sergei Silnov
4f93db4f5a tools: Fix copyright check in pre-commit for windows 2022-07-28 15:16:53 +02:00
Roland Dobai
b59309852a Merge branch 'features/check_SPDX_license' into 'master'
Add SPDX license check

Closes PACMAN-386

See merge request espressif/esp-idf!18664
2022-07-19 18:57:05 +08:00
Fu Hanxi
54f69d35a3 ci: add check job and pre-commit 2022-07-14 08:26:32 +08:00
Dmitry Bondarenko
d79b09fda2 Add SPDX license check 2022-07-13 17:51:13 +03:00
Laukik Hase
1ee3ee6854
protobuf: Fix v4.21.0 (python) compatibility issue
- Added auto-generated protobuf files (proto-c and python to
  pre-commit hook ignore lists
2022-05-30 09:54:31 +05:30
Anton Maklakov
95da3330c7 Tools: fix PyYAML deps for pre-commit hook
Fix 'error: Library stubs not installed for "yaml" (or incompatiblewith Python 3.9)'
2022-05-23 14:09:42 +07:00
Roland Dobai
08cc2fd493 Tools: Fix the Python dependency checker by skipping not installed dependency sub-trees 2022-05-03 16:50:25 +02:00
Jacques Supcik
80f52017d4 bump version 2022-04-25 22:55:28 +02:00
Roland Dobai
9027c30237 Merge branch 'feat/python_reqs_directory' into 'master'
Tools: Make easier the detection of the list of Python features

See merge request espressif/esp-idf!17009
2022-02-14 16:06:36 +00:00
Roland Dobai
fddc73759e Tools: Make easier the detection of the list of Python features 2022-02-03 19:02:14 +01:00
Darian Leung
e49f56a96d tools: Check copyright now checks assembly files
This commit updates the pre-commit configuration and check copyright
script to check assembly files (extensions '.s' and '.S').
2022-02-03 20:50:52 +08:00
Marius Vikhammer
c6d60615c6 build-system: include soc_caps defines into kconfig
Adds gen_soc_caps_kconfig.py which parses the soc caps (soc_caps.h) into
a format that can be included in kconfig.
2021-12-06 12:37:07 +08:00
Jan Brudný
228113a399 tools: make copyright check configurable 2021-12-03 10:29:35 +01:00
Fu Hanxi
3ae7e2a92f ci: always run check-codeowners 2021-11-11 16:59:54 +08:00
Roland Dobai
0c24913608 Tools: Permanently ignore some header files from header check 2021-10-19 14:41:50 +02:00
Fu Hanxi
0b7a0d7cbd ci: move check_tools_files_patterns to pre-commit 2021-10-13 09:13:33 +08:00
Jan Brudný
3ce35ae455 tools: precommit copyright check fails on windows 2021-09-23 22:47:56 +08:00
Jan Brudný
798a174686 Add copyright check to pre-commit-config 2021-09-20 17:50:55 +08:00
Michael (XIAO Xufeng)
7f2973f702 ci: put file sorter to the end of the pre-commit checking
So that the sorter will be done at the end of the checking flow, we don't need to run pre-commit hooks again if another hook also take effect.
2021-04-26 15:58:03 +08:00
Tomas Sebestik
e408915ff0 Remove sorting of MYPY ignore list from py script
Add sorting of mypy ignore list to pre-cm hook 'file-contents-sorter'
2021-04-13 10:35:56 +02:00
No One
2e5a334831 ci: run c3 unit test when other unit test run
C3 unit test were only being ran by unit_test_esp32c3 label/title,
should also be trigger by unit_test label/title
2021-03-18 10:36:08 +08:00
Tomas Sebestik
a22597a2d6 Add mypy check to pre-commit-config 2021-02-25 07:05:43 +00:00
Fu Hanxi
80e86e7939 ci(pre-commit): check if rules is updated and valid 2021-02-10 14:50:07 +08:00
Fu Hanxi
f0ea7a505b style(editorconfig): add indent style for yaml 2021-02-10 14:48:51 +08:00
Fu Hanxi
a4f2206d4c pre-commit: Add double-quote-string-fixer and isort for python files 2021-01-20 10:38:17 +08:00
Angus Gratton
19b4f2452c pre-commit: Rearrange the YAML file to avoid the warning
Having a root level key that existed only to make an anchor led to a warning,
instead create the anchor in the first place the key was used and then reference
it later on.
2020-11-13 14:22:18 +11:00
Angus Gratton
e2614122d8 pre-commit: Exclude expected output files from whitespace fixes
These rely on exact whitespace in their content
2020-11-11 07:36:35 +00:00
Angus Gratton
f7d58aa359 cmake: Disable cmakelint indentation checks temporarily 2020-11-09 13:59:43 +11:00
Angus Gratton
4fe78185b2 pre-commit: Use cmakelint 1.4.1 not older commit 2020-11-09 10:06:05 +11:00
Fu Hanxi
7ab18c7571 Fix windows error by upgrading pre-commit-hook version.
drop python 2.7 support. Now we only support python 3.6.1+
2020-11-04 10:24:42 +08:00
Fu Hanxi
47a97d2b52 check_kconfigs and check_deprecated_kconfigs now use files arguments 2020-11-02 15:49:13 +08:00
Fu Hanxi
bcc8f2628c CI: Add pre-commit for esp-idf project.
add tools/ci/python_packages/idf_ci.py for some util functions used in
ci and needs multi-os solution
2020-11-02 15:49:13 +08:00