diff-coverage 0.3.0

Diff-coverage, supercharged in Rust. Fast, memory-efficient coverage on changed lines for CI.
# syntax=docker/dockerfile:1.6
ARG ALPINE_VERSION=3.20
ARG BASE_IMAGE=alpine:${ALPINE_VERSION}

FROM ${BASE_IMAGE}
ARG TARGETPLATFORM
ARG RUST_TARGET_SUFFIX=musl
RUN set -eux; \
  if command -v apk >/dev/null 2>&1; then \
    apk add --no-cache ca-certificates; \
  elif command -v apt-get >/dev/null 2>&1; then \
    apt-get update; \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates; \
    rm -rf /var/lib/apt/lists/*; \
  else \
    echo "Unsupported base image: missing apk/apt-get" >&2; \
    exit 1; \
  fi
COPY dist/ /dist/
RUN echo "TARGETPLATFORM=${TARGETPLATFORM}"
RUN case "$TARGETPLATFORM" in \
  "linux/arm64") echo "aarch64-unknown-linux-${RUST_TARGET_SUFFIX}" > rust_target.txt ;; \
  "linux/amd64") echo "x86_64-unknown-linux-${RUST_TARGET_SUFFIX}" > rust_target.txt ;; \
  *) exit 1 ;; \
  esac
RUN set -eux; \
  mv "/dist/diff-coverage-$(cat rust_target.txt)" /usr/local/bin/diff-coverage; \
  chmod +x /usr/local/bin/diff-coverage; \
  rm -rf /dist rust_target.txt
ENTRYPOINT ["diff-coverage"]