Skip to content

Commit

Permalink
fix(hermes): Update earthfiles to use new rust builders
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenj committed May 8, 2024
1 parent ff00c9f commit 9b45603
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 14 deletions.
30 changes: 20 additions & 10 deletions hermes/Earthfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:fix/improve-rust-builder-sj AS rust-ci
# Use when debugging cat-ci locally.
# IMPORT ../../catalyst-ci/earthly/rust AS rust-ci

IMPORT ../wasm AS wasm
IMPORT ../wasm/stub-module AS stub-module

#cspell: words rustfmt

# Set up our target toolchains, and copy our files.
# builder : Set up our target toolchains, and copy our files.
builder:
DO rust-ci+SETUP
COPY --dir .cargo .config crates bin .
Expand All @@ -19,13 +21,14 @@ builder:
# Compiled WASM component for benchmarks
COPY stub-module+build/stub.wasm /wasm/stub-module/stub.wasm

# Expands `wasmtime::bindgen!` macro into the `bindings.rs` file
# bindings-expand : Expands `wasmtime::bindgen!` macro into the `bindings.rs` file
bindings-expand:
FROM +builder

DO rust-ci+CARGO --args "expand -p hermes --lib runtime_extensions::bindings > bindings.rs"
# Do not use the cahced builder as it can not do re-direction of output to a file.
# This command also is only used for local development/debugging and not run in CI.
RUN cargo expand -p hermes --lib runtime_extensions::bindings > bindings.rs

# RUN cargo expand -p hermes --lib runtime_extensions::bindings > bindings.rs
SAVE ARTIFACT bindings.rs AS LOCAL bindings.rs

## -----------------------------------------------------------------------------
Expand All @@ -34,19 +37,20 @@ bindings-expand:
##
## These targets are discovered and executed automatically by CI.

# Run check using the most efficient host tooling
# check : Run check using the most efficient host tooling
# CI Automated Entry point.
check:
FROM +builder

DO rust-ci+EXECUTE --cmd="/scripts/std_checks.py"

# Test which runs check with all supported host tooling. Needs qemu or rosetta to run.
# all-hosts-check : Test which runs check with all supported host tooling.
# Needs qemu or rosetta to run.
# Only used to validate tooling is working across host toolsets.
all-hosts-check:
BUILD --platform=linux/amd64 --platform=linux/arm64 +check

# Run build using the most efficient host tooling
# build : Run build using the most efficient host tooling
# CI Automated Entry point.
build:
FROM +builder
Expand All @@ -57,14 +61,19 @@ build:
RUN echo cache breaker 1

DO rust-ci+EXECUTE \
--cmd="/scripts/std_build.py --bench_flags=\"--features bench\" --libs=cardano-chain-follower --bins=hermes/hermes --verbose" \
--cmd="/scripts/std_build.py" \
--args1="--bench_flags=\"--features bench\"" \
--args2="--libs=cardano-chain-follower" \
--args3="--bins=hermes/hermes" \
--args4="--verbose" \
--output="target/$TARGETARCH/release/hermes" \
--docs="true"

SAVE ARTIFACT target/$TARGETARCH/doc doc
SAVE ARTIFACT target/$TARGETARCH/release/hermes hermes
SAVE ARTIFACT target/criterion

# test-wasm-integration : Run WASM integration tests on hermes engine.
test-wasm-integration:
FROM +build

Expand All @@ -85,14 +94,15 @@ test-wasm-integration:
RUN cargo test --release --test wasm-component-integration-tests -- --bench


# Test which runs check with all supported host tooling. Needs qemu or rosetta to run.
# all-hosts-build : Test which runs check with all supported host tooling.
# Needs qemu or rosetta to run.
# Only used to validate tooling is working across host toolsets.
all-hosts-build:
BUILD --platform=linux/amd64 --platform=linux/arm64 +build

## -----------------------------------------------------------------------------

# This step simulates the full CI run for local purposes only.
# local-ci-run: This step simulates the full CI run for local purposes only.
local-ci-run:
BUILD +check
BUILD +build
Expand Down
5 changes: 4 additions & 1 deletion hermes/crates/cbork/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:fix/improve-rust-builder-sj AS rust-ci
# Use when debugging cat-ci locally.
# IMPORT ../../catalyst-ci/earthly/rust AS rust-ci

# Set up our target toolchains, and copy our files.
builder:
Expand Down Expand Up @@ -37,7 +39,8 @@ build:
RUN echo cache breaker 1

DO rust-ci+EXECUTE \
--cmd="/scripts/std_build.py --libs=cddl-parser,abnf-parser" \
--cmd="/scripts/std_build.py" \
--args1="--libs=cddl-parser,abnf-parser" \
--output="release/[^\./]+" \
--docs="true"

