2022-03-14 19:10:10 +00:00
|
|
|
# Static checks on the code.
|
|
|
|
|
2020-06-07 19:49:06 +00:00
|
|
|
image: registry.gitlab.com/satoshilabs/trezor/trezor-firmware/trezor-firmware-env.nix
|
2019-04-27 17:16:50 +00:00
|
|
|
|
2021-11-24 12:24:10 +00:00
|
|
|
# Caching
|
|
|
|
.gitlab_caching: &gitlab_caching
|
|
|
|
cache:
|
|
|
|
key: "$CI_COMMIT_REF_SLUG"
|
|
|
|
paths:
|
|
|
|
- .venv/
|
|
|
|
|
2022-03-14 19:10:10 +00:00
|
|
|
# Check the code for style correctness and perform some static code analysis.
|
|
|
|
# Biggest part is the python one - using `flake8`, `isort`, `black`, `pylint` and `pyright`,
|
|
|
|
# also checking Rust files by `rustfmt` and C files by `clang-format`.
|
|
|
|
# Changelogs formats are checked.
|
2019-09-04 08:53:40 +00:00
|
|
|
style prebuild:
|
2019-04-27 17:16:50 +00:00
|
|
|
stage: prebuild
|
2020-11-04 15:31:20 +00:00
|
|
|
variables:
|
|
|
|
GIT_SUBMODULE_STRATEGY: "none"
|
2021-11-24 12:24:10 +00:00
|
|
|
<<: *gitlab_caching
|
2019-04-27 17:16:50 +00:00
|
|
|
script:
|
2023-02-14 18:17:05 +00:00
|
|
|
- $NIX_SHELL --run "poetry run make -j1 style_check"
|
2019-04-27 17:16:50 +00:00
|
|
|
|
2022-03-14 19:10:10 +00:00
|
|
|
# Check validity of coin definitions and protobuf files.
|
2019-09-04 08:53:40 +00:00
|
|
|
common prebuild:
|
2019-04-27 17:16:50 +00:00
|
|
|
stage: prebuild
|
2021-11-24 12:24:10 +00:00
|
|
|
<<: *gitlab_caching
|
2019-04-27 17:16:50 +00:00
|
|
|
script:
|
2023-02-14 18:17:05 +00:00
|
|
|
- $NIX_SHELL --run "poetry run make defs_check"
|
2019-05-17 13:14:41 +00:00
|
|
|
|
2022-03-14 19:10:10 +00:00
|
|
|
# Check validity of auto-generated files.
|
2019-09-04 08:53:40 +00:00
|
|
|
gen prebuild:
|
2019-05-17 13:14:41 +00:00
|
|
|
stage: prebuild
|
2021-11-24 12:24:10 +00:00
|
|
|
<<: *gitlab_caching
|
2019-05-17 13:14:41 +00:00
|
|
|
script:
|
2023-02-14 18:17:05 +00:00
|
|
|
- $NIX_SHELL --run "poetry run make -j1 gen_check"
|
2020-04-23 11:32:27 +00:00
|
|
|
|
2022-03-14 19:10:10 +00:00
|
|
|
# Checking format of .editorconfig files.
|
2020-11-11 13:43:09 +00:00
|
|
|
editor prebuild:
|
|
|
|
stage: prebuild
|
2021-11-24 12:24:10 +00:00
|
|
|
<<: *gitlab_caching
|
2020-11-11 13:43:09 +00:00
|
|
|
script:
|
2023-02-14 18:17:05 +00:00
|
|
|
- $NIX_SHELL --run "make editor_check"
|
2020-11-11 13:43:09 +00:00
|
|
|
|
2022-03-14 19:10:10 +00:00
|
|
|
# Checking the format of release commit messages.
|
2020-04-23 11:32:27 +00:00
|
|
|
release commit messages prebuild:
|
|
|
|
stage: prebuild
|
2020-08-04 19:21:44 +00:00
|
|
|
before_script: [] # nothing needed
|
|
|
|
variables:
|
2023-10-13 13:37:09 +00:00
|
|
|
# We need to clone the repo properly so we can work with origin/main.
|
2020-08-04 19:21:44 +00:00
|
|
|
GIT_STRATEGY: clone
|
2020-04-23 11:32:27 +00:00
|
|
|
only:
|
2020-08-05 21:20:29 +00:00
|
|
|
refs:
|
|
|
|
- /^release\//
|
|
|
|
variables:
|
|
|
|
# We want this to run on gitlab.com/satoshilabs/trezor/trezor-firmware only.
|
|
|
|
- $CI_PROJECT_PATH_SLUG == 'satoshilabs-trezor-trezor-firmware'
|
2020-04-23 11:32:27 +00:00
|
|
|
script:
|
2023-02-14 18:17:05 +00:00
|
|
|
- $NIX_SHELL --run "ci/check_release_commit_messages.sh"
|
2021-04-19 11:32:52 +00:00
|
|
|
|
2022-03-14 19:10:10 +00:00
|
|
|
# Verifying that all commits changing some functionality have a changelog entry
|
|
|
|
# or contain `[no changelog]` in the commit message.
|
2021-04-19 11:32:52 +00:00
|
|
|
changelog prebuild:
|
|
|
|
stage: prebuild
|
2021-05-25 11:23:31 +00:00
|
|
|
except:
|
2023-10-13 13:37:09 +00:00
|
|
|
- main
|
2021-04-19 11:32:52 +00:00
|
|
|
before_script: [] # nothing needed
|
|
|
|
variables:
|
|
|
|
GIT_SUBMODULE_STRATEGY: "none"
|
|
|
|
GIT_STRATEGY: clone
|
|
|
|
script:
|
2023-02-14 18:17:05 +00:00
|
|
|
- $NIX_SHELL --run "ci/check_changelog.sh"
|