Skip to content
Snippets Groups Projects

CI: generate style artifact

Merged Sergey Kosukhin requested to merge generate-style-artifact into master
2 files
+ 43
7
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 42
6
@@ -58,9 +58,17 @@ workflow:
- ${PRE_COMMIT_HOME}
Check licenses:
extends: .common_pre_commit
extends:
- .colorized
- .common_pre_commit
script:
- pre-commit run --color=always --hook-stage manual reuse
- |
# pre-commit run --hook-stage manual reuse
pre-commit run --color=always --hook-stage manual reuse || {
printf "${RED}You can reproduce this check locally with \`pre-commit run --hook-stage manual reuse\`.
See also ${CI_PROJECT_URL}/-/blob/${CI_DEFAULT_BRANCH}/CONTRIBUTING.md#coding-style.\n${DEFAULT}"
exit 1
}
rules:
- if: $CI_PIPELINE_SOURCE == "web"
when: manual
@@ -68,9 +76,37 @@ Check licenses:
interruptible: true
Check style:
extends: .common_pre_commit
extends:
- .colorized
- .common_pre_commit
variables:
STYLE_PATCH: style.patch
script:
- pre-commit run --show-diff-on-failure --color=always --all-files
- |
# pre-commit run --all-files
pre-commit run --color=always --all-files || {
git diff --ignore-submodules --patch-with-raw > "${STYLE_PATCH}" && {
test -s "${STYLE_PATCH}" && {
printf "${RED}At least some of the issues can be resolved with the patch (see artifacts):
${CI_JOB_URL}/artifacts/raw/${STYLE_PATCH}.\n${DEFAULT}"
} || {
printf "${RED}The issues cannot be resolved with a patch.\n${DEFAULT}"
rm -f "${STYLE_PATCH}"
}
} || {
printf "${RED}Failed to generate a patch file.\n${DEFAULT}"
rm -f "${STYLE_PATCH}"
}
printf "${RED}You can reproduce this check locally with \`pre-commit run --all-files\`.
See also ${CI_PROJECT_URL}/-/blob/${CI_DEFAULT_BRANCH}/CONTRIBUTING.md#coding-style.\n${DEFAULT}"
exit 1
}
artifacts:
paths:
- ${STYLE_PATCH}
expose_as: 'Style Patch'
when: on_failure
rules:
- if: $CI_PIPELINE_SOURCE == "web"
when: manual
@@ -144,7 +180,7 @@ include:
printf "${DEFAULT}"
exit 1
}
rm -rf "${BUILD_LOG}" "${compiler_warnings}"
rm -f "${BUILD_LOG}" "${compiler_warnings}"
- |
# Check if there are untracked files
untracked_files=$( \
@@ -154,7 +190,7 @@ include:
--exclude-standard \
)
test -z "${untracked_files}" || {
printf "${RED}The job produced unexpected files:\n${untracked_files}\n\
printf "${RED}The job produced unexpected files:\n${untracked_files}
Update the '.gitignore' file.\n${DEFAULT}"
exit 1
}
Loading