-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
95 lines (89 loc) · 1.57 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
stages:
- dep
- build
- test
- release
variables:
BUILD_BASE: rust:1 # rust:1-alpine3.14
dep:
image: $BUILD_BASE
stage: dep
script:
- mkdir -p .cargo
- export CARGO_HOME=$(pwd)/.cargo
- cargo install --path .
cache:
- &cache_settings
paths:
- .cargo
- target/debug
# - target/release
key: &cache_key
files:
- Cargo.lock
policy: pull-push
build:latest:
image: $BUILD_BASE
stage: build
tags:
- docker
script:
- mkdir -p .cargo
- export CARGO_HOME=$(pwd)/.cargo
- cargo build
only:
- master
cache:
- <<: *cache_settings
policy: pull
artifacts:
paths:
- target/debug/nbd-rs
expire_in: 1 month
build:release:
image: $BUILD_BASE
stage: release
tags:
- docker
script:
- mkdir -p .cargo
- export CARGO_HOME=$(pwd)/.cargo
- cargo build --release
only:
- tags
artifacts:
paths:
- target/release/nbd-rs
expire_in: never
build:dev:
image: $BUILD_BASE
stage: build
tags:
- docker
script:
- mkdir -p .cargo
- export CARGO_HOME=$(pwd)/.cargo
- cargo build
except:
- master
cache:
- <<: *cache_settings
policy: pull
artifacts:
paths:
- target/debug/nbd-rs
expire_in: 2 days
test:unit:
image: $BUILD_BASE
stage: test
before_script:
- fallocate -l 64M alpine # dummy image file
script:
- mkdir -p .cargo
- export CARGO_HOME=$(pwd)/.cargo
- cargo test -- --test-threads 1
after_script:
- rm alpine
cache:
- <<: *cache_settings
policy: pull