Skip to content

Commit

Permalink
fix(ci): fix earthly ctest (#5424)
Browse files Browse the repository at this point in the history
Necessary files for CTest to discover tests were not around.
  • Loading branch information
ludamad authored Mar 26, 2024
1 parent 4317819 commit 9cac8a4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
16 changes: 9 additions & 7 deletions barretenberg/cpp/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ preset-wasm:
# wasi-sdk
COPY +get-wasi-sdk/wasi-sdk src/wasi-sdk
DO +RUN_CMAKE --configure="--preset wasm-threads" --build="--target barretenberg.wasm"
RUN ./src/wasi-sdk/bin/llvm-strip ./bin/barretenberg.wasm
RUN ../src/wasi-sdk/bin/llvm-strip ./bin/barretenberg.wasm
SAVE ARTIFACT bin
SAVE IMAGE --cache-hint

Expand Down Expand Up @@ -137,25 +137,27 @@ build: # default target
test:
BUILD +test-clang-format
FROM +preset-release-assert-all
COPY --dir ./srs_db/+build/. srs_db
# Fiddly bit: we need to reconstruct the paths that CMake built with
RUN mkdir -p build && mv bin CMakeCache.txt CMakeFiles build && cd build
COPY --dir ./srs_db/+build/. ../srs_db
RUN GTEST_COLOR=1 ctest -j$(nproc) --output-on-failure

# Functions
RUN_CMAKE:
FUNCTION
# Runs cmake build and leaves binary artifacts at 'bin'. Uses a mounted cache
# for incremental rebuilds.
FUNCTION
ARG configure # cmake configure flags
ARG build # cmake build flags

WORKDIR /build
# Use a mount for incremental builds locally.
# TODO(AD): To be determined: does this get us in trouble in CI?
RUN --mount type=cache,id="$configure-build",target=/build/build \
(cmake $configure -Bbuild || (rm -f build/CMakeCache.txt && cmake $configure -Bbuild)) && \
cmake --build build $build && \
cp -r build/CMakeCache.txt build/CMakeFiles build/bin .
cp -r build build-tmp
# move the temporary build folder back
# this is because the cached build goes away
RUN rm -rf build && mv build-tmp build
WORKDIR /build/build

BENCH_RELEASE:
FUNCTION
Expand Down
9 changes: 4 additions & 5 deletions scripts/earthly-cloud
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,16 @@ if $INTERACTIVE ; then
# don't play nice with tee if interactive
earthly $EARTHLY_FLAGS $@
elif ! earthly $EARTHLY_FLAGS $@ 2>&1 | tee .output.txt >&2 ; then
# we got a failure, handle retries
# we try earthly once, capturing output
# if we get one of our (unfortunate) known failures, handle retries
# TODO potentially handle other intermittent errors here
if grep 'failed to get edge: inconsistent graph state' .output.txt >/dev/null ; then
# TODO we need to limit earthly parallelism or sometimes get
# TODO when earthly is overloaded we sometimes get
# 'failed to solve: failed to get edge: inconsistent graph state'
# so we use arbitrary WAIT statement groups. Pending earthly support.
# for now we just try to recover from the failures.
echo "Got 'inconsistent graph state'. Restarting earthly. See https://github.com/earthly/earthly/issues/2454'"
earthly $EARTHLY_FLAGS $@
else
# otherwise, propagate error
exit 1
fi
fi
fi

0 comments on commit 9cac8a4

Please sign in to comment.