-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
107 lines (97 loc) · 2.22 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
105
106
107
image: "rust:slim"
stages:
- check
- build
- test
- release
# Variable defaults
variables:
RUST_VERSION: stable
RUST_TARGET: x86_64-unknown-linux-gnu
# Cache rust/cargo/build artifacts
cache:
key: "$CI_PIPELINE_ID-$RUST_VERSION"
paths:
- /usr/local/cargo/registry/
- /usr/local/rustup/toolchains/
- /usr/local/rustup/update-hashes/
- target/
# Install compiler
before_script:
- |
rustup install $RUST_VERSION
rustup default $RUST_VERSION
- |
rustc --version
cargo --version
# Check on stable, beta and nightly
.check-base: &check-base
stage: check
script:
- cargo check --verbose
check-stable:
<<: *check-base
check-beta:
<<: *check-base
variables:
RUST_VERSION: beta
check-nightly:
<<: *check-base
variables:
RUST_VERSION: nightly
check-old:
<<: *check-base
variables:
RUST_VERSION: "1.40.0"
# Build using Rust stable
build-x86_64-linux-gnu:
stage: build
needs:
- check-stable
script:
- cargo build --target=$RUST_TARGET --release --verbose
- mv target/$RUST_TARGET/release/rp2g ./rp2g-$RUST_TARGET
- strip -g ./rp2g-$RUST_TARGET
artifacts:
name: rp2g-x86_64-linux-gnu
paths:
- rp2g-$RUST_TARGET
expire_in: 1 month
# Build a static version
build-x86_64-linux-musl:
stage: build
needs:
- check-stable
variables:
RUST_TARGET: x86_64-unknown-linux-musl
script:
- rustup target add $RUST_TARGET
- cargo build --target=$RUST_TARGET --release --verbose
# Prepare the release artifact, strip it
- find . -name rp2g -exec ls -lah {} \;
- mv target/$RUST_TARGET/release/rp2g ./rp2g-$RUST_TARGET
- strip -g ./rp2g-$RUST_TARGET
artifacts:
name: rp2g-x86_64-linux-musl
paths:
- rp2g-$RUST_TARGET
expire_in: 1 month
# Run the unit tests through Cargo
test-cargo:
stage: test
needs:
- check-stable
dependencies: []
script:
- cargo test --verbose
# # Cargo crate release
# release-crate:
# stage: release
# dependencies: []
# only:
# - /^v(\d+\.)*\d+$/
# script:
# - echo "Creating release crate to publish on crates.io..."
# - echo $CARGO_TOKEN | cargo login
# - echo "Publishing crate to crates.io..."
# - cargo publish --verbose --allow-dirty