diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2897723ae3f15eaefbb785ff83f5d56b607be489..c192b221c7dbe1479f0af3292950d6b3ffcb73c9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,8 @@ stages: + - build - package + - publish + - docs image: parity/rust:gitlab-ci @@ -11,9 +14,59 @@ variables: BUILD_ARCH: amd64 CARGO_TARGET: x86_64-unknown-linux-gnu +cache: + key: "${CI_JOB_NAME}" + paths: + - ${CI_PROJECT_DIR}/target/ + - ${CI_PROJECT_DIR}/cargo/ + +.releaseable_branches: # list of git refs for building GitLab artifacts (think "pre-release binaries") + only: &releaseable_branches + - master + - stable + - beta + - tags + +.publishable_branches: # list of git refs for publishing builds to the "production" locations + only: &publishable_branches + - nightly # Our nightly builds from schedule, on `master` + - "v2*" # Our version tags + +.collect_artifacts: &collect_artifacts + artifacts: + name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}" + when: on_success + expire_in: 1 mos + paths: + - artifacts/ + +.determine_version: &determine_version | + export VERSION=$(grep -m 1 "version =" Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n") + echo "Version" $VERSION + + +#### stage: build + +build-linux-ubuntu-amd64: &build + stage: build + only: *releaseable_branches + variables: + CARGO_TARGET: x86_64-unknown-linux-gnu + script: + - scripts/gitlab/build-unix.sh + <<: *collect_artifacts + tags: + - rust-stable + allow_failure: true + +#### stage: package + package-linux-snap-amd64: &package_snap stage: package + only: *releaseable_branches cache: {} + before_script: + - *determine_version variables: CARGO_TARGET: x86_64-unknown-linux-gnu dependencies: @@ -22,3 +75,5 @@ package-linux-snap-amd64: &package_snap - scripts/gitlab/package-snap.sh tags: - rust-stable + <<: *collect_artifacts +