Skip to content

Commit ef24195

Browse files
Tweak Earthfile to use a separate test step
1 parent 8f31fea commit ef24195

File tree

1 file changed

+34
-17
lines changed

1 file changed

+34
-17
lines changed

Earthfile

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ build:
88
FROM --pass-args $from
99
DO --pass-args +BOOTSTRAP_BUILD_INSTALL_EXPORT
1010

11+
test:
12+
FROM --pass-args +build
13+
RUN uv run --group=build \
14+
make ctest-run TEST_CONFIG=Debug JUNIT_OUTPUT=/results.xml || :
15+
SAVE ARTIFACT /results.xml
16+
1117
env.llvm:
1218
ARG --required llvm_major_version
1319
# LLVM doesn't provide a container, so we just use Ubuntu and the automated
@@ -108,7 +114,7 @@ BOOTSTRAP_DEPS:
108114

109115
IF __distro_is "Alpine-*"
110116
# Basic Alpine requirements:
111-
RUN __install build-base
117+
RUN __install build-base ccache
112118
IF __bool $use_vcpkg
113119
# Requirements for vcpkg to install our dependencies:
114120
RUN __install pkgconfig linux-headers perl bash tar zip unzip git
@@ -117,9 +123,9 @@ BOOTSTRAP_DEPS:
117123
RUN __install fmt-dev boost-dev openssl-dev
118124
END
119125
ELSE IF __distro_is "Debian-*" "Ubuntu-*"
120-
RUN __install build-essential
126+
RUN __install build-essential ccache
121127
IF __bool $use_vcpkg
122-
RUN __install zip unzip pkg-config
128+
RUN __install zip unzip pkg-config git
123129
ELSE
124130
RUN __install libfmt-dev libssl-dev
125131
IF apt-cache show libboost-url-dev 2>&1 > /dev/null
@@ -130,8 +136,19 @@ BOOTSTRAP_DEPS:
130136
RUN __install libboost-url1.81-dev libboost-container1.81-dev
131137
END
132138
END
139+
ELSE IF test -f /etc/redhat-release
140+
RUN __install python3.12 ccache gcc gcc-c++
141+
IF __bool $use_vcpkg
142+
RUN __install zip unzip perl git
143+
ELSE
144+
RUN __install boost-devel fmt-devel openssl-devel boost-url
145+
END
133146
END
134147

148+
# Set the directory where Ccache writes its data, and cache that across runs
149+
ENV CCACHE_DIR = /run/ccache
150+
CACHE /run/ccache
151+
135152
# Do some additional setup for vcpkg
136153
IF __bool $use_vcpkg
137154
# Required when bootstrapping vcpkg on Alpine:
@@ -164,31 +181,31 @@ BUILD:
164181
ARG cpack_out
165182
ARG launcher
166183
DO +COPY_SRC
167-
CACHE ~/.cache/ccache
168184
# Toggle testing
169185
ARG test=true
170186
# Enable -Werror
171-
ARG warnings_as_errors=false
187+
ARG warnings_as_errors=true
172188
# Toggle PMM in the build
173189
ARG use_vcpkg=true
174190
# The configurations to build (semicolon-separated list)
175191
ARG configs=Debug
176192
# Configure
177-
RUN $launcher make test \
178-
LAUNCHER='uv run --group=build' \
179-
CONFIGS="$configs" \
180-
TEST_CONFIG="Debug" \
181-
INSTALL_PREFIX=$install_prefix \
182-
USE_PMM=$(__boolstr $use_vcpkg) \
183-
WARNINGS_AS_ERRORS=$(__boolstr $warnings_as_errors) \
184-
BUILD_TESTING=$(__boolstr $test)
193+
RUN $launcher uv run --group=build \
194+
make build \
195+
CONFIGS="$configs" \
196+
INSTALL_PREFIX=$install_prefix \
197+
USE_PMM=$(__boolstr $use_vcpkg) \
198+
WARNINGS_AS_ERRORS=$(__boolstr $warnings_as_errors) \
199+
BUILD_TESTING=$(__boolstr $test)
185200
IF test "$install_prefix" != ""
186201
FOR conf IN Debug # Release RelWithDebInfo
187-
RUN $launcher make install-fast LAUNCHER='uv run --group=build' INSTALL_PREFIX=$install_prefix INSTALL_CONFIG=$conf
202+
RUN $launcher uv run --group=build \
203+
make install-fast INSTALL_PREFIX=$install_prefix INSTALL_CONFIG=$conf
188204
END
189205
END
190206
IF test "$cpack_out" != ""
191-
RUN $launcher make package-fast LAUNCHER='uv run --group=build' \
192-
CPACK_OUT="$cpack_out" \
193-
PACKAGE_CONFIGS=Debug
207+
RUN $launcher uv run --group=build \
208+
make package-fast \
209+
CPACK_OUT="$cpack_out" \
210+
PACKAGE_CONFIGS="$configs"
194211
END

0 commit comments

Comments
 (0)