Run solana tests in Tilt
Refactor the solana Dockerfile so that the solana release installation is a separate stage and have the builder stage derive from it. Add a new "ci_tests" stage that also derives from the solana stage but runs the integration tests instead. Invoke the solana ci_tests stage from the Tiltfile when ci_tests are enabled.
This commit is contained in:
parent
24dd6ed48b
commit
efdc560976
11
Tiltfile
11
Tiltfile
|
@ -410,6 +410,17 @@ if bridge_ui:
|
|||
)
|
||||
|
||||
if ci_tests:
|
||||
local_resource(
|
||||
name = "solana-tests",
|
||||
deps = ["solana"],
|
||||
dir = "solana",
|
||||
cmd = "tilt docker build -- -f Dockerfile --target ci_tests .",
|
||||
env = {"DOCKER_BUILDKIT": "1"},
|
||||
labels = ["ci"],
|
||||
allow_parallel = True,
|
||||
trigger_mode = trigger_mode,
|
||||
)
|
||||
|
||||
docker_build(
|
||||
ref = "tests-image",
|
||||
context = ".",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#syntax=docker/dockerfile:1.2@sha256:e2a8561e419ab1ba6b2fe6cbdf49fd92b95912df1cf7d313c3e2230a333fdbcc
|
||||
FROM docker.io/library/rust:1.49@sha256:a50165ea96983c21832578afb1c8c028674c965bc1ed43b607871b1f362e06a5 AS builder
|
||||
FROM docker.io/library/rust:1.49@sha256:a50165ea96983c21832578afb1c8c028674c965bc1ed43b607871b1f362e06a5 AS solana
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
|
@ -12,7 +12,7 @@ RUN apt-get update && \
|
|||
&& \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
rustup component add rustfmt && \
|
||||
rustup default nightly-2022-01-02
|
||||
rustup default nightly-2021-12-03
|
||||
|
||||
# Support additional root CAs
|
||||
COPY devnet_setup.sh cert.pem* /certs/
|
||||
|
@ -28,10 +28,21 @@ RUN cargo init --lib /tmp/decoy-crate && \
|
|||
cd /tmp/decoy-crate && cargo build-bpf && \
|
||||
rm -rf /tmp/decoy-crate
|
||||
|
||||
# The strip shell script downloads criterion the first time it runs so cache it here as well.
|
||||
RUN touch /tmp/foo.so && \
|
||||
/root/.local/share/solana/install/active_release/bin/sdk/bpf/scripts/strip.sh /tmp/foo.so /tmp/bar.so || \
|
||||
rm /tmp/foo.so
|
||||
|
||||
# Add bridge contract sources
|
||||
WORKDIR /usr/src/bridge
|
||||
|
||||
ADD . .
|
||||
|
||||
ENV RUST_LOG="solana_runtime::system_instruction_processor=trace,solana_runtime::message_processor=trace,solana_bpf_loader=debug,solana_rbpf=debug"
|
||||
ENV RUST_BACKTRACE=1
|
||||
|
||||
FROM solana AS builder
|
||||
|
||||
RUN mkdir -p /opt/solana/deps
|
||||
|
||||
ENV EMITTER_ADDRESS="11111111111111111111111111111115"
|
||||
|
@ -39,7 +50,7 @@ ARG BRIDGE_ADDRESS
|
|||
RUN [ -n "${BRIDGE_ADDRESS}" ]
|
||||
|
||||
# Build Wormhole Solana programs
|
||||
RUN --mount=type=cache,target=target \
|
||||
RUN --mount=type=cache,target=target,id=build \
|
||||
cargo build-bpf --manifest-path "bridge/program/Cargo.toml" -- --locked && \
|
||||
cargo build-bpf --manifest-path "bridge/cpi_poster/Cargo.toml" -- --locked && \
|
||||
cargo build-bpf --manifest-path "modules/token_bridge/program/Cargo.toml" -- --locked && \
|
||||
|
@ -52,8 +63,18 @@ RUN --mount=type=cache,target=target \
|
|||
cp target/deploy/nft_bridge.so /opt/solana/deps/nft_bridge.so && \
|
||||
cp modules/token_bridge/token-metadata/spl_token_metadata.so /opt/solana/deps/spl_token_metadata.so
|
||||
|
||||
ENV RUST_LOG="solana_runtime::system_instruction_processor=trace,solana_runtime::message_processor=trace,solana_bpf_loader=debug,solana_rbpf=debug"
|
||||
ENV RUST_BACKTRACE=1
|
||||
# This stage is skipped in normal builds and needs to be explicitly invoked
|
||||
# (like `DOCKER_BUILDKIT=1 docker build --target ci_tests .`).
|
||||
FROM solana AS ci_tests
|
||||
|
||||
# This emitter address is necessary for the governance tests.
|
||||
ENV EMITTER_ADDRESS="CiByUvEcx7w2HA4VHcPCBUAFQ73Won9kB36zW9VjirSr"
|
||||
|
||||
RUN --mount=type=cache,target=target,id=test \
|
||||
cargo test-bpf \
|
||||
--manifest-path bridge/program/Cargo.toml \
|
||||
--features trace,instructions
|
||||
|
||||
FROM scratch AS export-stage
|
||||
COPY --from=builder /opt/solana/deps /
|
||||
|
||||
|
|
Loading…
Reference in New Issue