Add test scripts

This commit is contained in:
Felix Kollmann 2024-02-17 12:18:32 +01:00
parent 39e1a03064
commit a8f6d13aea
3 changed files with 36 additions and 0 deletions

6
build_and_test.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
set -e
zig build test --summary all
zig fmt . > /dev/null

7
build_and_test_docker.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
set -e
IMAGE=zzmq_test_347563478
DOCKER_BUILDKIT=1 docker build . -t $IMAGE -f test.Dockerfile

23
test.Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM alpine:3.19 as builder
# install Zig 0.11 from Alpine edge repo: https://pkgs.alpinelinux.org/package/edge/testing/x86_64/zig
RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN apk add --no-cache zig@testing~=0.11.0
# install dependencies (keep in sync with main image below)
RUN apk add --no-cache czmq-dev@testing
COPY . /build/
WORKDIR /build
RUN zig build test -Doptimize=ReleaseFast --summary all
RUN touch /var/touched # dummy build output
# empty result image
FROM scratch
COPY --from=builder /var/touched /tmp/touched