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

Commit cf37c10

Browse files
committed
feat/ci: add our gitlab-ci.yml
1 parent 3f318a8 commit cf37c10

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed

.gitlab-ci.yml

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# .gitlab-ci.yml
2+
#
3+
# sccache
4+
5+
stages:
6+
- check
7+
- test
8+
- deploy
9+
10+
variables:
11+
GIT_STRATEGY: fetch
12+
GIT_DEPTH: 100
13+
CARGO_INCREMENTAL: 0
14+
RUST_BACKTRACE: 1
15+
# this var is changed to "-:staging" when the CI image gets rebuilt
16+
# read more https://github.com/paritytech/scripts/pull/244
17+
CI_IMAGE: "paritytech/sccache-ci-ubuntu:staging" # temporary override
18+
19+
workflow:
20+
rules:
21+
- if: $CI_COMMIT_TAG
22+
- if: $CI_COMMIT_BRANCH
23+
24+
.docker-env: &docker-env
25+
image: "${CI_IMAGE}"
26+
before_script:
27+
- which gcc && gcc --version
28+
- which clang && clang --version
29+
- rustc +stable --version
30+
- rustc +nightly --version
31+
- sccache -s
32+
retry:
33+
max: 2
34+
when:
35+
- runner_system_failure
36+
- unknown_failure
37+
- api_failure
38+
interruptible: true
39+
tags:
40+
- linux-docker
41+
rules:
42+
- if: $CI_PIPELINE_SOURCE == "web"
43+
- if: $CI_PIPELINE_SOURCE == "schedule"
44+
- if: $CI_COMMIT_REF_NAME == "master"
45+
- if: $CI_COMMIT_REF_NAME == "tags"
46+
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
47+
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
48+
49+
.collect-artifacts: &collect-artifacts
50+
artifacts:
51+
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
52+
when: on_success
53+
expire_in: 7 days
54+
paths:
55+
- artifacts/
56+
57+
#### stage: check
58+
59+
fmt:
60+
<<: *docker-env
61+
stage: check
62+
script:
63+
- cargo fmt -- --check
64+
allow_failure: true
65+
66+
clippy:
67+
<<: *docker-env
68+
stage: check
69+
script:
70+
- cargo clippy --all-targets
71+
allow_failure: true
72+
73+
#### stage: test
74+
75+
nightly-test:
76+
<<: *docker-env
77+
stage: test
78+
variables:
79+
FEATURES: "unstable"
80+
script:
81+
- cargo +nightly build --verbose --features="${FEATURES}" || exit 1
82+
- cargo +nightly test --workspace --verbose --features="${FEATURES}"
83+
84+
stable-test:
85+
<<: *docker-env
86+
stage: test
87+
variables:
88+
FEATURES: ""
89+
script:
90+
- cargo +stable build --verbose --features="${FEATURES}" || exit 1
91+
- cargo +stable test --workspace --verbose --features="${FEATURES}"
92+
93+
# For now simply collect artifacts
94+
artifacts:
95+
<<: *docker-env
96+
<<: *collect-artifacts
97+
stage: deploy
98+
variables:
99+
FEATURES: "dist-client,dist-server"
100+
script:
101+
- cargo +stable build --release --features="${FEATURES}"
102+
# collect artifacts
103+
- mkdir -p ./artifacts/sccache/
104+
- mv ./target/release/sccache ./artifacts/sccache/.

0 commit comments

Comments
 (0)