From 6067905cb0631ac2ca782201f4dd15844f5a752d Mon Sep 17 00:00:00 2001 From: Petr Ermishkin Date: Fri, 20 Jun 2025 19:31:59 +0300 Subject: [PATCH 01/13] WIP, CI: turn off jobs except new artifact demo --- .github/actions/plan/platforms.ts | 114 +++++++++--------- .github/workflows/build.yml | 48 ++++---- .github/workflows/{code.yml => code.yml.bak} | 0 .../{dependabot.yml => dependabot.yml.bak} | 0 .../workflows/{docker.yml => docker.yml.bak} | 0 crates/humanode-runtime/Cargo.toml | 1 + 6 files changed, 83 insertions(+), 80 deletions(-) rename .github/workflows/{code.yml => code.yml.bak} (100%) rename .github/workflows/{dependabot.yml => dependabot.yml.bak} (100%) rename .github/workflows/{docker.yml => docker.yml.bak} (100%) diff --git a/.github/actions/plan/platforms.ts b/.github/actions/plan/platforms.ts index 80a13d8eb..1bf2a68d5 100644 --- a/.github/actions/plan/platforms.ts +++ b/.github/actions/plan/platforms.ts @@ -50,63 +50,63 @@ export const all = { artifactMarker: "ubuntu2404", isBroken: false, }, - ubuntu2404_aarch64: { - name: "Ubuntu 24.04 (aarch64)", - os: "ubuntu-24.04-arm", - buildEnvScript: buildEnvScriptPath("ubuntu.sh"), - isOnSelfHostedRunner: false, - essential: false, - env: {}, - cacheKey: "ubuntu2404-aarch64", - artifactMarker: "ubuntu2404", - isBroken: false, - }, - ubuntu2204_amd64: { - name: "Ubuntu 22.04 (amd64)", - os: "ubuntu-22.04", - buildEnvScript: buildEnvScriptPath("ubuntu.sh"), - isOnSelfHostedRunner: false, - essential: false, - env: {}, - cacheKey: "ubuntu2204-amd64", - artifactMarker: "ubuntu2204", - isBroken: false, - }, - windows_amd64: { - name: "Windows (amd64)", - os: "windows-latest", - buildEnvScript: buildEnvScriptPath("windows.sh"), - isOnSelfHostedRunner: false, - essential: false, - env: { - CARGO_INCREMENTAL: "0", - }, - cacheKey: "windows-amd64", - artifactMarker: null, - isBroken: true, - }, - macos_amd64: { - name: "macOS (amd64)", - os: "macos-13", - buildEnvScript: buildEnvScriptPath("macos.sh"), - isOnSelfHostedRunner: false, - essential: false, - env: {}, - cacheKey: "macos-amd64", - artifactMarker: null, - isBroken: false, - }, - macos_aarch64: { - name: "macOS (aarch64)", - os: selfHostedRunners.macosAarch64, - buildEnvScript: buildEnvScriptPath("macos.sh"), - isOnSelfHostedRunner: true, - essential: false, - env: {}, - cacheKey: "macos-aarch64", - artifactMarker: null, - isBroken: false, - }, + // ubuntu2404_aarch64: { + // name: "Ubuntu 24.04 (aarch64)", + // os: "ubuntu-24.04-arm", + // buildEnvScript: buildEnvScriptPath("ubuntu.sh"), + // isOnSelfHostedRunner: false, + // essential: false, + // env: {}, + // cacheKey: "ubuntu2404-aarch64", + // artifactMarker: "ubuntu2404", + // isBroken: false, + // }, + // ubuntu2204_amd64: { + // name: "Ubuntu 22.04 (amd64)", + // os: "ubuntu-22.04", + // buildEnvScript: buildEnvScriptPath("ubuntu.sh"), + // isOnSelfHostedRunner: false, + // essential: false, + // env: {}, + // cacheKey: "ubuntu2204-amd64", + // artifactMarker: "ubuntu2204", + // isBroken: false, + // }, + // windows_amd64: { + // name: "Windows (amd64)", + // os: "windows-latest", + // buildEnvScript: buildEnvScriptPath("windows.sh"), + // isOnSelfHostedRunner: false, + // essential: false, + // env: { + // CARGO_INCREMENTAL: "0", + // }, + // cacheKey: "windows-amd64", + // artifactMarker: null, + // isBroken: true, + // }, + // macos_amd64: { + // name: "macOS (amd64)", + // os: "macos-13", + // buildEnvScript: buildEnvScriptPath("macos.sh"), + // isOnSelfHostedRunner: false, + // essential: false, + // env: {}, + // cacheKey: "macos-amd64", + // artifactMarker: null, + // isBroken: false, + // }, + // macos_aarch64: { + // name: "macOS (aarch64)", + // os: selfHostedRunners.macosAarch64, + // buildEnvScript: buildEnvScriptPath("macos.sh"), + // isOnSelfHostedRunner: true, + // essential: false, + // env: {}, + // cacheKey: "macos-aarch64", + // artifactMarker: null, + // isBroken: false, + // }, } satisfies Platforms; // A platform for running things that are platform-independent. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 204545da9..434462bdf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,6 +2,8 @@ name: build on: push: + branches: + - "*" tags: - "v*.*.*" schedule: @@ -137,26 +139,26 @@ jobs: asset_name: ${{ steps.set-upload-params.outputs.artifact-name }}.tar.gz asset_path: archive.tar.gz - publish-release: - needs: - - draft-release - - build - name: Publish release - if: startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-24.04 - timeout-minutes: 50 - permissions: - contents: write - steps: - - name: Publish release - uses: actions/github-script@v7 - env: - RELEASE_ID: ${{ needs.draft-release.outputs.release-id }} - with: - script: | - github.rest.repos.updateRelease({ - owner: context.repo.owner, - repo: context.repo.repo, - release_id: process.env.RELEASE_ID, - draft: false - }); + # publish-release: + # needs: + # - draft-release + # - build + # name: Publish release + # if: startsWith(github.ref, 'refs/tags/') + # runs-on: ubuntu-24.04 + # timeout-minutes: 50 + # permissions: + # contents: write + # steps: + # - name: Publish release + # uses: actions/github-script@v7 + # env: + # RELEASE_ID: ${{ needs.draft-release.outputs.release-id }} + # with: + # script: | + # github.rest.repos.updateRelease({ + # owner: context.repo.owner, + # repo: context.repo.repo, + # release_id: process.env.RELEASE_ID, + # draft: false + # }); diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml.bak similarity index 100% rename from .github/workflows/code.yml rename to .github/workflows/code.yml.bak diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml.bak similarity index 100% rename from .github/workflows/dependabot.yml rename to .github/workflows/dependabot.yml.bak diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml.bak similarity index 100% rename from .github/workflows/docker.yml rename to .github/workflows/docker.yml.bak diff --git a/crates/humanode-runtime/Cargo.toml b/crates/humanode-runtime/Cargo.toml index 528727410..7c88043f5 100644 --- a/crates/humanode-runtime/Cargo.toml +++ b/crates/humanode-runtime/Cargo.toml @@ -112,6 +112,7 @@ sp-keystore = { workspace = true } [features] default = ["std"] +evm-tracing = [] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", From 8ee3a7048a782a92238ff0c2323ec98361e22b0f Mon Sep 17 00:00:00 2001 From: Petr Ermishkin Date: Fri, 20 Jun 2025 18:47:05 +0300 Subject: [PATCH 02/13] CI build mode for WASM runtime artifact --- .github/actions/plan/modes.ts | 23 +++++++++++-- .github/scripts/artifact-upload-params.sh | 42 +++++++++++++++++++++++ .github/workflows/build.yml | 29 ++++------------ 3 files changed, 69 insertions(+), 25 deletions(-) create mode 100755 .github/scripts/artifact-upload-params.sh diff --git a/.github/actions/plan/modes.ts b/.github/actions/plan/modes.ts index 7f9b2316d..11ae10e81 100644 --- a/.github/actions/plan/modes.ts +++ b/.github/actions/plan/modes.ts @@ -4,6 +4,7 @@ export type Mode = { cargoArgs: string; cargoCacheKey: string; platformIndependent?: true; + artifactSelector?: "peer" | "runtime" | "runtime-evm-tracing"; }; export type Modes = Record; @@ -63,10 +64,28 @@ export const code = { } satisfies Modes; export const build = { - build: { - name: "build", + buildPeer: { + name: "build peer", cargoCommand: "build", cargoArgs: "--locked --workspace --release", cargoCacheKey: "release-build", + artifactSelector: "peer", + }, + // buildRuntime: { + // name: "build runtime", + // cargoCommand: "build", + // cargoArgs: "--locked --workspace --release --package humanode-runtime", + // cargoCacheKey: "runtime", + // platformIndependent: true, + // artifactSelector: "runtime", + // }, + buildRuntimeEvmTracing: { + name: "build runtime with EVM tracing", + cargoCommand: "build", + cargoArgs: + "--locked --workspace --release --package humanode-runtime --features evm-tracing", + cargoCacheKey: "runtime-evm-tracing", + platformIndependent: true, + artifactSelector: "runtime-evm-tracing", }, } satisfies Modes; diff --git a/.github/scripts/artifact-upload-params.sh b/.github/scripts/artifact-upload-params.sh new file mode 100755 index 000000000..764920726 --- /dev/null +++ b/.github/scripts/artifact-upload-params.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +set -euo pipefail + +RUNTIME_PATH='target/release/wbuild/humanode-runtime/humanode_runtime.compact.compressed.wasm' + +case "$ARTIFACT_SELECTOR" in + peer) + ARTIFACT_PATH='target/release/humanode-peer' + ARTIFACT_NAME="humanode-peer-$(rustc -vV | sed -n 's|host: ||p')" + + if [[ "$PLATFORM_ARTIFACT_MARKER" != "" ]]; then + ARTIFACT_NAME="${ARTIFACT_NAME}-${PLATFORM_ARTIFACT_MARKER}" + fi + + if [[ "${PATHEXT:-""}" != "" ]]; then + ARTIFACT_PATH="${ARTIFACT_PATH}.exe" + fi + ;; + + runtime) + ARTIFACT_PATH="$RUNTIME_PATH" + ARTIFACT_NAME='humanode-runtime.wasm' + ;; + + runtime-evm-tracing) + ARTIFACT_PATH="$RUNTIME_PATH" + ARTIFACT_NAME='humanode-runtime-evm-tracing.wasm' + ;; + + *) + printf 'Unknown artifact selector `%s`\n' "$ARTIFACT_SELECTOR" >&2 + exit 1 + ;; +esac + +printf 'artifact-path=%s\n' "$ARTIFACT_PATH" >> "$GITHUB_OUTPUT" +printf 'artifact-name=%s\n' "$ARTIFACT_NAME" >> "$GITHUB_OUTPUT" + +printf 'Packaged `%s` into `%s`.\n' \ + "$ARTIFACT_PATH" \ + "$ARTIFACT_NAME" \ + >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 434462bdf..50a83219c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -97,39 +97,22 @@ jobs: id: set-upload-params env: PLATFORM_ARTIFACT_MARKER: ${{ matrix.plan.platform.artifactMarker }} - run: | - EXECUTABLE_PATH="target/release/humanode-peer" - ARTIFACT_NAME="humanode-peer-$(rustc -vV | sed -n 's|host: ||p')" + ARTIFACT_SELECTOR: ${{ matrix.plan.mode.artifactSelector }} + run: .github/scripts/artifact-upload-params.sh - if [[ "$PLATFORM_ARTIFACT_MARKER" != "" ]]; then - ARTIFACT_NAME="${ARTIFACT_NAME}-${PLATFORM_ARTIFACT_MARKER}" - fi - - if [[ "${PATHEXT:-""}" != "" ]]; then - EXECUTABLE_PATH="${EXECUTABLE_PATH}.exe" - fi - - printf 'executable-path=%s\n' "$EXECUTABLE_PATH" >> "$GITHUB_OUTPUT" - printf 'artifact-name=%s\n' "$ARTIFACT_NAME" >> "$GITHUB_OUTPUT" - - printf 'Packaged `%s` into `%s`.\n' \ - "$EXECUTABLE_PATH" \ - "$ARTIFACT_NAME" \ - >> "$GITHUB_STEP_SUMMARY" - - - name: Upload artifact + - name: Upload uses: actions/upload-artifact@v4 with: name: ${{ steps.set-upload-params.outputs.artifact-name }} - path: ${{ steps.set-upload-params.outputs.executable-path }} + path: ${{ steps.set-upload-params.outputs.artifact-path }} if-no-files-found: error retention-days: 5 - name: Archive the binary for release if: startsWith(github.ref, 'refs/tags/') env: - EXECUTABLE_NAME: ${{ steps.set-upload-params.outputs.executable-path }} - run: utils/make-release-archive "$EXECUTABLE_NAME" archive.tar.gz + ARTIFACT_PATH: ${{ steps.set-upload-params.outputs.artifact-path }} + run: utils/make-release-archive "$ARTIFACT_PATH" archive.tar.gz - name: Upload release archive uses: shogo82148/actions-upload-release-asset@v1 From 371fe5512277a97390b022751a6975aef62ba48f Mon Sep 17 00:00:00 2001 From: Petr Ermishkin Date: Wed, 25 Jun 2025 14:36:35 +0300 Subject: [PATCH 03/13] Remove false specificity from the `build` job key --- .github/actions/plan/modes.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/plan/modes.ts b/.github/actions/plan/modes.ts index 11ae10e81..372e22b60 100644 --- a/.github/actions/plan/modes.ts +++ b/.github/actions/plan/modes.ts @@ -64,8 +64,8 @@ export const code = { } satisfies Modes; export const build = { - buildPeer: { - name: "build peer", + build: { + name: "build", cargoCommand: "build", cargoArgs: "--locked --workspace --release", cargoCacheKey: "release-build", From 4c296c84b6b2df6711e324c6f690fb70c8bfbf1d Mon Sep 17 00:00:00 2001 From: Petr Ermishkin Date: Wed, 25 Jun 2025 15:15:53 +0300 Subject: [PATCH 04/13] Make build with `evm-tracing` features marker the only runtime build --- .github/actions/plan/modes.ts | 14 ++++---------- .github/scripts/artifact-upload-params.sh | 14 ++++++-------- .github/workflows/build.yml | 1 + 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/.github/actions/plan/modes.ts b/.github/actions/plan/modes.ts index 372e22b60..7946ce0a1 100644 --- a/.github/actions/plan/modes.ts +++ b/.github/actions/plan/modes.ts @@ -4,7 +4,8 @@ export type Mode = { cargoArgs: string; cargoCacheKey: string; platformIndependent?: true; - artifactSelector?: "peer" | "runtime" | "runtime-evm-tracing"; + artifactSelector?: "peer" | "runtime"; + artifactFeaturesMarker?: "evm-tracing"; }; export type Modes = Record; @@ -71,14 +72,6 @@ export const build = { cargoCacheKey: "release-build", artifactSelector: "peer", }, - // buildRuntime: { - // name: "build runtime", - // cargoCommand: "build", - // cargoArgs: "--locked --workspace --release --package humanode-runtime", - // cargoCacheKey: "runtime", - // platformIndependent: true, - // artifactSelector: "runtime", - // }, buildRuntimeEvmTracing: { name: "build runtime with EVM tracing", cargoCommand: "build", @@ -86,6 +79,7 @@ export const build = { "--locked --workspace --release --package humanode-runtime --features evm-tracing", cargoCacheKey: "runtime-evm-tracing", platformIndependent: true, - artifactSelector: "runtime-evm-tracing", + artifactSelector: "runtime", + artifactFeaturesMarker: "evm-tracing", }, } satisfies Modes; diff --git a/.github/scripts/artifact-upload-params.sh b/.github/scripts/artifact-upload-params.sh index 764920726..13a5fd0bf 100755 --- a/.github/scripts/artifact-upload-params.sh +++ b/.github/scripts/artifact-upload-params.sh @@ -1,8 +1,6 @@ #!/usr/bin/env bash set -euo pipefail -RUNTIME_PATH='target/release/wbuild/humanode-runtime/humanode_runtime.compact.compressed.wasm' - case "$ARTIFACT_SELECTOR" in peer) ARTIFACT_PATH='target/release/humanode-peer' @@ -18,13 +16,13 @@ case "$ARTIFACT_SELECTOR" in ;; runtime) - ARTIFACT_PATH="$RUNTIME_PATH" - ARTIFACT_NAME='humanode-runtime.wasm' - ;; + if [[ -z "${FEATURES_MARKER}" ]]; then + printf 'FEATURES_MARKER must not be empty\n' >&2 + exit 1 + fi - runtime-evm-tracing) - ARTIFACT_PATH="$RUNTIME_PATH" - ARTIFACT_NAME='humanode-runtime-evm-tracing.wasm' + ARTIFACT_PATH='target/release/wbuild/humanode-runtime/humanode_runtime.compact.compressed.wasm' + ARTIFACT_NAME="humanode-runtime-${FEATURES_MARKER}.wasm" ;; *) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 50a83219c..e8ba4bce4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -98,6 +98,7 @@ jobs: env: PLATFORM_ARTIFACT_MARKER: ${{ matrix.plan.platform.artifactMarker }} ARTIFACT_SELECTOR: ${{ matrix.plan.mode.artifactSelector }} + FEATURES_MARKER: ${{ matrix.plan.mode.artifactFeaturesMarker }} run: .github/scripts/artifact-upload-params.sh - name: Upload From c6beae210a1f47235d5de8b7b3af1ad147492016 Mon Sep 17 00:00:00 2001 From: Petr Ermishkin Date: Wed, 25 Jun 2025 16:32:02 +0300 Subject: [PATCH 05/13] Enable building of only runtime's library via `--lib` key --- .github/actions/plan/modes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/plan/modes.ts b/.github/actions/plan/modes.ts index 7946ce0a1..6f9c54c0e 100644 --- a/.github/actions/plan/modes.ts +++ b/.github/actions/plan/modes.ts @@ -76,7 +76,7 @@ export const build = { name: "build runtime with EVM tracing", cargoCommand: "build", cargoArgs: - "--locked --workspace --release --package humanode-runtime --features evm-tracing", + "--locked --workspace --release --package humanode-runtime --lib --features evm-tracing", cargoCacheKey: "runtime-evm-tracing", platformIndependent: true, artifactSelector: "runtime", From 9759a0b463443a3fb40110ba4f4157816f48183e Mon Sep 17 00:00:00 2001 From: Petr Ermishkin Date: Thu, 26 Jun 2025 12:01:39 +0300 Subject: [PATCH 06/13] Systematize the naming of artifact properties --- .github/actions/plan/modes.ts | 4 ++-- .github/scripts/artifact-upload-params.sh | 6 +++--- .github/workflows/build.yml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/actions/plan/modes.ts b/.github/actions/plan/modes.ts index 6f9c54c0e..553e6c42a 100644 --- a/.github/actions/plan/modes.ts +++ b/.github/actions/plan/modes.ts @@ -5,7 +5,7 @@ export type Mode = { cargoCacheKey: string; platformIndependent?: true; artifactSelector?: "peer" | "runtime"; - artifactFeaturesMarker?: "evm-tracing"; + artifactMarker?: "evm-tracing"; }; export type Modes = Record; @@ -80,6 +80,6 @@ export const build = { cargoCacheKey: "runtime-evm-tracing", platformIndependent: true, artifactSelector: "runtime", - artifactFeaturesMarker: "evm-tracing", + artifactMarker: "evm-tracing", }, } satisfies Modes; diff --git a/.github/scripts/artifact-upload-params.sh b/.github/scripts/artifact-upload-params.sh index 13a5fd0bf..837934385 100755 --- a/.github/scripts/artifact-upload-params.sh +++ b/.github/scripts/artifact-upload-params.sh @@ -16,13 +16,13 @@ case "$ARTIFACT_SELECTOR" in ;; runtime) - if [[ -z "${FEATURES_MARKER}" ]]; then - printf 'FEATURES_MARKER must not be empty\n' >&2 + if [[ -z "${MODE_ARTIFACT_MARKER}" ]]; then + printf 'MODE_ARTIFACT_MARKER must not be empty\n' >&2 exit 1 fi ARTIFACT_PATH='target/release/wbuild/humanode-runtime/humanode_runtime.compact.compressed.wasm' - ARTIFACT_NAME="humanode-runtime-${FEATURES_MARKER}.wasm" + ARTIFACT_NAME="humanode-runtime-${MODE_ARTIFACT_MARKER}.wasm" ;; *) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e8ba4bce4..e8d13c122 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -96,9 +96,9 @@ jobs: - name: Set the upload params id: set-upload-params env: - PLATFORM_ARTIFACT_MARKER: ${{ matrix.plan.platform.artifactMarker }} ARTIFACT_SELECTOR: ${{ matrix.plan.mode.artifactSelector }} - FEATURES_MARKER: ${{ matrix.plan.mode.artifactFeaturesMarker }} + PLATFORM_ARTIFACT_MARKER: ${{ matrix.plan.platform.artifactMarker }} + MODE_ARTIFACT_MARKER: ${{ matrix.plan.mode.artifactMarker }} run: .github/scripts/artifact-upload-params.sh - name: Upload From 862833ccc260ceab0d2e4506d553dc171735c7d1 Mon Sep 17 00:00:00 2001 From: Petr Ermishkin Date: Thu, 26 Jun 2025 12:03:33 +0300 Subject: [PATCH 07/13] Make cache key for runtime artifact more specific --- .github/actions/plan/modes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/plan/modes.ts b/.github/actions/plan/modes.ts index 553e6c42a..73dad8b75 100644 --- a/.github/actions/plan/modes.ts +++ b/.github/actions/plan/modes.ts @@ -77,7 +77,7 @@ export const build = { cargoCommand: "build", cargoArgs: "--locked --workspace --release --package humanode-runtime --lib --features evm-tracing", - cargoCacheKey: "runtime-evm-tracing", + cargoCacheKey: "release-build-runtime-evm-tracing", platformIndependent: true, artifactSelector: "runtime", artifactMarker: "evm-tracing", From dd1d620c774c907bb1a1f1090d866e53feb3a003 Mon Sep 17 00:00:00 2001 From: Petr Ermishkin Date: Thu, 26 Jun 2025 15:16:32 +0300 Subject: [PATCH 08/13] Remove explicit "peer" indication as an artifact selector --- .github/actions/plan/modes.ts | 3 +- .github/scripts/artifact-upload-params.sh | 47 +++++++++-------------- 2 files changed, 20 insertions(+), 30 deletions(-) diff --git a/.github/actions/plan/modes.ts b/.github/actions/plan/modes.ts index 73dad8b75..311db1074 100644 --- a/.github/actions/plan/modes.ts +++ b/.github/actions/plan/modes.ts @@ -4,7 +4,7 @@ export type Mode = { cargoArgs: string; cargoCacheKey: string; platformIndependent?: true; - artifactSelector?: "peer" | "runtime"; + artifactSelector?: "runtime"; artifactMarker?: "evm-tracing"; }; @@ -70,7 +70,6 @@ export const build = { cargoCommand: "build", cargoArgs: "--locked --workspace --release", cargoCacheKey: "release-build", - artifactSelector: "peer", }, buildRuntimeEvmTracing: { name: "build runtime with EVM tracing", diff --git a/.github/scripts/artifact-upload-params.sh b/.github/scripts/artifact-upload-params.sh index 837934385..14a7913f9 100755 --- a/.github/scripts/artifact-upload-params.sh +++ b/.github/scripts/artifact-upload-params.sh @@ -1,35 +1,26 @@ #!/usr/bin/env bash set -euo pipefail -case "$ARTIFACT_SELECTOR" in - peer) - ARTIFACT_PATH='target/release/humanode-peer' - ARTIFACT_NAME="humanode-peer-$(rustc -vV | sed -n 's|host: ||p')" - - if [[ "$PLATFORM_ARTIFACT_MARKER" != "" ]]; then - ARTIFACT_NAME="${ARTIFACT_NAME}-${PLATFORM_ARTIFACT_MARKER}" - fi - - if [[ "${PATHEXT:-""}" != "" ]]; then - ARTIFACT_PATH="${ARTIFACT_PATH}.exe" - fi - ;; - - runtime) - if [[ -z "${MODE_ARTIFACT_MARKER}" ]]; then - printf 'MODE_ARTIFACT_MARKER must not be empty\n' >&2 - exit 1 - fi - - ARTIFACT_PATH='target/release/wbuild/humanode-runtime/humanode_runtime.compact.compressed.wasm' - ARTIFACT_NAME="humanode-runtime-${MODE_ARTIFACT_MARKER}.wasm" - ;; - - *) - printf 'Unknown artifact selector `%s`\n' "$ARTIFACT_SELECTOR" >&2 +if [[ "$ARTIFACT_SELECTOR" == 'runtime' ]]; then + if [[ -z "$MODE_ARTIFACT_MARKER" ]]; then + printf 'MODE_ARTIFACT_MARKER must not be empty\n' >&2 exit 1 - ;; -esac + fi + + ARTIFACT_PATH='target/release/wbuild/humanode-runtime/humanode_runtime.compact.compressed.wasm' + ARTIFACT_NAME="humanode-runtime-${MODE_ARTIFACT_MARKER}.wasm" +else + ARTIFACT_PATH='target/release/humanode-peer' + ARTIFACT_NAME="humanode-peer-$(rustc -vV | sed -n 's|host: ||p')" + + if [[ "$PLATFORM_ARTIFACT_MARKER" != "" ]]; then + ARTIFACT_NAME="${ARTIFACT_NAME}-${PLATFORM_ARTIFACT_MARKER}" + fi + + if [[ "${PATHEXT:-""}" != "" ]]; then + ARTIFACT_PATH="${ARTIFACT_PATH}.exe" + fi +fi printf 'artifact-path=%s\n' "$ARTIFACT_PATH" >> "$GITHUB_OUTPUT" printf 'artifact-name=%s\n' "$ARTIFACT_NAME" >> "$GITHUB_OUTPUT" From b13fa0c9cb5f94fff2156f65eee0cb155bfbc580 Mon Sep 17 00:00:00 2001 From: Petr Ermishkin Date: Thu, 26 Jun 2025 15:19:43 +0300 Subject: [PATCH 09/13] Allow ARTIFACT_NAME without explicit artifact marker --- .github/scripts/artifact-upload-params.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/scripts/artifact-upload-params.sh b/.github/scripts/artifact-upload-params.sh index 14a7913f9..e8294343b 100755 --- a/.github/scripts/artifact-upload-params.sh +++ b/.github/scripts/artifact-upload-params.sh @@ -2,13 +2,14 @@ set -euo pipefail if [[ "$ARTIFACT_SELECTOR" == 'runtime' ]]; then - if [[ -z "$MODE_ARTIFACT_MARKER" ]]; then - printf 'MODE_ARTIFACT_MARKER must not be empty\n' >&2 - exit 1 + ARTIFACT_PATH='target/release/wbuild/humanode-runtime/humanode_runtime.compact.compressed.wasm' + ARTIFACT_NAME='humanode-runtime' + + if [[ -n "$MODE_ARTIFACT_MARKER" ]]; then + ARTIFACT_NAME+="-$MODE_ARTIFACT_MARKER" fi - ARTIFACT_PATH='target/release/wbuild/humanode-runtime/humanode_runtime.compact.compressed.wasm' - ARTIFACT_NAME="humanode-runtime-${MODE_ARTIFACT_MARKER}.wasm" + ARTIFACT_NAME+='.wasm' else ARTIFACT_PATH='target/release/humanode-peer' ARTIFACT_NAME="humanode-peer-$(rustc -vV | sed -n 's|host: ||p')" From 645733d89c1b6f88eb476f409d60de366f7048f1 Mon Sep 17 00:00:00 2001 From: Petr Ermishkin Date: Mon, 30 Jun 2025 13:11:26 +0300 Subject: [PATCH 10/13] Remove excess type strictness from `mode.artifactMarker` --- .github/actions/plan/modes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/plan/modes.ts b/.github/actions/plan/modes.ts index 311db1074..a85cb7a0e 100644 --- a/.github/actions/plan/modes.ts +++ b/.github/actions/plan/modes.ts @@ -5,7 +5,7 @@ export type Mode = { cargoCacheKey: string; platformIndependent?: true; artifactSelector?: "runtime"; - artifactMarker?: "evm-tracing"; + artifactMarker?: string; }; export type Modes = Record; From 06391aea570d6b7311bf008c72d36b58478de936 Mon Sep 17 00:00:00 2001 From: Petr Ermishkin Date: Mon, 30 Jun 2025 13:19:33 +0300 Subject: [PATCH 11/13] Remove CLI build arguments `--package humanode-runtime --lib` --- .github/actions/plan/modes.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/plan/modes.ts b/.github/actions/plan/modes.ts index a85cb7a0e..020e9fd65 100644 --- a/.github/actions/plan/modes.ts +++ b/.github/actions/plan/modes.ts @@ -74,8 +74,7 @@ export const build = { buildRuntimeEvmTracing: { name: "build runtime with EVM tracing", cargoCommand: "build", - cargoArgs: - "--locked --workspace --release --package humanode-runtime --lib --features evm-tracing", + cargoArgs: "--locked --workspace --release --features evm-tracing", cargoCacheKey: "release-build-runtime-evm-tracing", platformIndependent: true, artifactSelector: "runtime", From 39e2fadc7979ee00e3f6fe851589d69ed38945e1 Mon Sep 17 00:00:00 2001 From: Petr Ermishkin Date: Tue, 1 Jul 2025 17:51:59 +0300 Subject: [PATCH 12/13] `--bin humanode-runtime-build-selector` Cargo target --- .github/actions/plan/modes.ts | 3 ++- crates/humanode-runtime/Cargo.toml | 4 ++++ crates/humanode-runtime/src/bin/build_selector.rs | 12 ++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 crates/humanode-runtime/src/bin/build_selector.rs diff --git a/.github/actions/plan/modes.ts b/.github/actions/plan/modes.ts index 020e9fd65..d676298f5 100644 --- a/.github/actions/plan/modes.ts +++ b/.github/actions/plan/modes.ts @@ -74,7 +74,8 @@ export const build = { buildRuntimeEvmTracing: { name: "build runtime with EVM tracing", cargoCommand: "build", - cargoArgs: "--locked --workspace --release --features evm-tracing", + cargoArgs: + "--locked --release --bin humanode-runtime-build-selector --features evm-tracing", cargoCacheKey: "release-build-runtime-evm-tracing", platformIndependent: true, artifactSelector: "runtime", diff --git a/crates/humanode-runtime/Cargo.toml b/crates/humanode-runtime/Cargo.toml index 7c88043f5..cc06a706f 100644 --- a/crates/humanode-runtime/Cargo.toml +++ b/crates/humanode-runtime/Cargo.toml @@ -4,6 +4,10 @@ version = "0.1.0" edition = "2021" publish = false +[[bin]] +name = "humanode-runtime-build-selector" +path = "src/bin/build_selector.rs" + [build-dependencies] substrate-wasm-builder = { workspace = true, optional = true } diff --git a/crates/humanode-runtime/src/bin/build_selector.rs b/crates/humanode-runtime/src/bin/build_selector.rs new file mode 100644 index 000000000..5561c6e27 --- /dev/null +++ b/crates/humanode-runtime/src/bin/build_selector.rs @@ -0,0 +1,12 @@ +//! A stub binary target used to selectively build the WASM runtime via `build.rs`, +//! while ensuring consistent and correct feature resolution across the workspace. +//! +//! If you need to build only the `humanode-runtime` WASM, it will likely be incorrect to run +//! `cargo build --package humanode-runtime --lib`. While seemingly precise, `--package` would build +//! the WASM with the minimally acceptable — and likely untested — set of features. In contrast, +//! using `cargo build --bin humanode-runtime-build-selector` results in Cargo resolving features +//! at the workspace level. The runtime is compiled with the same feature set that has already been +//! tested through regular `--workspace` Cargo runs. + +/// A stub binary entrypoint. +pub fn main() {} From 992422b0dc8dde7b8688136769dbcce2d61aada0 Mon Sep 17 00:00:00 2001 From: Petr Ermishkin Date: Fri, 25 Jul 2025 17:18:24 +0300 Subject: [PATCH 13/13] `humanode-runtime-wasm-builder` crate as WASM build selector --- .github/actions/plan/modes.ts | 2 +- Cargo.lock | 7 +++++++ crates/humanode-runtime-wasm-builder/Cargo.toml | 8 ++++++++ .../src/main.rs} | 6 +++--- crates/humanode-runtime/Cargo.toml | 4 ---- 5 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 crates/humanode-runtime-wasm-builder/Cargo.toml rename crates/{humanode-runtime/src/bin/build_selector.rs => humanode-runtime-wasm-builder/src/main.rs} (72%) diff --git a/.github/actions/plan/modes.ts b/.github/actions/plan/modes.ts index d676298f5..179590628 100644 --- a/.github/actions/plan/modes.ts +++ b/.github/actions/plan/modes.ts @@ -75,7 +75,7 @@ export const build = { name: "build runtime with EVM tracing", cargoCommand: "build", cargoArgs: - "--locked --release --bin humanode-runtime-build-selector --features evm-tracing", + "--locked --release --bin humanode-runtime-wasm-builder --features evm-tracing", cargoCacheKey: "release-build-runtime-evm-tracing", platformIndependent: true, artifactSelector: "runtime", diff --git a/Cargo.lock b/Cargo.lock index d8cad78e6..363c9a72f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3862,6 +3862,13 @@ dependencies = [ "vesting-scheduling-timestamp", ] +[[package]] +name = "humanode-runtime-wasm-builder" +version = "0.1.0" +dependencies = [ + "humanode-runtime", +] + [[package]] name = "humantime" version = "2.1.0" diff --git a/crates/humanode-runtime-wasm-builder/Cargo.toml b/crates/humanode-runtime-wasm-builder/Cargo.toml new file mode 100644 index 000000000..a373636b0 --- /dev/null +++ b/crates/humanode-runtime-wasm-builder/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "humanode-runtime-wasm-builder" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +humanode-runtime = { path = "../humanode-runtime" } diff --git a/crates/humanode-runtime/src/bin/build_selector.rs b/crates/humanode-runtime-wasm-builder/src/main.rs similarity index 72% rename from crates/humanode-runtime/src/bin/build_selector.rs rename to crates/humanode-runtime-wasm-builder/src/main.rs index 5561c6e27..c9deab1fe 100644 --- a/crates/humanode-runtime/src/bin/build_selector.rs +++ b/crates/humanode-runtime-wasm-builder/src/main.rs @@ -1,12 +1,12 @@ -//! A stub binary target used to selectively build the WASM runtime via `build.rs`, +//! Stub binary target used to selectively build the WASM runtime via `build.rs`, //! while ensuring consistent and correct feature resolution across the workspace. //! //! If you need to build only the `humanode-runtime` WASM, it will likely be incorrect to run //! `cargo build --package humanode-runtime --lib`. While seemingly precise, `--package` would build //! the WASM with the minimally acceptable — and likely untested — set of features. In contrast, -//! using `cargo build --bin humanode-runtime-build-selector` results in Cargo resolving features +//! using `cargo build --bin humanode-runtime-wasm-builder` results in Cargo resolving features //! at the workspace level. The runtime is compiled with the same feature set that has already been //! tested through regular `--workspace` Cargo runs. -/// A stub binary entrypoint. +/// Stub binary entrypoint. pub fn main() {} diff --git a/crates/humanode-runtime/Cargo.toml b/crates/humanode-runtime/Cargo.toml index cc06a706f..7c88043f5 100644 --- a/crates/humanode-runtime/Cargo.toml +++ b/crates/humanode-runtime/Cargo.toml @@ -4,10 +4,6 @@ version = "0.1.0" edition = "2021" publish = false -[[bin]] -name = "humanode-runtime-build-selector" -path = "src/bin/build_selector.rs" - [build-dependencies] substrate-wasm-builder = { workspace = true, optional = true }