From 888a2f7fa169d6f0fd13d0a36633814d10d42190 Mon Sep 17 00:00:00 2001 From: Jonas Zohren Date: Mon, 12 Jul 2021 19:58:35 +0000 Subject: [PATCH 1/3] Make CI run on famedly runners By default, jobs without tags only run on CI runners configured to do so [1]. Conduit can use famedly runners, which are more powerfull than gitlab's runners, but require a tag on the job to run it there. This commit tags each job with the "docker" tag. On the famedly/conduit repo this means faster CI. On other gitlab.com forks the normal ci. Selfhosted gitlab's might need to add a "docker" tag to their runner. [1]: https://docs.gitlab.com/ee/ci/runners/configure_runners.html#use-tags-to-limit-the-number-of-jobs-using-the-runner --- .gitlab-ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 005f0ee9..14c10ed1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,10 +9,12 @@ variables: CACHE_COMPRESSION_LEVEL: fastest + test:cargo: stage: "test" needs: [] image: "rust:latest" + tags: ["docker"] variables: CARGO_HOME: "cargohome" cache: @@ -43,6 +45,7 @@ test:cargo: - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' interruptible: true image: "rust:latest" + tags: ["docker"] cache: paths: - cargohome @@ -103,6 +106,7 @@ build:cargo:aarch64-unknown-linux-gnu: - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' interruptible: true image: "rust:latest" + tags: ["docker"] cache: paths: - cargohome @@ -149,6 +153,7 @@ publish:package: rules: - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' image: curlimages/curl:latest + tags: ["docker"] variables: GIT_STRATEGY: "none" # Don't need a clean copy of the code, we just operate on artifacts script: From 0080932aef8effc75ff6ca508eaa0fc3da23c16a Mon Sep 17 00:00:00 2001 From: Jonas Zohren Date: Mon, 12 Jul 2021 20:18:14 +0000 Subject: [PATCH 2/3] Speed up release builds Setting cargo to run incremental builds means partial build results should be cached. This is not enabled by default in release mode. Incremental builds use 256 codegen units by default [1]. We set them to 16 (release default) again for somewhat faster code but slightly slower builds. [1]: https://doc.rust-lang.org/cargo/reference/profiles.html#codegen-units --- .gitlab-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 14c10ed1..2fb9d542 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -60,6 +60,9 @@ test:cargo: - "apt-get install -yqq --no-install-recommends $NEEDED_PACKAGES" - "rustup target add $TARGET" script: + # Set some cargo tuning here, because targets overwrite the 'variables' + - "export CARGO_INCREMENTAL=true" + - "export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=16" - time cargo build --target $TARGET --release - 'mv "target/$TARGET/release/conduit" "conduit-$TARGET"' artifacts: From 3fa09ff57de49ccbd5c0ad48fbcdf88837b743b2 Mon Sep 17 00:00:00 2001 From: Jonas Zohren Date: Mon, 12 Jul 2021 20:21:13 +0000 Subject: [PATCH 3/3] Use thin-lto [1] for "better" release builds. This performs a rather quick variant of Link Time Optimization [2]. It should add negligible build time but also more optimized binaries. [1]: https://doc.rust-lang.org/cargo/reference/profiles.html#lto [2]: https://llvm.org/docs/LinkTimeOptimization.html --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2fb9d542..424dc969 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -63,6 +63,7 @@ test:cargo: # Set some cargo tuning here, because targets overwrite the 'variables' - "export CARGO_INCREMENTAL=true" - "export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=16" + - "export CARGO_PROFILE_RELEASE_LTO=thin" - time cargo build --target $TARGET --release - 'mv "target/$TARGET/release/conduit" "conduit-$TARGET"' artifacts: