-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.toml
More file actions
167 lines (143 loc) · 4.16 KB
/
Makefile.toml
File metadata and controls
167 lines (143 loc) · 4.16 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
[tasks.release]
workspace = false
script = '''
#!/bin/sh
set +e
NEW_VERSION=${1:-${NEW_VERSION?Expecting <version> argument or NEW_VERSION env variable. E.g. 1.0.0}}
OLD_VERSION=$(tomlq --raw-output ".workspace.package.version" Cargo.toml)
# Files to keep synced
files="Cargo.toml leptodon/Cargo.toml proc-macros/Cargo.toml"
for file in $files; do
# Update the marked lines
sed -i "/version-sync-⤴️/s/$OLD_VERSION/$NEW_VERSION/g" "$file"
done
tomlq -it "(.package[] | select(.name == \"leptodon\")).version = \"$NEW_VERSION\"" Cargo.lock
tomlq -it "(.package[] | select(.name == \"leptodon-proc-macros\")).version = \"$NEW_VERSION\"" Cargo.lock
'''
[tasks.license-check]
workspace = false
command = "licensure"
args = ["--check", "--project"]
# Builds
[tasks.build-demo]
workspace = false
cwd = "demo"
command = "cargo"
args = ["leptos", "build", "--release", "--precompress", "-vv"]
# Lints
[tasks.lint-leptodon]
workspace = false
cwd = "./leptodon"
command = "cargo"
args = ["clippy", "--all-targets", "--all-features", "--", "-D", "warnings"]
[tasks.lint-test-overview]
workspace = false
cwd = "./overview"
command = "cargo"
args = ["clippy", "--all-targets", "--all-features", "--", "-D", "warnings"]
[tasks.lint-test-overview-codegen]
workspace = false
cwd = "./overview/codegen"
command = "cargo"
args = ["clippy", "--all-targets", "--all-features", "--", "-D", "warnings"]
[tasks.lint-demo]
workspace = false
cwd = "./demo"
command = "cargo"
args = ["clippy", "--all-targets", "--all-features", "--", "-D", "warnings"]
[tasks.lint-demo-codegen]
workspace = false
cwd = "./demo/codegen"
command = "cargo"
args = ["clippy", "--all-targets", "--all-features", "--", "-D", "warnings"]
[tasks.lint-demo-macros]
workspace = false
cwd = "./proc-macros"
command = "cargo"
args = ["clippy", "--all-targets", "--all-features", "--", "-D", "warnings"]
[tasks.lint]
workspace = false
run_task = { name = [
"lint-leptodon",
"lint-test-overview",
"lint-test-overview-codegen",
"lint-demo",
"lint-demo-codegen",
"lint-demo-macros",
] }
# Tests
[tasks.unit-tests]
workspace = false
cwd = "./leptodon"
command = "cargo"
args = ["nextest", "run", "-r"]
[tasks.integration-tests]
workspace = false
cwd = "./overview"
command = "cargo"
args = ["leptos", "end-to-end", "--precompress", "--release"]
[tasks.tests]
workspace = false
run_task = { name = [
"unit-tests",
"integration-tests"
] }
# Styles
[tasks.styles]
workspace = false
script = '''
#!/bin/sh
set +e
cd overview/codegen; cargo run; cd ..; npx tailwindcss -i input.css -o style/output.css; cd ..;
cd demo/codegen; cargo run; cd ..; npx tailwindcss -i input.css -o style/output.css; cd ..;
'''
# Tries to run the same checks as the CI, locally.
[tasks.mimic-ci]
workspace = false
run_task = { name = [
"license-check",
"lint",
"tests"
] }
# Publish tasks
[tasks.publish-if-missing]
workspace = false
script = '''
#!/bin/sh
set +e
crate=${1:-${PUBLISH_CRATE?Expecting <crate> argument or PUBLISH_CRATE env variable. E.g. leptodon, leptodon-proc-macros}}
# Source - https://stackoverflow.com/a/20460402
# Posted by F. Hauri - Give Up GitHub, modified by community. See post 'Timeline' for change history
# Retrieved 2026-03-19, License - CC BY-SA 4.0
stringContain() { case $2 in *$1* ) return 0;; *) return 1;; esac ;}
# End
local_version=$(
cargo info $crate -q --color never |\
grep -oP '^version:\s*\K[^\s]+'
);
remote_version=$(
cargo search --quiet --limit 1 --color never $crate |\
grep -oP "$crate\s*=\s*\"\K[^\"]+"
);
if stringContain "dev" $local_version; then
echo "Dev version '$local_version' detected.";
echo "Skipping publishing of $crate.";
exit 0;
fi
if [ "$local_version" != "$remote_version" ]; then
echo "Local '$local_version' != '$remote_version'.";
echo "Starting to publish.";
cargo publish -p $crate;
else
echo "Version already match!"
echo "Skipping publishing of $crate.";
fi
'''
[tasks.publish-leptodon-if-missing]
workspace = false
env = { "PUBLISH_CRATE" = "leptodon" }
run_task = "publish-if-missing"
[tasks.publish-leptodon-proc-macros-if-missing]
workspace = false
env = { "PUBLISH_CRATE" = "leptodon-proc-macros" }
run_task = "publish-if-missing"