-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
55 lines (49 loc) · 1.31 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
image: "rust:latest"
stages:
- build
- build-image
.build_deps:
before_script:
- apt-get update -yqq
- apt-get install -yqq --no-install-recommends build-essential
- apt-get install -yqq musl-tools
- rustup target add x86_64-unknown-linux-musl
build:regular:
stage: build
extends: .build_deps
rules:
- if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_TAG
script:
- cargo build --release
artifacts:
paths:
- target/release/xenbakd
build:musl:
stage: build
variables:
RUSTFLAGS: "-C link-arg=-s"
extends: .build_deps
rules:
- if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_TAG
script:
- cargo build --release --target x86_64-unknown-linux-musl
artifacts:
paths:
- target/x86_64-unknown-linux-musl/release/xenbakd
.build-image:
stage: build-image
image: docker:27.3
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY --username $CI_REGISTRY_USER --password-stdin
build-image:
extends: .build-image
stage: build-image
image: docker:latest
needs:
- job: build:regular
artifacts: true
rules:
- if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_TAG
script:
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME --file deploy/docker/Dockerfile .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME