forked from golemcloud/golem-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.toml
More file actions
261 lines (222 loc) · 7.74 KB
/
Makefile.toml
File metadata and controls
261 lines (222 loc) · 7.74 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# List of top-level tasks intended for use:
#
# - `cargo make dev-flow` or just `cargo make`: runs a full development flow, including fixing format and clippy, building and running tests
# - `cargo make build`: builds everything in debug mode
# - `cargo make build-release`: builds everything in release mode. customizable with PLATFORM_OVERRIDE env variable for docker builds
# - `cargo make check`: runs rustfmt and clippy checks without applying any fix
# - `cargo make fix`: runs rustfmt and clippy checks and applies fixes
# - `cargo make test`: runs all tests
# - `cargo make unit-tests`: runs all unit tests
# - `cargo make integration-tests`: runs all integrations tests
# - `cargo make cli-integration-tests`: runs cli integrations tests only
# - `cargo make template-integration-tests`: runs template tests only
# - `cargo make publish`: publishes packages to crates.io
# - `cargo make desktop`: builds the desktop application
# - `cargo make dev-desktop`: run the desktop application
[config]
default_to_workspace = false # by default, we run cargo commands on top level instead of per member
skip_core_tasks = true # we are not using the predefined cargo-make flows, instead redefine here for more clarity
[env]
JUNIT_OPTS = ""
[env.ci]
CARGO_INCREMENTAL = "false"
JUNIT_OPTS = "--format junit --logfile target/report.xml"
[tasks.default]
description = "This is the task that gets executed by 'cargo make' when no task is specified"
run_task = "dev-flow"
[tasks.dev]
description = "Alias to the dev-flow task"
alias = "dev-flow"
[tasks.dev-flow]
description = "Runs a full development flow, including fixing format and clippy, building and running tests"
dependencies = [
"fix",
"check",
"build",
"test"
]
[tasks.build]
description = "Builds everything in debug mode"
command = "cargo"
args = ["build", "--workspace", "--all-targets"]
[tasks.build-release]
description = """Builds everything in release mode"""
dependencies = ["set-version"]
command = "cargo"
args = ["build", "--release"]
## ** CHECK **
[tasks.check]
description = "Runs rustfmt and clippy checks without applying any fix"
dependencies = ["check-clippy", "check-rustfmt"]
[tasks.check-rustfmt]
description = "Runs rustfmt checks without applying any fix"
install_crate = "rustfmt"
command = "cargo"
args = ["fmt", "--all", "--", "--check"]
[tasks.check-clippy]
description = "Runs clippy checks without applying any fix"
install_crate = "clippy"
command = "cargo"
args = ["clippy", "--all-targets", "--", "--no-deps", "-Dwarnings"]
## ** FIX **
[tasks.fix]
description = "Runs rustfmt and clippy checks and applies fixes"
dependencies = ["fix-clippy", "fix-rustfmt"]
[tasks.fix-rustfmt]
description = "Runs rustfmt checks and applies fixes"
install_crate = "rustfmt"
command = "cargo"
args = ["fmt", "--all"]
[tasks.fix-clippy]
description = "Runs clippy checks and applies fixes"
install_crate = "clippy"
command = "cargo"
args = ["clippy", "--fix", "--allow-dirty", "--allow-staged", "--", "--no-deps", "-Dwarnings"]
## ** INSTALL - DEBUG **
[tasks.install-debug]
description = "Install bins in debug mode"
dependencies = ["install-golem-cli-debug", "install-golem-debug"]
[tasks.install-golem-cli-debug]
description = "Install golem-cli (debug)"
script_runner = "@duckscript"
script = '''
exec --fail-on-error cargo install --debug --path golem-cli --bin golem-cli --target-dir target --locked --offline
'''
[tasks.install-golem-debug]
description = "Install golem (debug)"
script_runner = "@duckscript"
script = '''
exec --fail-on-error cargo install --debug --path golem --bin golem --target-dir target --locked --offline
'''
## ** INSTALL - RELEASE **
[tasks.install-release]
description = "Install bins in debug mode"
dependencies = ["install-golem-cli-release", "install-golem-release"]
[tasks.install-golem-cli-release]
description = "Install golem-cli (debug)"
script_runner = "@duckscript"
script = '''
exec --fail-on-error cargo install --path golem-cli --bin golem-cli --target-dir target --locked --offline
'''
[tasks.install-golem-release]
description = "Install golem (debug)"
script_runner = "@duckscript"
script = '''
exec --fail-on-error cargo install --path golem --bin golem --target-dir target --locked --offline
'''
## ** TEST **
[tasks.test]
dependencies = ["unit-tests", "integration-tests"]
[tasks.unit-tests]
description = "Run unit tests"
script_runner = "@duckscript"
script = '''
exec --fail-on-error cargo test --workspace --lib --all-features -- --nocapture --report-time %{JUNIT_OPTS}
'''
[tasks.integration-tests]
description = "Run integration tests"
dependencies = ["cli-integration-tests", "template-integration-tests"]
[tasks.cli-integration-tests]
description = "Run CLI integration tests"
script_runner = "@duckscript"
script = '''
exec --fail-on-error cargo test --package golem-cli :tag: --test integration -- --nocapture --report-time %{JUNIT_OPTS}
exec --fail-on-error cargo test --package golem-cli :tag:app --test integration -- --nocapture --test-threads=1 --report-time %{JUNIT_OPTS}
exec --fail-on-error cargo test --package golem-cli :tag:uses_cargo --test integration -- --nocapture --test-threads=1 --report-time %{JUNIT_OPTS}
'''
[tasks.template-integration-tests]
dependencies = ["build"]
description = "Run template integration tests"
script_runner = "@duckscript"
script = '''
exec --fail-on-error cargo test --package golem-templates --test integration -- --nocapture --test-threads=1 --report-time %{JUNIT_OPTS}
'''
## ** DESKTOP APP **
[tasks.desktop]
description = "Builds the desktop application"
dependencies = ["npm-install"]
command = "npm"
args = ["run", "tauri", "build"]
cwd = "./desktop-app"
[tasks.dev-desktop]
description = "Run the desktop application"
dependencies = ["npm-install"]
command = "npm"
args = ["run", "tauri", "dev"]
cwd = "./desktop-app"
[tasks.npm-install]
description = "Install npm dependencies"
command = "npm"
args = ["install"]
cwd = "./desktop-app"
## Publishing
[tasks.set-version]
description = "Sets the version in all Cargo.toml files to the value of the VERSION environment variable"
condition = { env_set = ["VERSION"] }
script = '''
grep -rl --include 'Cargo.toml' '0\.0\.0' | xargs sed -i "s/0\.0\.0/${VERSION}/g"
'''
[tasks.set-version.mac]
condition = { env_set = ["VERSION"] }
script = '''
grep -rl --include '.*Cargo\.toml' '0\.0\.0' | xargs sed -i "" "s/0\.0\.0/${VERSION}/g"
'''
[tasks.set-version.windows]
script_runner = "powershell"
script_extension = "ps1"
condition = { env_set = ["VERSION"] }
script = '''
$cargoFiles = Get-ChildItem . Cargo.toml -rec
foreach ($file in $cargoFiles)
{
(Get-Content $file.PSPath) |
Foreach-Object { $_ -replace "0.0.0", $Env:VERSION } |
Set-Content $file.PSPath
}
'''
[tasks.publish]
description = "Publishes packages to crates.io"
dependencies = [
"build-release",
"publish-golem-cli",
]
[tasks.publish-golem-templates]
description = "Publishes golem-templates package to crates.io"
command = "cargo"
args = [
"publish",
"-p",
"golem-templates",
"--all-features",
"--allow-dirty",
"--no-verify",
]
[tasks.publish-golem-cli]
description = "Publishes golem-cli package to crates.io"
dependencies = [
"publish-golem-templates",
]
command = "cargo"
args = [
"publish",
"-p",
"golem-cli",
"--all-features",
"--allow-dirty",
"--no-verify",
]
## ** APP MANIFEST SCHEMA **
[tasks.publish-app-manifest-json-schema]
description = "Publish application manifest schemas to S3 (https://schema.golem.cloud)"
command = "aws"
args = [
"s3",
"sync",
"schema.golem.cloud",
"s3://schema.golem.cloud",
]
[tasks.serve-app-manifest-json-schema]
description = "Serve the schema.golem.cloud directory locally to help testing the schemas in editors"
install_crate = "miniserve"
command = "miniserve"
args = ["--interfaces", "127.0.0.1", "--port", "41357", "schema.golem.cloud"]