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