-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile.coverage
More file actions
51 lines (43 loc) · 2.72 KB
/
Copy pathDockerfile.coverage
File metadata and controls
51 lines (43 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
FROM ubuntu:24.04
ENV NO_COLOR=true
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN echo "Types: deb" > /etc/apt/sources.list.d/plucky.sources && \
echo "URIs: http://archive.ubuntu.com/ubuntu/" >> /etc/apt/sources.list.d/plucky.sources && \
echo "Suites: plucky plucky-updates plucky-backports" >> /etc/apt/sources.list.d/plucky.sources && \
echo "Components: main restricted universe multiverse" >> /etc/apt/sources.list.d/plucky.sources && \
echo "Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" >> /etc/apt/sources.list.d/plucky.sources && \
echo "" >> /etc/apt/sources.list.d/plucky.sources && \
echo "Types: deb" >> /etc/apt/sources.list.d/plucky.sources && \
echo "URIs: http://security.ubuntu.com/ubuntu/" >> /etc/apt/sources.list.d/plucky.sources && \
echo "Suites: plucky-security" >> /etc/apt/sources.list.d/plucky.sources && \
echo "Components: main restricted universe multiverse" >> /etc/apt/sources.list.d/plucky.sources && \
echo "Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" >> /etc/apt/sources.list.d/plucky.sources && \
echo "" >> /etc/apt/sources.list.d/plucky.sources && \
echo "Package: kcov" > /etc/apt/preferences.d/plucky-pin && \
echo "Pin: release n=plucky" >> /etc/apt/preferences.d/plucky-pin && \
echo "Pin-Priority: 500" >> /etc/apt/preferences.d/plucky-pin && \
echo "" >> /etc/apt/preferences.d/plucky-pin && \
echo "Package: *" >> /etc/apt/preferences.d/plucky-pin && \
echo "Pin: release n=plucky" >> /etc/apt/preferences.d/plucky-pin && \
echo "Pin-Priority: -10" >> /etc/apt/preferences.d/plucky-pin
RUN apt-get update -qq && apt-get install -qq --no-install-recommends -y \
curl xz-utils ca-certificates kcov git && \
rm -rf /var/lib/apt/lists/*
ARG ZIG_VERSION=0.16.0
RUN curl -sSL --fail -o zig.tar.xz "https://ziglang.org/download/${ZIG_VERSION}/zig-x86_64-linux-${ZIG_VERSION}.tar.xz" && \
mkdir -p /usr/local/zig && \
tar -xf zig.tar.xz -C /usr/local/zig --strip-components=1 && \
rm zig.tar.xz
ENV PATH=/usr/local/zig:$PATH
RUN zig version
COPY . /app
WORKDIR /app
RUN zig build test-coverage --summary all
# kcov relies on ptrace to instrument the test binary; this coverage-only build is intentionally
# scoped to the generated test executable and is enabled only for the temporary builder container.
# --include-pattern=src/ also matches vendor/zig-yaml/src/, so the vendored
# dependency has to be excluded explicitly to keep the report to our own code.
RUN --security=insecure kcov --clean --cobertura-only --include-pattern=src/ --exclude-pattern=vendor/ coverage zig-out/bin/test
RUN [ -f coverage/cov.xml ]
RUN mkdir -p /output
RUN cp coverage/cov.xml /output/cobertura.xml