-
-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathcargo.yaml
More file actions
81 lines (72 loc) · 2.78 KB
/
cargo.yaml
File metadata and controls
81 lines (72 loc) · 2.78 KB
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
# SPDX-FileCopyrightText: 2024 AerynOS Developers
# SPDX-License-Identifier: MPL-2.0
actions:
- cargo_set_environment:
description: Set environmental variables for Cargo build
command: |
CARGO_BUILD_DEP_INFO_BASEDIR="%(workdir)"; export CARGO_BUILD_DEP_INFO_BASEDIR;
CARGO_NET_RETRY=5; export CARGO_NET_RETRY;
CARGO_PROFILE_RELEASE_DEBUG="full"; export CARGO_PROFILE_RELEASE_DEBUG;
CARGO_PROFILE_RELEASE_SPLIT_DEBUGINFO="off"; export CARGO_PROFILE_RELEASE_SPLIT_DEBUGINFO;
CARGO_PROFILE_RELEASE_LTO="off"; export CARGO_PROFILE_RELEASE_LTO;
CARGO_PROFILE_RELEASE_STRIP="none"; export CARGO_PROFILE_RELEASE_STRIP;
example: |
environment: |
%cargo_set_environment
- cargo_fetch:
description: Fetch dependencies
command: |
cargo fetch -v --locked
dependencies:
- binary(cargo)
- cargo_vendor:
description: Vendor all dependencies
command: |
mkdir -pv ./.cargo
cargo vendor -v --locked >> ./.cargo/config.toml
dependencies:
- binary(cargo)
- cargo_build:
description: Build the rust project to %(cargo_target_dir)
command: |
cargo build %(options_cargo_release)
dependencies:
- binary(cargo)
- cargo_install:
description: Install the build artefacts from %(cargo_target_dir)
command: |
cargo_install(){
if [ $# -gt 0 ]; then
for binary in "$@"; do
%install_bin %(cargo_target_dir)/"$binary"
done
else
%install_bin %(cargo_target_dir)/%(name)
fi
}
cargo_install
dependencies:
- binary(cargo)
- cargo_test:
description: Run tests
command: |
cargo test %(options_cargo_release) --workspace
dependencies:
- binary(cargo)
# Some builds might break if CARGO_HOME is set (used for the global cargo cache). Add a descriptive macro for when this is the case
- cargo_home_breaks_this_build:
description: Use this macro to indicate that setting CARGO_HOME breaks this build
example: |
environment: |
%cargo_home_breaks_this_build
command: |
unset CARGO_HOME
definitions:
# The default cargo build profile
- cargo_profile: "release"
# Location of generated artifacts, relative to the working dir
- cargo_target_dir: "target/%(target_triple)/%(cargo_profile)"
- options_cargo: |
-v -j "%(jobs)" --frozen --target %(target_triple)
- options_cargo_release: |
%(options_cargo) --release