Skip to content

Commit

Permalink
test: try lib/rust earthly
Browse files Browse the repository at this point in the history
  • Loading branch information
bkioshn committed Apr 29, 2024
1 parent 22177f7 commit fc264ba
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 41 deletions.
33 changes: 19 additions & 14 deletions earthly/rust/Earthfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
VERSION 0.8

IMPORT github.com/earthly/lib/rust:3.0.2 AS rust
IMPORT ./tools AS tools

# cspell: words rustup miri ripgrep stdcfgs toolset lcov psycopg
# cspell: words rustup miri ripgrep stdcfgs toolset depgraph lcov psycopg
# cspell: words TARGETPLATFORM TARGETOS TARGETARCH TARGETVARIANT USERPLATFORM USEROS USERARCH USERVARIANT

# Base Rustup build container.
Expand Down Expand Up @@ -38,6 +38,7 @@ rust-base:
echo "USEROS = $USEROS"; \
echo "USERARCH = $USERARCH"; \
echo "USERVARIANT = $USERVARIANT";

WORKDIR /root

# Install necessary packages
Expand Down Expand Up @@ -68,25 +69,29 @@ rust-base:
# Install a nightly toolchain which matches.
RUN rustup toolchain install nightly --component miri --component rust-src --component rustfmt --component clippy

# Call +INIT before copying the source file to avoid installing depencies every time source code changes.
# This parametrization will be used in future calls to functions of the library
DO rust+INIT --keep_fingerprints=true

# Install the default cargo config.
COPY stdcfgs/cargo_config.toml $CARGO_HOME/config.toml


# installer - Install necessary tools for the rust-base.
installer:
FROM +rust-base

COPY tools+tool-cargo-nextest/cargo-nextest $CARGO_HOME/bin/cargo-nextest
COPY tools+tool-cargo-machete/cargo-machete $CARGO_HOME/bin/cargo-machete
COPY tools+tool-refinery/refinery $CARGO_HOME/bin/refinery
COPY tools+tool-cargo-deny/cargo-deny $CARGO_HOME/bin/cargo-deny
COPY tools+tool-cargo-modules/cargo-modules $CARGO_HOME/bin/cargo-modules
COPY tools+tool-cargo-depgraph/cargo-depgraph $CARGO_HOME/bin/cargo-depgraph
COPY tools+tool-cargo-llvm-cov/cargo-llvm-cov $CARGO_HOME/bin/cargo-llvm-cov
COPY tools+tool-wasm-tools/wasm-tools $CARGO_HOME/bin/wasm-tools
COPY tools+tool-cargo-expand/cargo-expand $CARGO_HOME/bin/cargo-expand
COPY tools+tool-wit-bindgen-cli/wit-bindgen $CARGO_HOME/bin/wit-bindgen
COPY tools+tool-wasmtime/verify-component-adapter $CARGO_HOME/bin/verify-component-adapter
COPY tools+tool-wasm-pack/wasm-pack $CARGO_HOME/bin/wasm-pack
COPY --keep-ts tools+tool-cargo-nextest/cargo-nextest $CARGO_HOME/bin/cargo-nextest
COPY --keep-ts tools+tool-cargo-machete/cargo-machete $CARGO_HOME/bin/cargo-machete
COPY --keep-ts tools+tool-refinery/refinery $CARGO_HOME/bin/refinery
COPY --keep-ts tools+tool-cargo-deny/cargo-deny $CARGO_HOME/bin/cargo-deny
COPY --keep-ts tools+tool-cargo-modules/cargo-modules $CARGO_HOME/bin/cargo-modules
COPY --keep-ts tools+tool-cargo-depgraph/cargo-depgraph $CARGO_HOME/bin/cargo-depgraph
COPY --keep-ts tools+tool-cargo-llvm-cov/cargo-llvm-cov $CARGO_HOME/bin/cargo-llvm-cov
COPY --keep-ts tools+tool-wasm-tools/wasm-tools $CARGO_HOME/bin/wasm-tools
COPY --keep-ts tools+tool-cargo-expand/cargo-expand $CARGO_HOME/bin/cargo-expand
COPY --keep-ts tools+tool-wit-bindgen-cli/wit-bindgen $CARGO_HOME/bin/wit-bindgen
COPY --keep-ts tools+tool-wasmtime/verify-component-adapter $CARGO_HOME/bin/verify-component-adapter

# Universal build scripts we will always need and are not target dependent.
COPY --dir scripts /scripts
Expand Down
52 changes: 25 additions & 27 deletions earthly/rust/tools/Earthfile
Original file line number Diff line number Diff line change
@@ -1,62 +1,60 @@
VERSION 0.8

