Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

Commit

Permalink
feat/ci: add our gitlab-ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
drahnr committed Apr 30, 2021
1 parent 3f318a8 commit cf37c10
Showing 1 changed file with 104 additions and 0 deletions.
104 changes: 104 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# .gitlab-ci.yml
#
# sccache

stages:
- check
- test
- deploy

variables:
GIT_STRATEGY: fetch
GIT_DEPTH: 100
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: 1
# this var is changed to "-:staging" when the CI image gets rebuilt
# read more https://github.com/paritytech/scripts/pull/244
CI_IMAGE: "paritytech/sccache-ci-ubuntu:staging" # temporary override

workflow:
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH

.docker-env: &docker-env
image: "${CI_IMAGE}"
before_script:
- which gcc && gcc --version
- which clang && clang --version
- rustc +stable --version
- rustc +nightly --version
- sccache -s
retry:
max: 2
when:
- runner_system_failure
- unknown_failure
- api_failure
interruptible: true
tags:
- linux-docker
rules:
- if: $CI_PIPELINE_SOURCE == "web"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME == "tags"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1

.collect-artifacts: &collect-artifacts
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
when: on_success
expire_in: 7 days
paths:
- artifacts/

#### stage: check

fmt:
<<: *docker-env
stage: check
script:
- cargo fmt -- --check
allow_failure: true

clippy:
<<: *docker-env
stage: check
script:
- cargo clippy --all-targets
allow_failure: true

#### stage: test

nightly-test:
<<: *docker-env
stage: test
variables:
FEATURES: "unstable"
script:
- cargo +nightly build --verbose --features="${FEATURES}" || exit 1
- cargo +nightly test --workspace --verbose --features="${FEATURES}"

stable-test:
<<: *docker-env
stage: test
variables:
FEATURES: ""
script:
- cargo +stable build --verbose --features="${FEATURES}" || exit 1
- cargo +stable test --workspace --verbose --features="${FEATURES}"

# For now simply collect artifacts
artifacts:
<<: *docker-env
<<: *collect-artifacts
stage: deploy
variables:
FEATURES: "dist-client,dist-server"
script:
- cargo +stable build --release --features="${FEATURES}"
# collect artifacts
- mkdir -p ./artifacts/sccache/
- mv ./target/release/sccache ./artifacts/sccache/.

0 comments on commit cf37c10

Please sign in to comment.