-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.toml
More file actions
154 lines (132 loc) · 3.3 KB
/
Copy pathMakefile.toml
File metadata and controls
154 lines (132 loc) · 3.3 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
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#
# Cargo Make Configuration
#
[config]
reduce_output = false
skip_core_tasks = true
# This is a virtual workspace; run each task once at the root (our tasks already
# use --workspace) rather than letting cargo-make fan them out per member, where
# root-only tasks like assemble-release-assets don't exist.
default_to_workspace = false
#
# Environment and Profile Setup
#
# default profile
[env]
CAPSUDO_BUILD_FLAGS = ""
# TODO: support more than just linux when it makes sense
TARGET_ARCH = { condition.env_not_set = ["TARGET_ARCH"], value = "x86_64" }
TARGET_LIBC = { condition.env_not_set = ["TARGET_LIBC"], value = "musl" }
TARGET_VENDOR = { condition.env_not_set = ["TARGET_VENDOR"], value = "unknown" }
CARGO_BUILD_TARGET = { condition.env_not_set = [
"CARGO_BUILD_TARGET",
], value = "${TARGET_ARCH}-${TARGET_VENDOR}-linux-${TARGET_LIBC}" }
RUSTFLAG_STATIC = { condition.env_true = [
"STATIC_BINARY",
], value = "-Ctarget-feature=+crt-static" }
RUSTFLAGS = { script = ["echo ${RUSTFLAG_STATIC}"] }
# release profile
# Use with: cargo make --profile release <task>
[env.release]
CAPSUDO_BUILD_FLAGS = "--release"
#
# Tasks
#
[tasks.clippy]
install_crate = "clippy"
command = "cargo"
args = ["clippy", "--workspace", "--all-targets"]
dependencies = ["rustup-target-add"]
[tasks.format]
install_crate = "rustfmt"
command = "cargo"
args = ["fmt", "--", "--emit=files"]
[tasks.format-check]
install_crate = "rustfmt"
command = "cargo"
args = ["fmt", "--all", "--", "--check"]
[tasks.clean]
command = "cargo"
args = ["clean"]
[tasks.rustup-target-add]
command = "rustup"
args = ["target", "add", "${CARGO_BUILD_TARGET}"]
[tasks.build]
command = "cargo"
args = ["build", "--workspace", "@@split(CAPSUDO_BUILD_FLAGS, )"]
dependencies = ["rustup-target-add"]
[tasks.test]
command = "cargo"
args = ["test", "--workspace"]
dependencies = ["rustup-target-add"]
[tasks.ci]
dependencies = [
"format-check",
"clippy",
"build",
"test",
"shellcheck",
"shfmt",
]
[tasks.shellcheck-exists]
script = '''
if ! command -v shellcheck; then
echo "please install shellcheck"
exit 1
fi
'''
[tasks.shellcheck]
command = "./hack/code/shellcheck.sh"
dependencies = ["shellcheck-exists"]
[tasks.shfmt-exists]
script = '''
if ! command -v shfmt; then
echo "please install shfmt"
exit 1
fi
'''
[tasks.shfmt]
command = "./hack/code/shfmt.sh"
dependencies = ["shfmt-exists"]
[tasks.shfmt-write]
env = { CAPSUDO_SHFMT_WRITE = "true" }
command = "./hack/code/shfmt.sh"
dependencies = ["shfmt-exists"]
[tasks.zizmor-exists]
script = '''
if ! command -v zizmor; then
echo "please install zizmor"
exit 1
fi
'''
[tasks.zizmor]
script = '''
GH_TOKEN=$(gh auth token) zizmor --pedantic .
'''
dependencies = ["check-gh-installed", "zizmor-exists"]
#
# Release Tasks
#
[tasks.assets-exist]
script = '''
if [ ! -d ./target/assets ]; then
echo "./target/assets does not exist"
exit 1
fi
'''
[tasks.release-exists]
script = '''
if [ ! -d ./target/${CARGO_BUILD_TARGET}/release ]; then
echo "./target/${CARGO_BUILD_TARGET}/release does not exist"
exit 1
fi
'''
[tasks.assemble-release-assets]
command = "./hack/ci/assemble-release-assets.sh"
dependencies = ["release-exists"]
[tasks.check-gh-installed]
command = "which"
args = ["gh"]
[tasks.upload-release-assets]
command = "./hack/ci/upload-release-assets.sh"
dependencies = ["check-gh-installed", "assets-exist"]