[graphics/krita/krita/5.2] /: Add HACKING.gitlab-ci.md with guidelines for GitLab's pipelined
Dmitry Kazakov
null at kde.org
Fri May 24 14:41:58 BST 2024
Git commit b0b33e6503c600cda41764c1b5c65364d1263180 by Dmitry Kazakov.
Committed on 24/05/2024 at 13:38.
Pushed by dkazakov into branch 'krita/5.2'.
Add HACKING.gitlab-ci.md with guidelines for GitLab's pipelined
The file describes code style guidelines for YAML code we use on CI.
It basically follows the style sysadmin team uses in their scripts
with a few additional notes on the common pitfalls when writing
CI jobs.
CC:kimageshop at kde.org
A +66 -0 HACKING.gitlab-ci.md
M +14 -14 build-tools/ci-scripts/android.yml
M +6 -6 build-tools/ci-scripts/linux.yml
M +5 -5 build-tools/ci-scripts/macos.yml
M +13 -13 build-tools/ci-scripts/windows.yml
https://invent.kde.org/graphics/krita/-/commit/b0b33e6503c600cda41764c1b5c65364d1263180
diff --git a/HACKING.gitlab-ci.md b/HACKING.gitlab-ci.md
new file mode 100644
index 00000000000..1c1d6f36322
--- /dev/null
+++ b/HACKING.gitlab-ci.md
@@ -0,0 +1,66 @@
+Here is a list of guidelines that we follow when developing CI pipeline for Krita:
+
+0) Indentation: use 2 spaces to indent the YAML code. It differs from the style we use
+ for C++ code in Krita. We just follow the style that Sysadmins use in their scripts.
+
+ Options for VSCode:
+
+ ```json
+ "[yaml]": {
+ "editor.formatOnSave": false,
+ "editor.tabSize": 2,
+ "editor.insertSpaces": true,
+ "editor.detectIndentation": true,
+ "editor.wrappingIndent": "indent",
+ "editor.autoIndent": "full"
+ },
+ ```
+
+1) If your build job is long enough to potentially overflow the GitLab's log limit (~4MiB),
+ add `job-step.py 2>&1 | tee build-step.log` to every build step of this job. In the end
+ of the job, upload these logs as artifacts. It prevents us from losing time trying to
+ resolve CI issues, when the logs are lost due to GitLab's log-size limitation.
+
+ On Windows use a different line:
+
+ `job-step.py 2>&1 | Tee-Object -FilePath "build-step.log`
+
+2) Try to write all the scripts in Python3, if it makes sense on the particular platform.
+ Avoid Windows Batch (.cmd) scripts by all means, they are known to be non-portable and
+ work differently on consumer Windows and Windows Server systems.
+
+3) All string in .yml files should be unquoted by default; if a string contains any wildcard
+ symbols (e.g. '*') or yaml's control character (e.g. ':' in Windows' paths) , wrap it into
+ quotes.
+
+ ```yaml
+ windows-build:
+ variables:
+ KDECI_BUILD_TYPE: Release # simple string -> unquoted
+ KDECI_EXTRA_CMAKE_ARGS: -DHIDE_SAFE_ASSERTS=OFF # simple string -> unquoted
+ KDECI_CC_CACHE: "C:\\Gitlab\\Caches\\krita-windows" # Windows path -> quoted
+
+ linux-build:
+ variables:
+ KDECI_CC_CACHE: /mnt/caches/krita-appimage/ # Linux path -> unquoted
+ ```
+
+4) Boolean values passed to our CI scritps should be (unquoted) `True` or `False` strings.
+
+ ```yaml
+ windows-build:
+ variables:
+ KDECI_COMPRESS_PACKAGES_ON_DOWNLOAD: False
+ KRITACI_SKIP_UPLOAD_NIGHTLY_PACKAGE: True
+ ```
+
+5) Split CMake options passed via environment variables into multiple lines
+ using `>` character:
+
+ ```yaml
+ linux-nightly:
+ variables:
+ KDECI_EXTRA_CMAKE_ARGS: >
+ -DHIDE_SAFE_ASSERTS=OFF
+ -DBUILD_TESTING=OFF
+ ```
\ No newline at end of file
diff --git a/build-tools/ci-scripts/android.yml b/build-tools/ci-scripts/android.yml
index affef12adec..ad187924a8a 100644
--- a/build-tools/ci-scripts/android.yml
+++ b/build-tools/ci-scripts/android.yml
@@ -10,8 +10,8 @@
KDECI_BUILD_TYPE: Release
KDECI_GITLAB_SERVER: https://invent.kde.org/
KDECI_REPO_METADATA_PATH: $CI_PROJECT_DIR/krita-deps-management/repo-metadata
- KDECI_COMPRESS_PACKAGES_ON_DOWNLOAD: "False"
- KDECI_SKIP_ECM_ANDROID_TOOLCHAIN: "True"
+ KDECI_COMPRESS_PACKAGES_ON_DOWNLOAD: False
+ KDECI_SKIP_ECM_ANDROID_TOOLCHAIN: True
# ANDROID_HOME: /opt/android-tooling # <-- set up in the base image!
# KDECI_ANDROID_SDK_ROOT: $ANDROID_HOME/sdk # <-- set up in the base image!
# KDECI_ANDROID_NDK_ROOT: $ANDROID_HOME/android-ndk-r22b/ # <-- set up in the base image!
@@ -19,9 +19,9 @@
-DHIDE_SAFE_ASSERTS=OFF
-DBUILD_TESTING=ON
-DCMAKE_TOOLCHAIN_FILE=$CI_PROJECT_DIR/krita-deps-management/tools/android-toolchain-krita.cmake
- KRITACI_ANDROID_PACKAGE_TYPE: "debug"
- KRITACI_SKIP_UPLOAD_NIGHTLY_PACKAGE: "True"
- KRITACI_PUBLISH_BUILD_CONFIG: "upstream-ci-utilities/signing/publishbuild.ini"
+ KRITACI_ANDROID_PACKAGE_TYPE: debug
+ KRITACI_SKIP_UPLOAD_NIGHTLY_PACKAGE: True
+ KRITACI_PUBLISH_BUILD_CONFIG: upstream-ci-utilities/signing/publishbuild.ini
interruptible: true
before_script:
- git clone https://invent.kde.org/dkazakov/krita-deps-management.git --depth=1
@@ -47,12 +47,12 @@
- .ci-artifacts-without-packages-mixin
interruptible: false
variables:
- KRITACI_ANDROID_PACKAGE_TYPE: "nightly"
+ KRITACI_ANDROID_PACKAGE_TYPE: nightly
KDECI_EXTRA_CMAKE_ARGS: >
-DHIDE_SAFE_ASSERTS=OFF
-DBUILD_TESTING=ON
-DCMAKE_TOOLCHAIN_FILE=$CI_PROJECT_DIR/krita-deps-management/tools/android-toolchain-krita.cmake
- KRITACI_SKIP_UPLOAD_NIGHTLY_PACKAGE: "False"
+ KRITACI_SKIP_UPLOAD_NIGHTLY_PACKAGE: False
.android-release-base:
extends:
@@ -60,7 +60,7 @@
- .ci-release-job-mixin
interruptible: false
variables:
- KRITACI_ANDROID_PACKAGE_TYPE: "release"
+ KRITACI_ANDROID_PACKAGE_TYPE: release
KRITACI_ANDROID_RELEASE_MODE: 1
KDECI_EXTRA_CMAKE_ARGS: >
-DHIDE_SAFE_ASSERTS=ON
@@ -73,8 +73,8 @@
KDECI_ANDROID_ABI: x86_64
KDECI_CC_CACHE: /mnt/caches/krita-android/x86_64/
KDECI_CACHE_PATH: /mnt/artifacts/krita-android/x86_64/
- KRITACI_ARCHIVE_ARTIFACTS: "True"
- KRITACI_SKIP_COMMON_ARTIFACTS: "True"
+ KRITACI_ARCHIVE_ARTIFACTS: True
+ KRITACI_SKIP_COMMON_ARTIFACTS: True
.android-arm64-v8a-mixin:
variables:
@@ -82,8 +82,8 @@
KDECI_ANDROID_ABI: arm64-v8a
KDECI_CC_CACHE: /mnt/caches/krita-android/arm64-v8a/
KDECI_CACHE_PATH: /mnt/artifacts/krita-android/arm64-v8a/
- KRITACI_ARCHIVE_ARTIFACTS: "True"
- KRITACI_SKIP_COMMON_ARTIFACTS: "False" # only arm64-v8a packages common artifacts
+ KRITACI_ARCHIVE_ARTIFACTS: True
+ KRITACI_SKIP_COMMON_ARTIFACTS: False # only arm64-v8a packages common artifacts
.android-armeabi-v7a-mixin:
variables:
@@ -91,8 +91,8 @@
KDECI_ANDROID_ABI: armeabi-v7a
KDECI_CC_CACHE: /mnt/caches/krita-android/armeabi-v7a/
KDECI_CACHE_PATH: /mnt/artifacts/krita-android/armeabi-v7a/
- KRITACI_ARCHIVE_ARTIFACTS: "True"
- KRITACI_SKIP_COMMON_ARTIFACTS: "True"
+ KRITACI_ARCHIVE_ARTIFACTS: True
+ KRITACI_SKIP_COMMON_ARTIFACTS: True
android-build-appbundle:
stage: deploy
diff --git a/build-tools/ci-scripts/linux.yml b/build-tools/ci-scripts/linux.yml
index 535ac2e26d4..db43c90ee35 100644
--- a/build-tools/ci-scripts/linux.yml
+++ b/build-tools/ci-scripts/linux.yml
@@ -13,10 +13,10 @@ linux-build:
KDECI_GITLAB_SERVER: https://invent.kde.org/
KDECI_PACKAGE_PROJECT: dkazakov/krita-ci-artifacts-appimage-qt5.15
KDECI_REPO_METADATA_PATH: $CI_PROJECT_DIR/krita-deps-management/repo-metadata
- KDECI_COMPRESS_PACKAGES_ON_DOWNLOAD: "False"
+ KDECI_COMPRESS_PACKAGES_ON_DOWNLOAD: False
KDECI_EXTRA_CMAKE_ARGS: -DHIDE_SAFE_ASSERTS=OFF
- KRITACI_SKIP_UPLOAD_NIGHTLY_PACKAGE: "True"
- KRITACI_PUBLISH_BUILD_CONFIG: "upstream-ci-utilities/signing/publishbuild.ini"
+ KRITACI_SKIP_UPLOAD_NIGHTLY_PACKAGE: True
+ KRITACI_PUBLISH_BUILD_CONFIG: upstream-ci-utilities/signing/publishbuild.ini
interruptible: true
before_script:
- git clone https://invent.kde.org/dkazakov/krita-deps-management.git krita-deps-management --depth=1
@@ -43,11 +43,11 @@ linux-nightly:
- .ci-artifacts-without-packages-mixin
interruptible: false
variables:
- KDECI_ONLY_BUILD: "True"
+ KDECI_ONLY_BUILD: True
KDECI_EXTRA_CMAKE_ARGS: >
-DHIDE_SAFE_ASSERTS=OFF
-DBUILD_TESTING=OFF
- KRITACI_SKIP_UPLOAD_NIGHTLY_PACKAGE: "False"
+ KRITACI_SKIP_UPLOAD_NIGHTLY_PACKAGE: False
linux-release:
extends:
@@ -55,7 +55,7 @@ linux-release:
- .ci-manual-job-mixin
interruptible: false
variables:
- KDECI_ONLY_BUILD: "True"
+ KDECI_ONLY_BUILD: True
KDECI_EXTRA_CMAKE_ARGS: >
-DHIDE_SAFE_ASSERTS=ON
-DBUILD_TESTING=OFF
diff --git a/build-tools/ci-scripts/macos.yml b/build-tools/ci-scripts/macos.yml
index a0a799b142b..185ee1f0973 100644
--- a/build-tools/ci-scripts/macos.yml
+++ b/build-tools/ci-scripts/macos.yml
@@ -27,8 +27,8 @@ macos-build:
#KDECI_REMOVE_INSTALL_FOLDERS_AFTER_BUILD: True
- KDECI_COMPRESS_PACKAGES_ON_DOWNLOAD: "False"
- KRITACI_SKIP_UPLOAD_NIGHTLY_PACKAGE: "True"
+ KDECI_COMPRESS_PACKAGES_ON_DOWNLOAD: False
+ KRITACI_SKIP_UPLOAD_NIGHTLY_PACKAGE: True
KRITACI_PUBLISH_BUILD_CONFIG: upstream-ci-utilities/signing/publishbuild.ini
interruptible: true
before_script:
@@ -76,12 +76,12 @@ macos-nightly:
interruptible: false
variables:
# still run the tests, since we don't run them for every commit!
- KDECI_ONLY_BUILD: "False"
+ KDECI_ONLY_BUILD: False
KDECI_EXTRA_CMAKE_ARGS: >
-DHIDE_SAFE_ASSERTS=OFF
-DBUILD_TESTING=ON
-DCMAKE_TOOLCHAIN_FILE=$CI_PROJECT_DIR/krita-deps-management/tools/macos-toolchain-krita.cmake
- KRITACI_SKIP_UPLOAD_NIGHTLY_PACKAGE: "False"
+ KRITACI_SKIP_UPLOAD_NIGHTLY_PACKAGE: False
# TODO: this pipeline is hidden currently (not implemented)
.macos-release:
@@ -90,7 +90,7 @@ macos-nightly:
- .ci-manual-job-mixin
interruptible: false
variables:
- KDECI_ONLY_BUILD: "True"
+ KDECI_ONLY_BUILD: True
KDECI_EXTRA_CMAKE_ARGS: >
-DHIDE_SAFE_ASSERTS=ON
-DBUILD_TESTING=OFF
diff --git a/build-tools/ci-scripts/windows.yml b/build-tools/ci-scripts/windows.yml
index 4c4101a6954..50722c7fe26 100644
--- a/build-tools/ci-scripts/windows.yml
+++ b/build-tools/ci-scripts/windows.yml
@@ -14,13 +14,13 @@ windows-build:
KDECI_PACKAGE_PROJECT: dkazakov/krita-ci-artifacts-windows-qt5.15
KDECI_REPO_METADATA_PATH: "$CI_PROJECT_DIR\\krita-deps-management\\repo-metadata"
# KDECI_WORKDIR_PATH: "C:\\_" # don't use separate workdir since package script will fail!
- KDECI_COMPRESS_PACKAGES_ON_DOWNLOAD: "False"
+ KDECI_COMPRESS_PACKAGES_ON_DOWNLOAD: False
KDECI_EXTRA_CMAKE_ARGS: -DHIDE_SAFE_ASSERTS=OFF
- KRITACI_SKIP_DEBUG_PACKAGE: "True"
- KRITACI_BUILD_INSTALLERS: "False"
- KRITACI_SKIP_UPLOAD_NIGHTLY_PACKAGE: "True"
- KRITACI_WINDOWS_SIGN_CONFIG: "upstream-ci-utilities/signing/signwindowsbinaries.ini"
- KRITACI_PUBLISH_BUILD_CONFIG: "upstream-ci-utilities/signing/publishbuild.ini"
+ KRITACI_SKIP_DEBUG_PACKAGE: True
+ KRITACI_BUILD_INSTALLERS: False
+ KRITACI_SKIP_UPLOAD_NIGHTLY_PACKAGE: True
+ KRITACI_WINDOWS_SIGN_CONFIG: upstream-ci-utilities/signing/signwindowsbinaries.ini
+ KRITACI_PUBLISH_BUILD_CONFIG: upstream-ci-utilities/signing/publishbuild.ini
interruptible: true
before_script:
- git clone https://invent.kde.org/dkazakov/krita-deps-management.git krita-deps-management --depth=1
@@ -49,13 +49,13 @@ windows-nightly:
interruptible: false
variables:
KDECI_BUILD_TYPE: RelWithDebInfo
- KDECI_ONLY_BUILD: "True"
- KRITACI_SKIP_DEBUG_PACKAGE: "False"
- KRITACI_BUILD_INSTALLERS: "True"
+ KDECI_ONLY_BUILD: True
+ KRITACI_SKIP_DEBUG_PACKAGE: False
+ KRITACI_BUILD_INSTALLERS: True
KDECI_EXTRA_CMAKE_ARGS: >
-DHIDE_SAFE_ASSERTS=OFF
-DBUILD_TESTING=OFF
- KRITACI_SKIP_UPLOAD_NIGHTLY_PACKAGE: "False"
+ KRITACI_SKIP_UPLOAD_NIGHTLY_PACKAGE: False
windows-release:
extends:
@@ -64,9 +64,9 @@ windows-release:
interruptible: false
variables:
KDECI_BUILD_TYPE: RelWithDebInfo
- KDECI_ONLY_BUILD: "True"
- KRITACI_SKIP_DEBUG_PACKAGE: "False"
- KRITACI_BUILD_INSTALLERS: "True"
+ KDECI_ONLY_BUILD: True
+ KRITACI_SKIP_DEBUG_PACKAGE: False
+ KRITACI_BUILD_INSTALLERS: True
KDECI_EXTRA_CMAKE_ARGS: >
-DHIDE_SAFE_ASSERTS=ON
-DBUILD_TESTING=OFF
More information about the kimageshop
mailing list