Skip to content

Commit 6805964

Browse files
committed
CI build mode for WASM runtime artifact
1 parent 632d4ef commit 6805964

File tree

3 files changed

+69
-25
lines changed

3 files changed

+69
-25
lines changed

.github/actions/plan/modes.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export type Mode = {
44
cargoArgs: string;
55
cargoCacheKey: string;
66
platformIndependent?: true;
7+
artifactSelector?: "peer" | "runtime" | "runtime-evm-tracing";
78
};
89

910
export type Modes = Record<string, Mode>;
@@ -63,10 +64,28 @@ export const code = {
6364
} satisfies Modes;
6465

6566
export const build = {
66-
build: {
67-
name: "build",
67+
buildPeer: {
68+
name: "build peer",
6869
cargoCommand: "build",
6970
cargoArgs: "--locked --workspace --release",
7071
cargoCacheKey: "release-build",
72+
artifactSelector: "peer",
73+
},
74+
// buildRuntime: {
75+
// name: "build runtime",
76+
// cargoCommand: "build",
77+
// cargoArgs: "--locked --workspace --release --package humanode-runtime",
78+
// cargoCacheKey: "runtime",
79+
// platformIndependent: true,
80+
// artifactSelector: "runtime",
81+
// },
82+
buildRuntimeEvmTracing: {
83+
name: "build runtime with EVM tracing",
84+
cargoCommand: "build",
85+
cargoArgs:
86+
"--locked --workspace --release --package humanode-runtime --features evm-tracing",
87+
cargoCacheKey: "runtime-evm-tracing",
88+
platformIndependent: true,
89+
artifactSelector: "runtime-evm-tracing",
7190
},
7291
} satisfies Modes;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
RUNTIME_PATH='target/release/wbuild/humanode-runtime/humanode_runtime.compact.compressed.wasm'
5+
6+
case "$ARTIFACT_SELECTOR" in
7+
peer)
8+
ARTIFACT_PATH='target/release/humanode-peer'
9+
ARTIFACT_NAME="humanode-peer-$(rustc -vV | sed -n 's|host: ||p')"
10+
11+
if [[ "$PLATFORM_ARTIFACT_MARKER" != "" ]]; then
12+
ARTIFACT_NAME="${ARTIFACT_NAME}-${PLATFORM_ARTIFACT_MARKER}"
13+
fi
14+
15+
if [[ "${PATHEXT:-""}" != "" ]]; then
16+
ARTIFACT_PATH="${ARTIFACT_PATH}.exe"
17+
fi
18+
;;
19+
20+
runtime)
21+
ARTIFACT_PATH="$RUNTIME_PATH"
22+
ARTIFACT_NAME='humanode-runtime.wasm'
23+
;;
24+
25+
runtime-evm-tracing)
26+
ARTIFACT_PATH="$RUNTIME_PATH"
27+
ARTIFACT_NAME='humanode-runtime-evm-tracing.wasm'
28+
;;
29+
30+
*)
31+
printf 'Unknown artifact selector `%s`\n' "$ARTIFACT_SELECTOR" >&2
32+
exit 1
33+
;;
34+
esac
35+
36+
printf 'artifact-path=%s\n' "$ARTIFACT_PATH" >> "$GITHUB_OUTPUT"
37+
printf 'artifact-name=%s\n' "$ARTIFACT_NAME" >> "$GITHUB_OUTPUT"
38+
39+
printf 'Packaged `%s` into `%s`.\n' \
40+
"$ARTIFACT_PATH" \
41+
"$ARTIFACT_NAME" \
42+
>> "$GITHUB_STEP_SUMMARY"

.github/workflows/build.yml

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -94,39 +94,22 @@ jobs:
9494
id: set-upload-params
9595
env:
9696
PLATFORM_ARTIFACT_MARKER: ${{ matrix.plan.platform.artifactMarker }}
97-
run: |
98-
EXECUTABLE_PATH="target/release/humanode-peer"
99-
ARTIFACT_NAME="humanode-peer-$(rustc -vV | sed -n 's|host: ||p')"
97+
ARTIFACT_SELECTOR: ${{ matrix.plan.mode.artifactSelector }}
98+
run: .github/scripts/artifact-upload-params.sh
10099

101-
if [[ "$PLATFORM_ARTIFACT_MARKER" != "" ]]; then
102-
ARTIFACT_NAME="${ARTIFACT_NAME}-${PLATFORM_ARTIFACT_MARKER}"
103-
fi
104-
105-
if [[ "${PATHEXT:-""}" != "" ]]; then
106-
EXECUTABLE_PATH="${EXECUTABLE_PATH}.exe"
107-
fi
108-
109-
printf 'executable-path=%s\n' "$EXECUTABLE_PATH" >> "$GITHUB_OUTPUT"
110-
printf 'artifact-name=%s\n' "$ARTIFACT_NAME" >> "$GITHUB_OUTPUT"
111-
112-
printf 'Packaged `%s` into `%s`.\n' \
113-
"$EXECUTABLE_PATH" \
114-
"$ARTIFACT_NAME" \
115-
>> "$GITHUB_STEP_SUMMARY"
116-
117-
- name: Upload artifact
100+
- name: Upload
118101
uses: actions/upload-artifact@v4
119102
with:
120103
name: ${{ steps.set-upload-params.outputs.artifact-name }}
121-
path: ${{ steps.set-upload-params.outputs.executable-path }}
104+
path: ${{ steps.set-upload-params.outputs.artifact-path }}
122105
if-no-files-found: error
123106
retention-days: 5
124107

125108
- name: Archive the binary for release
126109
if: startsWith(github.ref, 'refs/tags/')
127110
env:
128-
EXECUTABLE_NAME: ${{ steps.set-upload-params.outputs.executable-path }}
129-
run: utils/make-release-archive "$EXECUTABLE_NAME" archive.tar.gz
111+
ARTIFACT_PATH: ${{ steps.set-upload-params.outputs.artifact-path }}
112+
run: utils/make-release-archive "$ARTIFACT_PATH" archive.tar.gz
130113

131114
- name: Upload release archive
132115
uses: shogo82148/actions-upload-release-asset@v1

0 commit comments

Comments
 (0)