Commit Graph

68 Commits

Author SHA1 Message Date
Frantisek Hrbata
01fed1a52e 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-18 08:48:57 +01:00
Frantisek Hrbata
b93cc581a5 fix: set default pre-commit hook stages to pre-commit only
If pre-commit hook does not specify stage[1], neither in
.pre-commit-config.yaml nor in .pre-commit-hooks.yaml, it's started for every
installed pre-commit hook. Limit the default stages to pre-commit only by default.

This also sets the default_install_hook_types and
minimum_pre_commit_version and sets conventional-precommit-linter to
v1.4.1.

[1] https://pre-commit.com/#confining-hooks-to-run-at-certain-stages

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-12-14 15:12:18 +01:00
Frantisek Hrbata
c3afbebf23 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-12 12:26:34 +01:00
Frantisek Hrbata
5df4decf07 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-06 10:08:54 +01:00
Tomas Sebestik
394a6ec351
ci(pre-commit-hooks): update version conventional-precommit-linter 2023-11-25 08:58:54 +01:00
Frantisek Hrbata
3588267e67 fix(ci): bump astyle version to v1.0.5 in .pre-commit-config.yaml
pyyaml have problem with newer cython(3.0), this was fixed in pyyaml
6.0.1, which requires cython<3.0. The pyyaml dependency in astyle
was fixed in v1.0.5, but the pre-commit config is still useing v1.0.2.
As a result the pre-commit hooks installation of astyle can fail
on pyyaml. Fix this by bumping the astyle version for pre-commit.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-11-23 11:18:01 +01:00
Jakub Kocka
d7da0bef98 bugfix(pre-commit-config): Added additional dependencies for check-kconfigs 2023-10-11 09:01:33 +02:00
Marek Fiala
37c7c5b58d feat(tools): Add shellcheck for shell scripts to CI
- shellcheck fixes in shell scripts
2023-10-03 10:57:29 +02:00
Ivan Grokhotkov
c5cd97d84f
fix(precommit): correct typo in astyle-format.yml file name 2023-09-27 16:35:26 +02:00
Ivan Grokhotkov
43741ec803
ci: add astyle pre-commit check 2023-09-27 08:43:45 +02:00
Anton Maklakov
af2f5dbd18 ci(pre-commit): Add rules for branch namimg
Limit slashes in branch names
    No uppercase letters in branch names
2023-09-20 12:06:34 +07:00
Chen Yudong
e18125edcf fix(ci): optimize build rules patterns
add a script to check build-components-patterns in rules.yml
2023-09-12 13:47:54 +08:00
Xiao Xufeng
f51258ec18 ci(pre-commit): add check that build-test-rule paths must exist 2023-08-11 17:04:35 +08:00
Fu Hanxi
60db076a96
ci: add pre-commit to cleanup ignore lists 2023-08-09 12:09:31 +08:00
radim.karnis
8acde05a5c feat: Drop Python 3.7 support 2023-08-08 08:37:29 +02:00
Tomas Sebestik
2bd570c93b ci(danger/precommit): Update incorrect scope message in commit message Danger check
Updated ' hook version
2023-08-01 07:39:07 +02:00
Roland Dobai
141dba58ea ci(pre-commit): Use the newest copyright checker 2023-07-19 14:56:02 +02:00
Tomas Sebestik
c59d4e15ff docs(contributor_guide): Update install pre-commit instructions 2023-06-29 15:05:58 +02:00
Tomas Sebestik
b4c84e09e2 ci(danger): Change commit message default rules
- maximum length of commit message summary 72 characters (before 50)
- drop rule for commit message summary to start with capital letter
- AI generated commit message only for poor messages
- updated version of pre-commit hook 'conventional-precommit-linter'
- update prompt AI generated commit message
2023-06-29 13:34:08 +02:00
Tomas Sebestik
d8c787ab4a ci(danger): Add check for conventional commits
Add DangerJS check for convetional commit style.

Add conventional-precommit-linter hook
https://github.com/espressif/conventional-precommit-linter
2023-06-21 09:54:47 +02:00
Frantisek Hrbata
314ebbcf36 tools: add sbom-hash check to pre-commit
This uses the test from CI introduced in MR !23989. Even though the
original CI test is run with pytest, it doesn't use any pytest specific
code/features and it should never need them. So it make sense just to
re-use the code.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-06-14 09:31:10 +00:00
Frantisek Hrbata
73b4b8f637 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-12 14:11:58 +02:00
Fu Hanxi
22e2738f78 ci: build and test only modified components related test cases 2023-05-26 22:59:57 +08:00
Fu Hanxi
3554c6e571 ci: run readme check when constants.py or check script updated 2023-04-21 14:43:21 +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