Skip to content

Commit 34b4417

Browse files
committed
#2461: Add CODECOV_TOKEN secret to bake and use it
1 parent d3c2c08 commit 34b4417

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,5 @@ jobs:
6161
targets: ${{ matrix.target }}
6262
files: docker-bake.hcl
6363
push: ${{ github.ref == 'refs/heads/develop' }}
64+
env:
65+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

ci/docker/vt.dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ fi
5050
EOF
5151

5252
RUN --mount=target=/vt,rw \
53-
/vt/ci/build_cpp.sh /vt /build && \
54-
/vt/ci/test_cpp.sh /vt /build && \
55-
/vt/ci/build_vt_sample.sh /vt /build
53+
--mount=type=secret,id=CODECOV_TOKEN,env=CODECOV_TOKEN \
54+
/vt/ci/build_cpp.sh /vt /build && \
55+
/vt/ci/test_cpp.sh /vt /build && \
56+
/vt/ci/build_vt_sample.sh /vt /build

ci/test_cpp.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +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
1721
export CODECOV_TOKEN="$CODECOV_TOKEN"
1822
lcov --capture --directory . --output-file coverage.info
1923
lcov --remove coverage.info '/usr/*' --output-file coverage.info

docker-bake.hcl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ target "vt-build" {
180180
ulimits = [
181181
"core=0"
182182
]
183+
184+
secret = ["id=CODECOV_TOKEN,env=CODECOV_TOKEN"]
183185
# FIXME: verify that caching works as intended
184186
# cache-from = [
185187
# {

0 commit comments

Comments
 (0)