From 40a0129cf6893abe620ab67fb6b7405304b7992e Mon Sep 17 00:00:00 2001 From: Andrew Gazelka Date: Tue, 17 Dec 2024 18:28:21 -0800 Subject: [PATCH] ci: improve speeds --- Dockerfile | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 99a1e7a8..7a51f8b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,41 +50,39 @@ FROM builder-base AS machete RUN cargo machete && touch machete-done -FROM builder-base AS clippy +FROM builder-base AS builder-ci RUN --mount=type=cache,target=${CARGO_HOME}/registry \ --mount=type=cache,target=${CARGO_HOME}/git \ --mount=type=cache,target=/app/target \ - cargo clippy --workspace --benches --tests --examples --all-features --frozen -- -D warnings -RUN touch clippy-done + cargo build && \ + cargo nextest archive tests.zst -FROM builder-base AS nextest + +FROM builder-ci AS ci-part RUN --mount=type=cache,target=${CARGO_HOME}/registry \ --mount=type=cache,target=${CARGO_HOME}/git \ --mount=type=cache,target=/app/target \ - cargo nextest run --all-features --workspace --frozen -RUN touch nextest-done + cargo clippy --workspace --benches --tests --examples --all-features --frozen -- -D warnings && \ + cargo doc --all-features --workspace --frozen --no-deps && \ + touch ci-part-done -FROM builder-base AS fmt +FROM builder-base AS nextest -RUN cargo fmt --all -- --check && touch fmt-done +COPY --from=builder-ci /app/tests.zst /app/tests.zst +RUN cargo nextest run --archive-file tests.zst -FROM builder-base AS docs -RUN --mount=type=cache,target=${CARGO_HOME}/registry \ - --mount=type=cache,target=${CARGO_HOME}/git \ - --mount=type=cache,target=/app/target \ - cargo doc --all-features --workspace --frozen --no-deps -RUN touch docs-done +FROM builder-base AS fmt + +RUN cargo fmt --all -- --check && touch fmt-done FROM builder-base AS ci +COPY --from=ci-part /app/ci-part-done /app/ci-part-done COPY --from=machete /app/machete-done /app/machete-done -COPY --from=clippy /app/clippy-done /app/clippy-done -COPY --from=nextest /app/nextest-done /app/nextest-done COPY --from=fmt /app/fmt-done /app/fmt-done -COPY --from=docs /app/docs-done /app/docs-done # Release builder FROM builder-base AS build-release