Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/actions/plan/modes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ export type Mode = {
cargoArgs: string;
cargoCacheKey: string;
platformIndependent?: true;
artifactSelector?: "runtime";
artifactMarker?: string;
};

export type Modes = Record<string, Mode>;
Expand Down Expand Up @@ -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;
114 changes: 57 additions & 57 deletions .github/actions/plan/platforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
32 changes: 32 additions & 0 deletions .github/scripts/artifact-upload-params.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to have the syntax and formatting unified; I recommend using Bash IDE and shellcheck extensions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shellcheck — I had it installed,
BashIDE — I installed it, but it didn't offer any formatting corrections…

Original file line number Diff line number Diff line change
@@ -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"
78 changes: 32 additions & 46 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: build

on:
push:
branches:
- "*"
tags:
- "v*.*.*"
schedule:
Expand Down Expand Up @@ -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
Expand All @@ -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
# });
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions crates/humanode-runtime-wasm-builder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "humanode-runtime-wasm-builder"
version = "0.1.0"
edition = "2021"
publish = false

[dependencies]
humanode-runtime = { path = "../humanode-runtime" }
12 changes: 12 additions & 0 deletions crates/humanode-runtime-wasm-builder/src/main.rs
Original file line number Diff line number Diff line change
@@ -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() {}
1 change: 1 addition & 0 deletions crates/humanode-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ sp-keystore = { workspace = true }

[features]
default = ["std"]
evm-tracing = []
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
Expand Down
Loading