-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.toml
More file actions
117 lines (98 loc) · 3.5 KB
/
Makefile.toml
File metadata and controls
117 lines (98 loc) · 3.5 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
[config]
default_to_workspace = false
[env]
CONTRACT_TARGET = "wasm32-unknown-unknown"
BUILD_PROFILE = "release"
CONTRACT_ID = "DLog47hEsrtuGT4N5XCeMBG45m4n1aWM89tBZXue2E1N"
WEB_CONTAINER_TOOL = "${HOME}/code/freenet/river/main/target/native/x86_64-unknown-linux-gnu/release/web-container-tool"
KEY_FILE = "${HOME}/.config/ghostkeys/web-container-keys.toml"
# --- Build tasks ---
[tasks.add-migration]
description = "Record current delegate key in legacy_delegates.toml (run BEFORE changing delegate/common code)"
command = "bash"
args = ["scripts/add-migration.sh"]
[tasks.check-migration]
description = "Verify migration coverage before publishing (fails fast if unsafe)"
dependencies = ["build-delegate"]
command = "bash"
args = ["scripts/check-migration.sh"]
[tasks.record-migration]
description = "Append just-published delegate hash to legacy_delegates.toml"
command = "bash"
args = ["scripts/record-migration.sh"]
[tasks.build-delegate]
description = "Build the ghostkey delegate WASM"
command = "cargo"
args = ["build", "--release", "--target", "${CONTRACT_TARGET}", "-p", "ghostkey-delegate"]
[tasks.build-ui]
description = "Build the Dioxus UI"
dependencies = ["build-delegate"]
command = "dx"
args = ["build", "--${BUILD_PROFILE}"]
cwd = "./ui"
[tasks.compress-webapp]
description = "Compress the UI into a tar.xz archive"
dependencies = ["build-ui"]
script = '''
mkdir -p target/webapp
cd target/dx/ghostkey-ui/${BUILD_PROFILE}/web/public && tar -cJf ../../../../../webapp/webapp.tar.xz *
echo "Compressed webapp to target/webapp/webapp.tar.xz"
'''
[tasks.sign-webapp]
description = "Sign the webapp archive with the web-container-tool"
dependencies = ["compress-webapp", "check-migration"]
script = '''
VERSION=$(( $(date +%s) / 60 ))
echo "Signing with version: $VERSION"
${WEB_CONTAINER_TOOL} sign \
--input target/webapp/webapp.tar.xz \
--output target/webapp/webapp.metadata \
--parameters published-contract/webapp.parameters \
--version $VERSION \
--key-file ${KEY_FILE}
'''
[tasks.publish-ghostkeys]
description = "Publish the ghostkey UI to the Freenet network"
dependencies = ["sign-webapp"]
script = '''
set -e
fdev network publish \
--code published-contract/web_container_contract.wasm \
--parameters published-contract/webapp.parameters \
contract \
--webapp-archive target/webapp/webapp.tar.xz \
--webapp-metadata target/webapp/webapp.metadata
echo ""
echo "Published to: http://127.0.0.1:7509/v1/contract/web/${CONTRACT_ID}/"
# After publishing, record the deployed hash as the new baseline so
# the next delegate change can migrate from it without anyone having
# to remember to run `add-migration` first.
echo ""
bash scripts/record-migration.sh
'''
# --- Development tasks ---
[tasks.dev]
description = "Run UI in development mode with example data"
dependencies = ["build-delegate"]
command = "dx"
args = ["serve", "--features", "example-data"]
cwd = "./ui"
[tasks.dev-no-sync]
description = "Run UI without Freenet connection"
command = "dx"
args = ["serve", "--features", "example-data,no-sync"]
cwd = "./ui"
# --- Testing ---
[tasks.test]
description = "Run all tests"
command = "cargo"
args = ["test", "--workspace"]
[tasks.clippy]
description = "Run clippy on all targets"
command = "cargo"
args = ["clippy", "--workspace", "--all-targets", "--", "-D", "warnings"]
# --- Utility ---
[tasks.generate-import-url]
description = "Generate an import URL from PEM files. Usage: cargo make generate-import-url cert.pem sk.pem [master_vk.pem]"
command = "bash"
args = ["scripts/generate-import-url.sh", "${@}"]