Skip to content

Commit

Permalink
ci: improve speeds
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgazelka committed Dec 18, 2024
1 parent c2b4d04 commit 40a0129
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 40a0129

Please sign in to comment.