remora/Dockerfile.test
ms2k 20ea9557fd Add compatibility matrix fixture execution
Run package test jobs across every selected provider combination with isolated lane state, released-image canaries, controlled OIDC DNS, and deterministic cleanup.
2026-07-16 05:39:51 +09:00

86 lines
4 KiB
Text

# syntax=docker/dockerfile:1.7@sha256:a57df69d0ea827fb7266491f2813635de6f17269be881f696fbfdf2d83dda33e
ARG RUST_IMAGE=docker.io/library/rust:1.97.0-bookworm@sha256:8fa55b2f3ddf97471ab6a767bfa3f37e6bad0986ba823e75fea57e2a2a5c3073
ARG NODE_IMAGE=docker.io/library/node:24.18.0-bookworm@sha256:5711a0d445a1af54af9589066c646df387d1831a608226f4cd694fc59e745059
ARG PLAYWRIGHT_IMAGE=mcr.microsoft.com/playwright:v1.61.1-noble@sha256:5b8f294aff9041b7191c34a4bab3ac270157a28774d4b0660e9743297b697e48
FROM ${RUST_IMAGE} AS rust-tools
ADD --checksum=sha256:0c593171ba53aaaf699f8fd5d8d6661abcb004cfe2ffd01e206c7992909a4d05 https://static.crates.io/crates/cargo-nextest/cargo-nextest-0.9.140.crate /tmp/cargo-nextest-0.9.140.crate
RUN mkdir /tmp/cargo-nextest \
&& tar --extract --gzip --file /tmp/cargo-nextest-0.9.140.crate --directory /tmp/cargo-nextest \
&& rustup component add clippy rustfmt \
&& cargo install --jobs 4 --locked --path /tmp/cargo-nextest/cargo-nextest-0.9.140 \
&& rm --recursive --force /tmp/cargo-nextest /tmp/cargo-nextest-0.9.140.crate
FROM rust-tools AS rust-check
WORKDIR /workspace
COPY Cargo.toml Cargo.lock rust-toolchain.toml ./
COPY .config .config
COPY contracts contracts
COPY crates crates
COPY docs/api docs/api
CMD ["sh", "-c", "cargo fmt --all --check && cargo clippy --workspace --all-targets --all-features -- -D warnings && cargo nextest run --workspace --all-features && cargo test --workspace --doc"]
FROM rust-tools AS kind-sample-build
WORKDIR /workspace
COPY Cargo.toml Cargo.lock rust-toolchain.toml ./
COPY .config .config
COPY contracts contracts
COPY crates crates
COPY docs/api docs/api
RUN cargo nextest archive \
--package remora-api \
--lib \
--build-jobs 4 \
--locked \
--archive-file /tmp/remora-api-tests.tar.zst
FROM rust-tools AS kind-sample-runner
WORKDIR /workspace
COPY Cargo.toml ./
COPY crates crates
COPY --from=kind-sample-build /tmp/remora-api-tests.tar.zst /tests/remora-api-tests.tar.zst
CMD ["bash", "-ec", "test -s /run/remora-fixture/profile.env && test -n \"$DATABASE_URL\" && test -n \"$REMORA_OIDC_CLIENT_ID\" && test -n \"$REMORA_OIDC_USERNAME\" && case $REMORA_COORDINATION_PROVIDER in redis|dragonfly) ;; *) exit 1 ;; esac && case $REMORA_OIDC_PROVIDER in keycloak|zitadel) ;; *) exit 1 ;; esac && case $REMORA_TARGET_PROVIDER in garage|versitygw) ;; *) exit 1 ;; esac && cargo-nextest nextest run --archive-file /tests/remora-api-tests.tar.zst --workspace-remap /workspace"]
FROM rust-tools AS kind-durable-build
WORKDIR /workspace
COPY Cargo.toml Cargo.lock rust-toolchain.toml ./
COPY .config .config
COPY contracts contracts
COPY crates crates
COPY docs/api docs/api
RUN cargo nextest archive \
--package remora-durable \
--build-jobs 4 \
--locked \
--archive-file /tmp/remora-durable-tests.tar.zst
FROM rust-tools AS kind-durable-runner
WORKDIR /workspace
COPY Cargo.toml ./
COPY crates crates
COPY --from=kind-durable-build /tmp/remora-durable-tests.tar.zst /tests/remora-durable-tests.tar.zst
CMD ["bash", "-ec", "test -s /run/remora-fixture/profile.env && test -n \"$DATABASE_URL\" && cargo-nextest nextest run --archive-file /tests/remora-durable-tests.tar.zst --workspace-remap /workspace"]
FROM ${NODE_IMAGE} AS node-runtime
FROM ${PLAYWRIGHT_IMAGE} AS web-dependencies
COPY --from=node-runtime /usr/local/ /usr/local/
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
RUN corepack enable pnpm \
&& corepack install --global [email protected]
WORKDIR /workspace/web
COPY web/package.json web/pnpm-lock.yaml web/pnpm-workspace.yaml ./
COPY web/tools/svelte-check/package.json tools/svelte-check/package.json
RUN pnpm install --frozen-lockfile
FROM web-dependencies AS web-check
COPY web/ ./
COPY contracts /workspace/contracts
COPY docs/api /workspace/docs/api
FROM web-check AS web-fast
CMD ["sh", "-c", "pnpm check && pnpm lint && pnpm build && pnpm test:unit && pnpm test:component && pnpm test:e2e"]
FROM web-check AS web-full
CMD ["sh", "-c", "pnpm check && pnpm lint && pnpm build && pnpm test:unit && pnpm test:component:full && pnpm test:e2e:full"]