diff --git a/.github/actions/plan/modes.ts b/.github/actions/plan/modes.ts index 7f9b2316d..179590628 100644 --- a/.github/actions/plan/modes.ts +++ b/.github/actions/plan/modes.ts @@ -4,6 +4,8 @@ export type Mode = { cargoArgs: string; cargoCacheKey: string; platformIndependent?: true; + artifactSelector?: "runtime"; + artifactMarker?: string; }; export type Modes = Record; @@ -69,4 +71,14 @@ export const build = { cargoArgs: "--locked --workspace --release", cargoCacheKey: "release-build", }, + buildRuntimeEvmTracing: { + name: "build runtime with EVM tracing", + cargoCommand: "build", + cargoArgs: + "--locked --release --bin humanode-runtime-wasm-builder --features evm-tracing", + cargoCacheKey: "release-build-runtime-evm-tracing", + platformIndependent: true, + artifactSelector: "runtime", + artifactMarker: "evm-tracing", + }, } satisfies Modes; 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/scripts/artifact-upload-params.sh b/.github/scripts/artifact-upload-params.sh new file mode 100755 index 000000000..e8294343b --- /dev/null +++ b/.github/scripts/artifact-upload-params.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +set -euo pipefail + +if [[ "$ARTIFACT_SELECTOR" == 'runtime' ]]; then + 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_NAME+='.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" + +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 204545da9..e8d13c122 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,6 +2,8 @@ name: build on: push: + branches: + - "*" tags: - "v*.*.*" schedule: @@ -94,40 +96,24 @@ jobs: - name: Set the upload params id: set-upload-params env: + ARTIFACT_SELECTOR: ${{ matrix.plan.mode.artifactSelector }} 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')" + MODE_ARTIFACT_MARKER: ${{ matrix.plan.mode.artifactMarker }} + 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 @@ -137,26 +123,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/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-wasm-builder/src/main.rs b/crates/humanode-runtime-wasm-builder/src/main.rs new file mode 100644 index 000000000..c9deab1fe --- /dev/null +++ b/crates/humanode-runtime-wasm-builder/src/main.rs @@ -0,0 +1,12 @@ +//! 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-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. + +/// Stub binary entrypoint. +pub fn main() {} 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",