Skip to content

Commit 9891205

Browse files
committed
#2461: Use cache mount for code coverage
1 parent 444ea35 commit 9891205

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

.github/workflows/build-docker-images.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,25 @@ jobs:
8282
*.args.CACHE_ID=${{ matrix.target }}
8383
env:
8484
GIT_BRANCH: ${{ github.head_ref || github.ref_name }}
85+
86+
- name: Retrieve build artifacts
87+
if: ${{ matrix.target == 'vt-build-amd64-ubuntu-22-04-gcc-11-cpp' }}
88+
run: |
89+
# We rely on the persistence of data on cache mounts with identical IDs and builders.
90+
# This allows us to copy build artifacts from the "bake" step and use the Codecov action within the GitHub environment.
91+
92+
echo "
93+
FROM ubuntu:latest
94+
RUN --mount=type=cache,id=BUILD-${{ matrix.target }},target=/build/vt \
95+
mkdir -p /vt \
96+
&& cp -p -R /build/vt/. /vt/ || true
97+
" >> tmp_dockerfile
98+
99+
docker buildx build --builder ${{ steps.setup-buildx.outputs.name }} -f tmp_dockerfile --output type=local,dest=build .
100+
101+
- name: Upload coverage
102+
if: ${{ matrix.target == 'vt-build-amd64-ubuntu-22-04-gcc-11-cpp' }}
103+
uses: codecov/codecov-action@v5
104+
with:
105+
files: build/vt/coverage.info
106+
token: ${{ secrets.CODECOV_TOKEN }}

ci/docker/vt.dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ ARG CACHE_ID=${IMAGE}
4848
ENV GIT_BRANCH=${GIT_BRANCH}
4949

5050
RUN --mount=type=cache,id=${CACHE_ID},target=/build/ccache \
51+
--mount=type=cache,id=BUILD-${CACHE_ID},target=/build/vt \
5152
--mount=target=/vt,rw \
5253
if [ "${VT_TEST_SPACK}" = "1" ]; then \
5354
apt update -y -q && apt install -y -q libssl-dev unzip && \

ci/test_cpp.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,10 @@ ctest --output-on-failure -L 'unit_test|example' | tee cmake-output.log
1414

1515
if test "${VT_CODE_COVERAGE:-0}" -eq 1
1616
then
17-
if [ -z "$CODECOV_TOKEN" ]; then
18-
echo "Error: CODECOV_TOKEN is not set"
19-
exit 1
20-
fi
2117
export CODECOV_TOKEN="$CODECOV_TOKEN"
2218
lcov --capture --directory . --output-file coverage.info
2319
lcov --remove coverage.info '/usr/*' --output-file coverage.info
2420
lcov --list coverage.info
25-
pushd "$VT"
26-
bash <(curl -s https://codecov.io/bash) -r DARMA-tasking/vt -f "${VT_BUILD}/coverage.info" || echo "Codecov did not collect coverage reports"
27-
popd
2821
fi
2922

3023
if test "${VT_CI_TEST_LB_SCHEMA:-0}" -eq 1

0 commit comments

Comments
 (0)