-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrust.gitlab-ci.yml
51 lines (44 loc) · 1.23 KB
/
rust.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
image: 'rust:latest'
stages:
- test
- doc
- prepare
- build
- check
- version
- deploy
variables:
CARGO_HOME: $CI_PROJECT_DIR/cargo
include:
- local: kube.gitlab-ci.yml
prepare artifact:
stage: prepare
image: ekidd/rust-musl-builder
before_script:
- sudo chown rust -R .
script:
- cargo build --release --target x86_64-unknown-linux-musl
artifacts:
paths: [target/x86_64-unknown-linux-musl/release/$CI_PROJECT_TITLE]
prepare tools:
stage: prepare
image: alpine
script:
- apk add --no-cache git
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/instalitre/ci-workflow.git ci-tools
artifacts:
paths:
- ci-tools/
build:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- sed 's|_BINARY_NAME_|'"$CI_PROJECT_TITLE"'|g' ci-tools/templates/rust.Dockerfile.tpl > rust.Dockerfile;
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/rust.Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
cache:
paths:
- cargo/
- target/