IMPORT github.com/earthly/lib/rust:3.0.2 AS rust

tool-cargo-nextest:
FROM ../+rust-base
RUN cargo install cargo-nextest --version=0.9.68 --locked
SAVE ARTIFACT /usr/local/cargo/bin/cargo-nextest
DO rust+CARGO --args="install cargo-nextest --version=0.9.68 --locked"

SAVE ARTIFACT /usr/local/cargo/bin/cargo-nextest cargo-nextest


tool-cargo-machete:
FROM ../+rust-base
RUN cargo install cargo-machete --version=0.6.2 --locked
SAVE ARTIFACT /usr/local/cargo/bin/cargo-machete
DO rust+CARGO --args="install cargo-machete --version=0.6.2 --locked"
SAVE ARTIFACT /usr/local/cargo/bin/cargo-machete cargo-machete

tool-refinery:
FROM ../+rust-base
RUN cargo install refinery_cli --version=0.8.14 --locked
SAVE ARTIFACT /usr/local/cargo/bin/refinery
DO rust+CARGO --args="install refinery_cli --version=0.8.14 --locked"
SAVE ARTIFACT /usr/local/cargo/bin/refinery refinery

tool-cargo-deny:
FROM ../+rust-base
RUN cargo install cargo-deny --version=0.14.10 --locked
SAVE ARTIFACT /usr/local/cargo/bin/cargo-deny
DO rust+CARGO --args="install cargo-deny --version=0.14.10 --locked"
SAVE ARTIFACT /usr/local/cargo/bin/cargo-deny cargo-deny

tool-cargo-modules:
FROM ../+rust-base
RUN cargo install cargo-modules --version=0.14.0 --locked
SAVE ARTIFACT /usr/local/cargo/bin/cargo-modules
DO rust+CARGO --args="install cargo-modules --version=0.14.0 --locked"
SAVE ARTIFACT /usr/local/cargo/bin/cargo-modules cargo-modules

tool-cargo-depgraph:
FROM ../+rust-base
RUN cargo install cargo-depgraph --version=1.6.0 --locked
SAVE ARTIFACT /usr/local/cargo/bin/cargo-depgraph
DO rust+CARGO --args="install cargo-depgraph --version=1.6.0 --locked"
SAVE ARTIFACT /usr/local/cargo/bin/cargo-depgraph cargo-depgraph

tool-cargo-llvm-cov:
FROM ../+rust-base
RUN cargo install cargo-llvm-cov --version=0.6.9 --locked
SAVE ARTIFACT /usr/local/cargo/bin/cargo-llvm-cov
DO rust+CARGO --args="install cargo-llvm-cov --version=0.6.9 --locked"
SAVE ARTIFACT /usr/local/cargo/bin/cargo-llvm-cov cargo-llvm-cov

tool-wasm-tools:
FROM ../+rust-base
RUN cargo install wasm-tools --version=1.203.0 --locked
SAVE ARTIFACT /usr/local/cargo/bin/wasm-tools
DO rust+CARGO --args="install wasm-tools --version=1.203.0 --locked"
SAVE ARTIFACT /usr/local/cargo/bin/wasm-tools wasm-tools

tool-cargo-expand:
FROM ../+rust-base
RUN cargo install cargo-expand --version=1.0.82 --locked
SAVE ARTIFACT /usr/local/cargo/bin/cargo-expand
DO rust+CARGO --args="install cargo-expand --version=1.0.82 --locked"
SAVE ARTIFACT /usr/local/cargo/bin/cargo-expand cargo-expand

tool-wit-bindgen-cli:
FROM ../+rust-base
RUN cargo install wit-bindgen-cli --version=0.24.0 --locked
SAVE ARTIFACT /usr/local/cargo/bin/wit-bindgen
DO rust+CARGO --args="install wit-bindgen-cli --version=0.24.0 --locked"
SAVE ARTIFACT /usr/local/cargo/bin/wit-bindgen wit-bindgen

tool-wasmtime:
FROM ../+rust-base
RUN cargo install --git https://github.com/bytecodealliance/wasmtime --tag v17.0.0 verify-component-adapter --locked
SAVE ARTIFACT /usr/local/cargo/bin/verify-component-adapter

tool-wasm-pack:
FROM ../+rust-base
RUN cargo install wasm-pack --version=0.12.1 --locked
SAVE ARTIFACT /usr/local/cargo/bin/wasm-pack
DO rust+CARGO --args="install --git https://github.com/bytecodealliance/wasmtime --tag v17.0.0 verify-component-adapter --locked"
SAVE ARTIFACT /usr/local/cargo/bin/verify-component-adapter verify-component-adapter

0 comments on commit fc264ba

Please sign in to comment.