Skip to content

Commit

Permalink
ci(hermes): Update hermes builds to use new caching rust builders in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenj committed May 7, 2024
1 parent f18aa29 commit 721a16e
Show file tree
Hide file tree
Showing 15 changed files with 105 additions and 55 deletions.
29 changes: 19 additions & 10 deletions hermes/Earthfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
VERSION 0.7
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:fix/improve-rust-builder-sj 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:
DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.11.2+SETUP
DO rust-ci+SETUP
COPY --dir .cargo .config crates bin .
COPY Cargo.toml .
COPY clippy.toml deny.toml rustfmt.toml .

RUN mkdir /wasm
COPY --dir ../wasm+wasi-src/wasi /wasm/wasi
COPY --dir wasm+wasi-src/wasi /wasm/wasi
# Compiled WASM component for benchmarks
COPY ../wasm/stub-module+build/stub.wasm /wasm/stub-module/stub.wasm
COPY stub-module+build/stub.wasm /wasm/stub-module/stub.wasm

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

RUN cargo expand -p hermes --lib runtime_extensions::bindings > bindings.rs
DO rust-ci+CARGO --args "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 @@ -32,7 +39,7 @@ bindings-expand:
check:
FROM +builder

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

# 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.
Expand All @@ -47,10 +54,12 @@ build:
# Directory where WASM test components go when we run wasm module integration tests.
RUN mkdir ../wasm/test-components

RUN /scripts/std_build.py --bench_flags="--features bench" \
--libs="cardano-chain-follower" \
--bins="hermes/hermes" \
--verbose
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" \
--output="target/$TARGETARCH/release/hermes" \
--docs="true"

SAVE ARTIFACT target/$TARGETARCH/doc doc
SAVE ARTIFACT target/$TARGETARCH/release/hermes hermes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[toolchain]
channel = "1.75.0"
channel = "1.78"
profile = "default"
17 changes: 12 additions & 5 deletions hermes/crates/cbork/Earthfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
VERSION 0.7
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:fix/improve-rust-builder-sj AS rust-ci

# Set up our target toolchains, and copy our files.
builder:
DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.11.2+SETUP
DO rust-ci+SETUP

COPY --dir .cargo .config cddl-parser abnf-parser .
COPY Cargo.toml clippy.toml deny.toml rustfmt.toml .

RUN cargo generate-lockfile
# RUN cargo generate-lockfile

## -----------------------------------------------------------------------------
##
Expand All @@ -20,7 +22,7 @@ builder:
check:
FROM +builder

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

# 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.
Expand All @@ -32,7 +34,12 @@ all-hosts-check:
build:
FROM +builder

RUN /scripts/std_build.py --libs="cddl-parser, abnf-parser"
RUN echo cache breaker 1

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

SAVE ARTIFACT target/$TARGETARCH/doc doc

Expand Down
2 changes: 1 addition & 1 deletion hermes/crates/cbork/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.75.0"
channel = "1.78"
profile = "default"
2 changes: 1 addition & 1 deletion hermes/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "1.75.0"
channel = "1.78"
profile = "default"
targets = ["x86_64-unknown-linux-musl"]
25 changes: 13 additions & 12 deletions wasm/integration-test/cardano/Earthfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
VERSION 0.7
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:fix/improve-rust-builder-sj AS rust-ci
IMPORT ../../wasi AS wasi
IMPORT ../../wasi-hermes-component-adapter AS wasi-hermes-component-adapter

# build : build the cardano integration test wasm component
build:
DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.11.2+SETUP
DO rust-ci+SETUP

COPY --dir src .
COPY Cargo.toml Cargo.lock .
COPY ../../wasi+build-rust-bindings/hermes.rs src/hermes.rs
COPY wasi+build-rust-bindings/hermes.rs src/hermes.rs

DO rust-ci+CARGO --args "build --target wasm32-unknown-unknown --release" \
--output="wasm32-unknown-unknown/release/cardano_rte_test_component.wasm"

RUN cargo build --target wasm32-unknown-unknown --release
# RUN cargo build --target wasm32-unknown-unknown --release

COPY ../../wasi-hermes-component-adapter+build/wasi-hermes-component-adapter.wasm .
COPY wasi-hermes-component-adapter+build/wasi-hermes-component-adapter.wasm .

RUN wasm-tools component new -o cardano.wasm target/wasm32-unknown-unknown/release/cardano_rte_test_component.wasm --adapt wasi-hermes-component-adapter.wasm

SAVE ARTIFACT cardano.wasm

get-local-bindings:
FROM scratch

COPY ../../wasi+build-rust-bindings/hermes.rs hermes.rs

SAVE ARTIFACT hermes.rs AS LOCAL src/hermes.rs
2 changes: 1 addition & 1 deletion wasm/integration-test/cardano/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.75.0"
channel = "1.78"
targets = ["wasm32-unknown-unknown"]
10 changes: 7 additions & 3 deletions wasm/integration-test/clocks/Earthfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
VERSION 0.7
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/wasm/c:fix/improve-rust-builder-sj AS wasm-c-ci

IMPORT ../.. AS wasm

# build - generate a wasm component from a C stub file
build:
FROM github.com/input-output-hk/catalyst-ci/earthly/wasm/c:v2.11.0+wasm-c-base
FROM wasm-c-ci+wasm-c-base

ARG c_files="clocks.c"

