From 1f73847d3d29fa0537ba85a6162665a25b8cac3d Mon Sep 17 00:00:00 2001 From: TriplEight Date: Thu, 2 May 2019 14:51:27 +0200 Subject: [PATCH] WIP: ci uses new docker image (#236) * ci uses new docker image * image renamed to parity/rust-builder:latest * cleanup --- polkadot/.gitlab-ci.yml | 35 +++++++++++++---------------------- polkadot/scripts/init.sh | 6 ++++-- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/polkadot/.gitlab-ci.yml b/polkadot/.gitlab-ci.yml index 1a455edaff..398a77baef 100644 --- a/polkadot/.gitlab-ci.yml +++ b/polkadot/.gitlab-ci.yml @@ -13,19 +13,19 @@ stages: - publish - deploy -image: parity/rust:nightly +image: parity/rust-builder:latest variables: + GIT_STRATEGY: fetch + CARGO_HOME: "/ci-cache/${CI_PROJECT_NAME}/cargo/${CI_JOB_NAME}" + SCCACHE_DIR: "/ci-cache/${CI_PROJECT_NAME}/sccache" + SCCACHE_CACHE_SIZE: 50G CI_SERVER_NAME: "GitLab CI" - CARGO_HOME: "${CI_PROJECT_DIR}/.cargo" - # have OS based build containers in the future - DOCKER_OS: "ubuntu:xenial" + DOCKER_OS: "debian:stretch" ARCH: "x86_64" -cache: {} - .collect-artifacts: &collect-artifacts artifacts: name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}" @@ -62,13 +62,8 @@ check-merge-conflict: -test-linux-stable: &test +test-linux-stable: &test stage: test - cache: - key: "${CI_JOB_NAME}-test" - paths: - - ${CARGO_HOME} - - ./target variables: RUST_TOOLCHAIN: stable # Enable debug assertions since we are running optimized builds for testing @@ -87,12 +82,11 @@ test-linux-stable: &test variables: - $DEPLOY_TAG before_script: - - test -d ${CARGO_HOME} -a -d ./target && - echo "build cache size:" && - du -h --max-depth=2 ${CARGO_HOME} ./target + - sccache -s - ./scripts/build.sh script: - time cargo test --all --release --verbose --locked + - sccache -s @@ -107,11 +101,6 @@ test-linux-stable: &test build-linux-release: &build stage: build - cache: - key: "${CI_JOB_NAME}-build" - paths: - - ${CARGO_HOME} - - ./target <<: *collect-artifacts <<: *build-only except: @@ -120,7 +109,8 @@ build-linux-release: &build tags: - linux-docker before_script: - - ./scripts/build.sh + - sccache -s + - ./scripts/build.sh script: - time cargo build --release --verbose - mkdir -p ./artifacts @@ -135,6 +125,7 @@ build-linux-release: &build fi - sha256sum ./artifacts/polkadot | tee ./artifacts/polkadot.sha256 - cp -r scripts/docker/* ./artifacts + - sccache -s @@ -143,7 +134,7 @@ build-linux-release: &build stage: publish dependencies: - build-linux-release - cache: {} + cache: {} <<: *build-only <<: *kubernetes-build diff --git a/polkadot/scripts/init.sh b/polkadot/scripts/init.sh index 406a3dfdce..cf5ecf9792 100755 --- a/polkadot/scripts/init.sh +++ b/polkadot/scripts/init.sh @@ -4,8 +4,10 @@ set -e echo "*** Initializing WASM build environment" -rustup update nightly -rustup update stable +if [ -z $CI_PROJECT_NAME ] ; then + rustup update nightly + rustup update stable +fi rustup target add wasm32-unknown-unknown --toolchain nightly