Expand Down
3 changes: 3 additions & 0 deletions wasm/integration-test/cardano/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:fix/improve-rust-builder-sj AS rust-ci
# Use when debugging cat-ci locally.
# IMPORT ../../catalyst-ci/earthly/rust AS rust-ci

IMPORT ../../wasi AS wasi
IMPORT ../../wasi-hermes-component-adapter AS wasi-hermes-component-adapter

Expand Down
2 changes: 2 additions & 0 deletions wasm/integration-test/clocks/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/wasm/c:fix/improve-rust-builder-sj AS wasm-c-ci
# Use when debugging cat-ci locally.
# IMPORT ../../../catalyst-ci/earthly/wasm/c AS wasm-c-ci

IMPORT ../.. AS wasm

Expand Down
4 changes: 3 additions & 1 deletion wasm/integration-test/cron/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/wasm/c:fix/improve-rust-builder-sj AS wasm-c-ci
#IMPORT github.com/input-output-hk/catalyst-ci/earthly/wasm/c:fix/improve-rust-builder-sj AS wasm-c-ci
# Use when debugging cat-ci locally.
IMPORT ../../../catalyst-ci/earthly/wasm/c AS wasm-c-ci

IMPORT ../.. AS wasm

Expand Down
2 changes: 2 additions & 0 deletions wasm/integration-test/crypto/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/wasm/c:fix/improve-rust-builder-sj AS wasm-c-ci
# Use when debugging cat-ci locally.
# IMPORT ../../../catalyst-ci/earthly/wasm/c AS wasm-c-ci

IMPORT ../.. AS wasm

Expand Down
2 changes: 2 additions & 0 deletions wasm/integration-test/hashing/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/wasm/c:fix/improve-rust-builder-sj AS wasm-c-ci
# Use when debugging cat-ci locally.
# IMPORT ../../../catalyst-ci/earthly/wasm/c AS wasm-c-ci

IMPORT ../.. AS wasm

Expand Down
2 changes: 2 additions & 0 deletions wasm/integration-test/localtime/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/wasm/c:fix/improve-rust-builder-sj AS wasm-c-ci
# Use when debugging cat-ci locally.
# IMPORT ../../../catalyst-ci/earthly/wasm/c AS wasm-c-ci

IMPORT ../.. AS wasm

Expand Down
2 changes: 2 additions & 0 deletions wasm/integration-test/logger/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/wasm/c:fix/improve-rust-builder-sj AS wasm-c-ci
# Use when debugging cat-ci locally.
# IMPORT ../../../catalyst-ci/earthly/wasm/c AS wasm-c-ci

IMPORT ../.. AS wasm

Expand Down
4 changes: 3 additions & 1 deletion wasm/integration-test/smoke-test/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/wasm/c:fix/improve-rust-builder-sj AS wasm-c-ci
#IMPORT github.com/input-output-hk/catalyst-ci/earthly/wasm/c:fix/improve-rust-builder-sj AS wasm-c-ci
# Use when debugging cat-ci locally.
IMPORT ../../../catalyst-ci/earthly/wasm/c AS wasm-c-ci

IMPORT ../.. AS wasm

Expand Down
2 changes: 2 additions & 0 deletions wasm/stub-module/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/wasm/c:fix/improve-rust-builder-sj AS wasm-c-ci
# Use when debugging cat-ci locally.
# IMPORT ../../../catalyst-ci/earthly/wasm/c AS wasm-c-ci

IMPORT .. AS wasm

Expand Down
8 changes: 7 additions & 1 deletion wasm/wasi-hermes-component-adapter/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:fix/improve-rust-builder-sj AS rust-ci
# Use when debugging cat-ci locally.
# IMPORT ../../catalyst-ci/earthly/rust AS rust-ci

#cspell: words rustfmt wasi

Expand Down Expand Up @@ -29,7 +31,11 @@ build:
FROM +builder

DO rust-ci+EXECUTE \
--cmd="/scripts/std_build.py --disable_tests --disable_benches --disable_docs --build_flags=\"--target=wasm32-unknown-unknown\" --verbose" \
--cmd="/scripts/std_build.py" \
--args1="--disable_tests" \
--args2="--disable_benches" \
--args3="--disable_docs" \
--args4="--build_flags=\"--target=wasm32-unknown-unknown\"" \
--output="wasm32-unknown-unknown/release/wasi_snapshot_hermes.wasm"

SAVE ARTIFACT target/wasm32-unknown-unknown/release/wasi_snapshot_hermes.wasm wasi-hermes-component-adapter.wasm
Expand Down

0 comments on commit 9b45603

Please sign in to comment.