COPY ./$c_files .
COPY ../..+wasi-src/wasi .
COPY wasm+wasi-src/wasi .

RUN /scripts/std_build.py --wit_path="wit" --c_files=$c_files --out="clocks.wasm"

Expand Down
10 changes: 7 additions & 3 deletions wasm/integration-test/cron/Earthfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
VERSION 0.7
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/wasm/c:fix/improve-rust-builder-sj AS wasm-c-ci

IMPORT ../.. AS wasm

# build - generate a wasm component from a C stub file
build:
FROM github.com/input-output-hk/catalyst-ci/earthly/wasm/c:v2.11.0+wasm-c-base
FROM wasm-c-ci+wasm-c-base

ARG c_files="cron.c"

COPY ./$c_files .
COPY ../..+wasi-src/wasi .
COPY wasm+wasi-src/wasi .

RUN /scripts/std_build.py --wit_path="wit" --c_files=$c_files --out="cron.wasm"

Expand Down
10 changes: 7 additions & 3 deletions wasm/integration-test/crypto/Earthfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
VERSION 0.7
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/wasm/c:fix/improve-rust-builder-sj AS wasm-c-ci

IMPORT ../.. AS wasm

# build - generate a wasm component from a C stub file
build:
FROM github.com/input-output-hk/catalyst-ci/earthly/wasm/c:v2.11.0+wasm-c-base
FROM wasm-c-ci+wasm-c-base

ARG c_files="crypto.c"

COPY ./$c_files .
COPY ../..+wasi-src/wasi .
COPY wasm+wasi-src/wasi .

RUN /scripts/std_build.py --wit_path="wit" --c_files=$c_files --out="crypto.wasm"

Expand Down
10 changes: 7 additions & 3 deletions wasm/integration-test/hashing/Earthfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
VERSION 0.7
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/wasm/c:fix/improve-rust-builder-sj AS wasm-c-ci

IMPORT ../.. AS wasm

# build - generate a wasm component from a C stub file
build:
FROM github.com/input-output-hk/catalyst-ci/earthly/wasm/c:v2.11.0+wasm-c-base
FROM wasm-c-ci+wasm-c-base

ARG c_files="hashing.c"

COPY ./$c_files .
COPY ../..+wasi-src/wasi .
COPY wasm+wasi-src/wasi .

RUN /scripts/std_build.py --wit_path="wit" --c_files=$c_files --out="hashing.wasm"

Expand Down
10 changes: 7 additions & 3 deletions wasm/integration-test/localtime/Earthfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
VERSION 0.7
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/wasm/c:fix/improve-rust-builder-sj AS wasm-c-ci

IMPORT ../.. AS wasm

# build - generate a wasm component from a C stub file
build:
FROM github.com/input-output-hk/catalyst-ci/earthly/wasm/c:v2.11.0+wasm-c-base
FROM wasm-c-ci+wasm-c-base

ARG c_files="localtime.c"

COPY ./$c_files .
COPY ../..+wasi-src/wasi .
COPY wasm+wasi-src/wasi .

RUN /scripts/std_build.py --wit_path="wit" --c_files=$c_files --out="localtime.wasm"

Expand Down
10 changes: 7 additions & 3 deletions wasm/integration-test/logger/Earthfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
VERSION 0.7
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/wasm/c:fix/improve-rust-builder-sj AS wasm-c-ci

IMPORT ../.. AS wasm

# build - generate a wasm component from a C stub file
build:
FROM github.com/input-output-hk/catalyst-ci/earthly/wasm/c:v2.11.0+wasm-c-base
FROM wasm-c-ci+wasm-c-base

ARG c_files="logger.c"

COPY ./$c_files .
COPY ../..+wasi-src/wasi .
COPY wasm+wasi-src/wasi .

RUN /scripts/std_build.py --wit_path="wit" --c_files=$c_files --out="logger.wasm"

Expand Down
10 changes: 7 additions & 3 deletions wasm/integration-test/smoke-test/Earthfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
VERSION 0.7
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/wasm/c:fix/improve-rust-builder-sj AS wasm-c-ci

IMPORT ../.. AS wasm

# build - generate a wasm component from a C stub file
build:
FROM github.com/input-output-hk/catalyst-ci/earthly/wasm/c:v2.11.0+wasm-c-base
FROM wasm-c-ci+wasm-c-base

ARG c_files="smoke-test.c"

COPY ./$c_files .
COPY ../..+wasi-src/wasi .
COPY wasm+wasi-src/wasi .

RUN /scripts/std_build.py --wit_path="wit" --c_files=$c_files --out="smoke-test.wasm"

Expand Down
10 changes: 7 additions & 3 deletions wasm/stub-module/Earthfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
VERSION 0.7
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/wasm/c:fix/improve-rust-builder-sj AS wasm-c-ci

IMPORT .. AS wasm

# build - generate a wasm component from a C stub file
build:
FROM github.com/input-output-hk/catalyst-ci/earthly/wasm/c:v2.11.0+wasm-c-base
FROM wasm-c-ci+wasm-c-base

ARG c_files="stub-module.c"

COPY ./$c_files .
COPY ..+wasi-src/wasi .
COPY wasm+wasi-src/wasi .

RUN /scripts/std_build.py --wit_path="wit" --c_files=$c_files --out="stub.wasm"

Expand Down

0 comments on commit 721a16e

Please sign in to comment.