-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
105 lines (94 loc) · 2.38 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
96
97
98
99
100
101
102
103
104
# set up cache to speed up builds
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- .cargo/
- .cache/sccache
stages:
- test
- build
- deploy
# make sure that formatting is correct.
check-formatting:
image: registry.gitlab.com/fractalnetworks/images/rust-stable:v1
stage: test
allow_failure: true
script:
- source ci-setup-cargo
- cargo fmt -- --check
interruptible: true
# make sure there are no issues with the code.
check-mistakes:
image: registry.gitlab.com/fractalnetworks/images/rust-stable:v1
stage: test
allow_failure: true
script:
- source ci-setup-cargo
- cargo clippy
interruptible: true
# when pushing a tag, make sure that the tag version
# matches the version set in the Cargo.toml file.
check-version:
image: debian:11
stage: test
script:
- test $(sed -rn 's/^version = "(.+)"/v\1/p' Cargo.toml | head -n 1) = "$CI_COMMIT_TAG"
rules:
- if: $CI_COMMIT_TAG
# run unit tests.
test:
image: registry.gitlab.com/fractalnetworks/images/rust-stable:v1
stage: test
script:
- source ci-setup-cargo
- apt update
- apt install -y iproute2 iptables wireguard-tools
- cargo test --all-features -- --test-threads 1 --include-ignored
interruptible: true
# generate release build
build:amd64:
image: registry.gitlab.com/fractalnetworks/images/rust-stable:v1
stage: build
script:
- ci-setup-cargo
- cargo build --release
# build for arm target
build:arm32:
image: registry.gitlab.com/fractalnetworks/images/rust-stable-arm32:v1
stage: build
script:
- ci-setup-cargo
- cargo build --release --target arm-unknown-linux-gnueabihf
# build for arm target
build:arm64:
image: registry.gitlab.com/fractalnetworks/images/rust-stable-arm64:v1
stage: build
script:
- ci-setup-cargo
- cargo build --release --target aarch64-unknown-linux-gnu
# generate rust html documentation
rustdoc:
image: registry.gitlab.com/fractalnetworks/images/rust-stable:v1
stage: build
script:
- ci-setup-cargo
- cargo doc --all-features --no-deps
artifacts:
paths:
- target/doc
expire_in: 1 week
# publish binary, docs and API docs to gitlab pages.
pages:
image: registry.gitlab.com/fractalnetworks/images/pages:v1
stage: deploy
dependencies:
- rustdoc
script:
- mkdir public
- mv target/doc public/doc
artifacts:
paths:
- public
expire_in: 1 week
only:
- main