ci: cache and narrow foundation builds
This commit is contained in:
+32
-16
@@ -6,6 +6,16 @@ RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates cmake ninja-build g++-14 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /source
|
||||
|
||||
FROM toolchain AS ci-toolchain
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends clang-19 clang-format-19 \
|
||||
clang-tidy-19 libclang-rt-19-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN dpkg-query -W
|
||||
|
||||
# Keep expensive compiler/package layers independent from source changes.
|
||||
FROM ci-toolchain AS ci-source
|
||||
COPY CMakeLists.txt CMakePresets.json .clang-format .clang-tidy ./
|
||||
COPY cmake/ cmake/
|
||||
COPY include/ include/
|
||||
@@ -15,22 +25,15 @@ COPY tests/ tests/
|
||||
COPY experiments/ experiments/
|
||||
COPY tools/ tools/
|
||||
|
||||
FROM toolchain AS ci-toolchain
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends clang-19 clang-format-19 \
|
||||
clang-tidy-19 libclang-rt-19-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN dpkg-query -W
|
||||
|
||||
FROM ci-toolchain AS ci-checks
|
||||
FROM ci-source AS ci-checks
|
||||
RUN bash tools/ci/linux-check.sh checks
|
||||
|
||||
FROM ci-toolchain AS ci-tsan
|
||||
FROM ci-source AS ci-tsan
|
||||
RUN cmake --preset tsan -DCMAKE_CXX_COMPILER=clang++-19 \
|
||||
&& cmake --build --preset tsan --parallel 2
|
||||
CMD ["ctest", "--preset", "tsan", "--no-tests=error", "--timeout", "120"]
|
||||
|
||||
FROM ci-toolchain AS ci-ecs
|
||||
FROM ci-source AS ci-ecs
|
||||
# Explicit experiment preparation; normal configure/runtime remains dependency-free.
|
||||
RUN cmake -P tools/prepare-entt.cmake \
|
||||
&& cmake --preset release -B build/ecs -DCMAKE_CXX_COMPILER=g++-14 -DEVO_BUILD_ECS_EXPERIMENT=ON \
|
||||
@@ -63,13 +66,26 @@ COPY --from=quay.io/prometheus/alertmanager@sha256:e9733bafb1bdef9b00e25a21f8f99
|
||||
COPY tools/ci/monitoring-check.sh tools/ci/
|
||||
RUN bash tools/ci/monitoring-check.sh
|
||||
|
||||
FROM ci-toolchain AS postgres-build
|
||||
FROM ci-toolchain AS postgres-toolchain
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
curl bzip2 make flex bison perl libssl-dev zlib1g-dev pkg-config \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
COPY migrations/ migrations/
|
||||
# The toolchain installs versioned compilers only; there is no bare cc/gcc.
|
||||
COPY tools/prepare-postgres.sh tools/prepare-postgres.sh
|
||||
RUN CC=gcc-14 bash tools/prepare-postgres.sh
|
||||
|
||||
# PostgreSQL itself is prepared once. Source/test changes invalidate only the
|
||||
# layers below, while postgres-tools can reuse this image without compiling the
|
||||
# full C++ test matrix.
|
||||
FROM postgres-toolchain AS postgres-build
|
||||
COPY CMakeLists.txt CMakePresets.json .clang-format .clang-tidy ./
|
||||
COPY cmake/ cmake/
|
||||
COPY include/ include/
|
||||
COPY src/ src/
|
||||
COPY apps/ apps/
|
||||
COPY tests/ tests/
|
||||
COPY tools/ tools/
|
||||
COPY migrations/ migrations/
|
||||
RUN cmake --preset release -B build/postgres -DCMAKE_CXX_COMPILER=g++-14 \
|
||||
-DEVO_BUILD_POSTGRES=ON -DPostgreSQL_ROOT=/source/.cache/postgres/install \
|
||||
&& cmake --build build/postgres --target evo-postgres-tests --parallel 2
|
||||
@@ -87,13 +103,13 @@ RUN bash tools/ci/postgres-check.sh /source/build/postgres/evo-postgres-tests \
|
||||
&& bash tools/ci/postgres-check.sh /source/build/postgres-analysis/evo-postgres-tests \
|
||||
&& bash tools/ci/postgres-check.sh /source/build/postgres-asan/evo-postgres-tests
|
||||
|
||||
FROM ${UBUNTU_IMAGE} AS postgres-tools
|
||||
FROM postgres-toolchain AS postgres-tools
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends libssl3t64 zlib1g ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& groupadd --gid 10001 evo && useradd --uid 10001 --gid 10001 --no-create-home evo
|
||||
COPY --from=postgres-build /source/.cache/postgres/install/bin/psql /opt/postgres/bin/psql
|
||||
COPY --from=postgres-build /source/.cache/postgres/install/lib/libpq.so* /opt/postgres/lib/
|
||||
COPY --from=postgres-build /source/.cache/postgres/postgresql-18.6/COPYRIGHT /usr/share/doc/evo-postgres/COPYRIGHT
|
||||
COPY --from=postgres-toolchain /source/.cache/postgres/install/bin/psql /opt/postgres/bin/psql
|
||||
COPY --from=postgres-toolchain /source/.cache/postgres/install/lib/libpq.so* /opt/postgres/lib/
|
||||
COPY --from=postgres-toolchain /source/.cache/postgres/postgresql-18.6/COPYRIGHT /usr/share/doc/evo-postgres/COPYRIGHT
|
||||
COPY tools/migrate-postgres.sh /opt/evo/tools/migrate-postgres.sh
|
||||
COPY migrations/ /opt/evo/migrations/
|
||||
ENV PATH="/opt/postgres/bin:${PATH}" LD_LIBRARY_PATH=/opt/postgres/lib
|
||||
|
||||
Reference in New Issue
Block a user