Skip to content

feat: name component procedures by Miden paths carried in WIT @external-id #3960

feat: name component procedures by Miden paths carried in WIT @external-id

feat: name component procedures by Miden paths carried in WIT @external-id #3960

Workflow file for this run

name: CI
permissions:
contents: read
on:
workflow_dispatch:
push:
branches:
- main
- next
paths-ignore:
- "**.md"
- "**.txt"
- "docs/**"
pull_request:
paths-ignore:
- "**.md"
- "**.txt"
- "docs/**"
# A new push to a PR supersedes the still-running CI of its previous commit. Runs outside
# PRs (pushes to `next`/`main`, manual dispatches) each get their own group, so they are
# never cancelled or queued behind each other.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
env:
# Set the new value when the cache grows too much and we hit the runner's disk space limit
# via https://github.com/rust-lang/docs.rs/pull/2433
RUST_CACHE_KEY: rust-cache-20251212
NEXTEST_PROFILE: ci
# One pin for both the prebuilt (x64) and the compiled (ARM64) cargo-make installs
CARGO_MAKE_VERSION: 0.37.24
# Both integration shards derive from this selection, so their partition stays complementary.
MIDENC_EXAMPLE_TEST_FILTER: "package(midenc-integration-tests) and test(~end_to_end::examples::)"
MIDENUP_HOME: ${{ github.workspace }}/.midenup
jobs:
workspace_inheritance:
name: Workspace inheritance
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
# Pin install-action to a release and request the tool explicitly; shortcut
# tags can trip zizmor's impostor-commit audit when they are later retagged.
- name: Install cargo-binstall
uses: taiki-e/install-action@055f5df8c3f65ea01cd41e9dc855becd88953486 # v2.75.18
with:
tool: cargo-binstall
- name: Install workspace inheritance checker
run: cargo binstall --no-confirm cargo-workspace-inheritance-check@1.2.0
- name: Check workspace inheritance
run: cargo workspace-inheritance-check --promotion-threshold 2 --promotion-failure
lint:
name: lint
# The cheapest runner that keeps clippy well under the unit tests job duration; see the
# measurements in #1406. ARM64 cores are slower than x64 ones but 25% cheaper per vCPU.
runs-on: warp-ubuntu-latest-arm64-4x
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: ./.github/actions/cleanup-runner
- &install-rust
name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Cache Cargo
uses: WarpBuilds/rust-cache@9d0cc3090d9c87de74ea67617b246e978735b1a1 # v2.9.1
with:
# Cache for the clippy check; the test jobs use their own caches below
shared-key: ${{ github.workflow }}-shared
prefix-key: ${{ env.RUST_CACHE_KEY }}
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/next' }}
- name: Install cargo-make
# No prebuilt aarch64 Linux binary exists, so compile the pinned version unless the
# restored cache (`~/.cargo/bin` is part of it) already has exactly that version
run: |
if [ "$(cargo make --version 2>/dev/null)" != "cargo-make ${CARGO_MAKE_VERSION}" ]; then
cargo install cargo-make --version "${CARGO_MAKE_VERSION}" --locked --force
fi
# The formatting check compiles nothing and takes seconds, so it runs here first
# instead of in its own job with its own runner and cache restore.
- name: Check formatting
run: |
cargo make check-format
- name: Clippy
# Report the clippy verdict even when the formatting check failed
if: ${{ !cancelled() }}
run: |
cargo make clippy
check_unused:
name: check for unused items/dependencies
# Compiles nothing, so it needs neither a cache nor the runner disk cleanup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- *install-rust
- &install-cargo-make
name: Install cargo-make
uses: taiki-e/install-action@055f5df8c3f65ea01cd41e9dc855becd88953486 # v2.75.18
with:
tool: cargo-make@${{ env.CARGO_MAKE_VERSION }}
- name: Install cargo-shear
uses: taiki-e/install-action@055f5df8c3f65ea01cd41e9dc855becd88953486 # v2.75.18
with:
tool: cargo-shear@1.11.2
- name: Check for unused dependencies
run: cargo make unused
unit_tests:
name: midenc unit tests
runs-on: warp-ubuntu-latest-x64-8x
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: ./.github/actions/cleanup-runner
- *install-rust
- &install-midenup-cli
name: Install midenup
id: install-midenup-cli
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
curl -fsSL https://github.com/0xMiden/midenup/releases/latest/download/installer.sh \
| bash -s
echo "version=$(midenup --version=plain)" >> "$GITHUB_OUTPUT"
- uses: WarpBuilds/cache@dad44e2487e9dc889ad6e6bd198e77bb2d828eee # v2.0.0
name: Cache the Miden toolchain
with:
key: midenup-toolchain-${{ hashFiles('miden-toolchain.toml') }}-${{ steps.install-midenup-cli.outputs.version }}
path: ${{ env.MIDENUP_HOME }}
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/next' }}
- &midenup-update
name: Install the Miden toolchain
run: |
set -euo pipefail
midenup update
sysroot=$(midenup show sysroot)
echo "MIDEN_SYSROOT=$sysroot" >> "$GITHUB_ENV"
ls "${sysroot}/lib"
- name: Cache Cargo
uses: WarpBuilds/rust-cache@9d0cc3090d9c87de74ea67617b246e978735b1a1 # v2.9.1
with:
# NOTE: We use a different cache for the tests, so they can be run in parallel, but we
# also share the cache for the tests for efficiency
shared-key: ${{ github.workflow }}-shared-tests
prefix-key: ${{ env.RUST_CACHE_KEY }}
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/next' }}
- *install-cargo-make
- name: Check
# We run `cargo check` to verify that the workspace compiles correctly before attempting
# to execute the tests from each crate. This produces easier to read output if a compilation
# error occurs
run: |
cargo make check --tests
- name: Test
# The p2id end-to-end tests drive full nested Cargo builds, so the
# release-profile job runs them.
run: |
cargo make test -E 'not (package(midenc-integration-tests) or package(midenc-integration-protocol-tests) or package(midenc-integration-network-tests) or package(cargo-miden) or package(midenc-template-tests) or test(~p2id_schema_builds_and_decodes_account_id_storage) or test(~generated_p2id_bindings_compile_and_run_in_a_consumer_crate))'
- name: Upload test timings and failures
if: ${{ always() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: test-results-${{ github.job }}
path: target/nextest/ci/junit.xml
if-no-files-found: ignore
release_profile_tests:
name: midenc release-profile tests
runs-on: warp-ubuntu-latest-x64-8x
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: ./.github/actions/cleanup-runner
- *install-rust
- *install-midenup-cli
- &restore-midenup-toolchain
uses: WarpBuilds/cache/restore@dad44e2487e9dc889ad6e6bd198e77bb2d828eee # v2.0.0
with:
key: midenup-toolchain-${{ hashFiles('miden-toolchain.toml') }}-${{ steps.install-midenup-cli.outputs.version }}
path: ${{ env.MIDENUP_HOME }}
- *midenup-update
- name: Cache Cargo
uses: WarpBuilds/rust-cache@9d0cc3090d9c87de74ea67617b246e978735b1a1 # v2.9.1
with:
# NOTE: Keep a separate cache because the workspace is rebuilt under
# the custom test-release profile.
shared-key: ${{ github.workflow }}-shared-release-tests
prefix-key: ${{ env.RUST_CACHE_KEY }}
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/next' }}
- *install-cargo-make
- name: Test
# The template tests are excluded here as well as from the unit tests:
# each case generates a real project and builds it for both profiles
# already, so running them again under `test-release` doubles several
# minutes of work to re-check what they just checked. They have their
# own job.
run: |
cargo make test-release -E 'not (package(midenc-template-tests) or package(midenc-integration-protocol-tests))'
- name: Upload test timings and failures
if: ${{ always() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: test-results-${{ github.job }}
path: target/nextest/ci/junit.xml
if-no-files-found: ignore
lit_tests:
name: midenc lit/filecheck tests
runs-on: warp-ubuntu-latest-x64-8x
# We only want to run our lit tests if the unit tests pass, and that has the added
# benefit that we can re-use the cache from the unit test job
needs: [unit_tests]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: ./.github/actions/cleanup-runner
- *install-rust
- *install-midenup-cli
- *restore-midenup-toolchain
- *midenup-update
- &restore-shared-tests-cache
name: Cache Cargo
uses: WarpBuilds/rust-cache@9d0cc3090d9c87de74ea67617b246e978735b1a1 # v2.9.1
with:
# NOTE: We use a different cache for the tests, so they can be run in parallel, but we
# also share the cache for the tests for efficiency
shared-key: ${{ github.workflow }}-shared-tests
prefix-key: ${{ env.RUST_CACHE_KEY }}
# Do not persist the cache, leave that to the unit tests, we just use the cache here
save-if: false
- *install-cargo-make
- name: Test
run: |
cargo make test-lit
midenc_integration_tests:
name: midenc integration tests
runs-on: warp-ubuntu-latest-x64-8x
# We only want to run the integration tests if the unit tests pass, and that has the added
# benefit that we can re-use the cache from the unit test job for all integration tests
needs: [unit_tests]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: ./.github/actions/cleanup-runner
- *install-rust
- *install-midenup-cli
- *restore-midenup-toolchain
- *midenup-update
- *restore-shared-tests-cache
- *install-cargo-make
- name: Test
# Skip some tests cause they are a space hog and run them in the separate job
run: |
cargo make test -E "package(midenc-integration-tests) - (${MIDENC_EXAMPLE_TEST_FILTER})"
- name: Upload test timings and failures
if: ${{ always() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: test-results-${{ github.job }}
path: target/nextest/ci/junit.xml
if-no-files-found: ignore
midenc_integration_tests_examples:
name: midenc integration tests (examples)
runs-on: warp-ubuntu-latest-x64-8x
# We only want to run the integration tests if the unit tests pass, and that has the added
# benefit that we can re-use the cache from the unit test job for all integration tests
needs: [unit_tests]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: ./.github/actions/cleanup-runner
- *install-rust
- *install-midenup-cli
- *restore-midenup-toolchain
- *midenup-update
- *restore-shared-tests-cache
- *install-cargo-make
- name: Test
# Skip some tests cause they are a space hog and run them in the separate job
run: |
cargo make test -E "${MIDENC_EXAMPLE_TEST_FILTER}"
- name: Upload test timings and failures
if: ${{ always() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: test-results-${{ github.job }}
path: target/nextest/ci/junit.xml
if-no-files-found: ignore
protocol_linked_tests:
name: protocol-linked integration tests
runs-on: warp-ubuntu-latest-x64-8x
# We only want to run the integration tests if the unit tests pass, and that has the added
# benefit that we can re-use the cache from the unit test job for all integration tests
needs: [unit_tests]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: ./.github/actions/cleanup-runner
- *install-rust
- *install-midenup-cli
- *restore-midenup-toolchain
- *midenup-update
- *restore-shared-tests-cache
- *install-cargo-make
- name: Test
# This job is not a required status check; branch protection decides that, not this
# file. It is expected red only while a VM migration waits on the protocol release to
# catch up, and a PR that bumps the VM says so in its description.
run: |
cargo make test -E 'package(midenc-integration-protocol-tests)'
- name: Upload test timings and failures
if: ${{ always() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: test-results-${{ github.job }}
path: target/nextest/ci/junit.xml
if-no-files-found: ignore
cargo_miden_integration_tests:
name: cargo-miden integration tests
runs-on: warp-ubuntu-latest-x64-8x
# We only want to run the integration tests if the unit tests pass, and that has the added
# benefit that we can re-use the cache from the unit test job for all integration tests
needs: [unit_tests]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: ./.github/actions/cleanup-runner
- *install-rust
- *install-midenup-cli
- *restore-midenup-toolchain
- *midenup-update
- *restore-shared-tests-cache
- *install-cargo-make
- name: Test
run: |
cargo make test -E 'package(cargo-miden)'
- name: Upload test timings and failures
if: ${{ always() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: test-results-${{ github.job }}
path: target/nextest/ci/junit.xml
if-no-files-found: ignore
template_tests:
name: project template tests
runs-on: warp-ubuntu-latest-x64-8x
# These build a real project from every template with the compiler from this
# commit, so they need the workspace to compile first.
needs: [unit_tests]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: ./.github/actions/cleanup-runner
- *install-rust
- *install-midenup-cli
- *restore-midenup-toolchain
- *midenup-update
- *restore-shared-tests-cache
- *install-cargo-make
# Scaffolds a project from each of the five `rust/` templates and builds
# it for both profiles. This is what proves the templates still work
# against the compiler and SDK in this commit; every other test that
# touches templates passes `--template-path` or renders without building.
#
# Excluded from the general test job because each case builds a real
# project, so it runs here on its own.
- name: Test templates
run: |
cargo make test-templates
- name: Upload test timings and failures
if: ${{ always() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: test-results-${{ github.job }}
path: target/nextest/ci/junit.xml
if-no-files-found: ignore
miden_integration_node_tests:
name: miden integration node tests
runs-on: warp-ubuntu-latest-x64-8x
# We only want to run the integration tests if the unit tests pass, and that has the added
# benefit that we can re-use the cache from the unit test job for all integration tests
needs: [unit_tests]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: ./.github/actions/cleanup-runner
- *install-rust
- *install-midenup-cli
- *restore-midenup-toolchain
- *midenup-update
- *restore-shared-tests-cache
- *install-cargo-make
- name: Test
run: |
cargo make test -E 'package(midenc-integration-network-tests)'
- name: Upload test timings and failures
if: ${{ always() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: test-results-${{ github.job }}
path: target/nextest/ci/junit.xml
if-no-files-found: ignore
check_release:
name: release checks
runs-on: warp-ubuntu-latest-x64-8x
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: ./.github/actions/cleanup-runner
- *install-rust
- name: Cache Cargo
uses: WarpBuilds/rust-cache@9d0cc3090d9c87de74ea67617b246e978735b1a1 # v2.9.1
with:
# NOTE: We use a different cache for the these release checks
shared-key: ${{ github.workflow }}-shared-release-checks
prefix-key: ${{ env.RUST_CACHE_KEY }}
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/next' }}
- *install-cargo-make
- name: Check(release)
# We run `check` with `--release` to check the release build (without
# `debug_assertions`, etc.)
run: |
cargo make check --release --tests
- name: Check each member (release)
# To uncover any compilation errors hidden by the workspace feature
# unification and avoid surprises on publishing the crates.
run: |
cargo make check-each --release --all-features
dependency_tiers:
name: Compiler unit should not depend on Miden packages, protocol, or client crates
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- *install-rust
- name: Check
run: |
set -euo pipefail
# The compiler and its build tooling must not depend on the Miden library crates:
# their packages come from the toolchain. Test crates may use miden-core-lib for VM
# host event handlers only, so it is allowed there and checked separately.
#
# `-e normal,build` includes build-dependencies, and `--all-features` every optional
# one: a build script is part of what gets built, and the regression this job exists to
# catch is exactly that shape — `codegen/masm/build.rs` with `[build-dependencies]
# midenc-session` is how a Miden library crate first entered the compiler's build.
# Dev-dependencies stay excluded; that is the deliberate spec §10.1 exception.
for p in midenc cargo-miden midenc-compile midenc-session midenc-frontend-wasm midenc-frontend-masm midenc-package-interface; do
tree=$(cargo tree -p "$p" -e normal,build --all-features)
if grep -E "^.*(miden-core-lib|miden-protocol|miden-standards|miden-client|miden-testing) v" <<<"$tree"; then
echo "::error::$p depends on a Miden library crate"; exit 1
fi
done
for p in midenc-integration-tests midenc-integration-test-support; do
tree=$(cargo tree -p "$p" -e normal,build --all-features)
if grep -E "(miden-protocol|miden-standards|miden-client|miden-testing) v" <<<"$tree"; then
echo "::error::$p depends on a protocol crate; that belongs in tests/integration-protocol"; exit 1
fi
done