diff options
Diffstat (limited to '')
-rwxr-xr-x | tests/distros.sh | 38 | ||||
-rw-r--r-- | tests/distros/Dockerfile.alpine | 19 | ||||
-rw-r--r-- | tests/distros/Dockerfile.arch | 22 | ||||
-rw-r--r-- | tests/distros/Dockerfile.centos | 18 | ||||
-rw-r--r-- | tests/distros/Dockerfile.debian | 33 | ||||
-rw-r--r-- | tests/distros/Dockerfile.fedora | 20 | ||||
-rw-r--r-- | tests/distros/Dockerfile.ubuntu | 32 |
7 files changed, 182 insertions, 0 deletions
diff --git a/tests/distros.sh b/tests/distros.sh new file mode 100755 index 0000000..c34d272 --- /dev/null +++ b/tests/distros.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +set -euo pipefail + +readonly DISTROS=( + 'arch' + 'alpine' + 'centos' + 'debian' + 'fedora' + 'ubuntu' +) + +readonly DOCKER='docker' + +# do not redefine builtin `test` +test_() { + local -r tag="${1}" + + local -ra docker_opts=( + "--tag=asciinema/asciinema:${tag}" + "--file=tests/distros/Dockerfile.${tag}" + ) + + printf "\e[1;32mTesting on %s...\e[0m\n\n" "${tag}" + + # shellcheck disable=SC2068 + "${DOCKER}" build ${docker_opts[@]} . + + "${DOCKER}" run --rm -it "asciinema/asciinema:${tag}" tests/integration.sh +} + + +for distro in "${DISTROS[@]}"; do + test_ "${distro}" +done + +printf "\n\e[1;32mAll tests passed.\e[0m\n" diff --git a/tests/distros/Dockerfile.alpine b/tests/distros/Dockerfile.alpine new file mode 100644 index 0000000..9716325 --- /dev/null +++ b/tests/distros/Dockerfile.alpine @@ -0,0 +1,19 @@ +# syntax=docker/dockerfile:1.3 + +FROM docker.io/library/alpine:3.15 + +# https://github.com/actions/runner/issues/241 +RUN apk --no-cache add bash ca-certificates make python3 util-linux + +WORKDIR /usr/src/app + +COPY asciinema/ asciinema/ +COPY tests/ tests/ + +ENV LANG="en_US.utf8" + +USER nobody + +ENTRYPOINT ["/bin/bash"] + +# vim:ft=dockerfile diff --git a/tests/distros/Dockerfile.arch b/tests/distros/Dockerfile.arch new file mode 100644 index 0000000..3224495 --- /dev/null +++ b/tests/distros/Dockerfile.arch @@ -0,0 +1,22 @@ +# syntax=docker/dockerfile:1.3 + +FROM docker.io/library/archlinux:latest + +RUN pacman-key --init \ + && pacman --sync --refresh --sysupgrade --noconfirm make python3 \ + && printf "LANG=en_US.UTF-8\n" > /etc/locale.conf \ + && locale-gen \ + && pacman --sync --clean --clean --noconfirm + +WORKDIR /usr/src/app + +COPY asciinema/ asciinema/ +COPY tests/ tests/ + +ENV LANG="en_US.utf8" + +USER nobody + +ENTRYPOINT ["/bin/bash"] + +# vim:ft=dockerfile diff --git a/tests/distros/Dockerfile.centos b/tests/distros/Dockerfile.centos new file mode 100644 index 0000000..bc4fd7e --- /dev/null +++ b/tests/distros/Dockerfile.centos @@ -0,0 +1,18 @@ +# syntax=docker/dockerfile:1.3 + +FROM docker.io/library/centos:7 + +RUN yum install -y epel-release && yum install -y make python36 && yum clean all + +WORKDIR /usr/src/app + +COPY asciinema/ asciinema/ +COPY tests/ tests/ + +ENV LANG="en_US.utf8" + +USER nobody + +ENTRYPOINT ["/bin/bash"] + +# vim:ft=dockerfile diff --git a/tests/distros/Dockerfile.debian b/tests/distros/Dockerfile.debian new file mode 100644 index 0000000..6c14287 --- /dev/null +++ b/tests/distros/Dockerfile.debian @@ -0,0 +1,33 @@ +# syntax=docker/dockerfile:1.3 + +FROM docker.io/library/debian:bullseye + +ENV DEBIAN_FRONTENT="noninteractive" + +RUN apt-get update \ + && apt-get install -y \ + ca-certificates \ + locales \ + make \ + procps \ + python3 \ + && localedef \ + -i en_US \ + -c \ + -f UTF-8 \ + -A /usr/share/locale/locale.alias \ + en_US.UTF-8 \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /usr/src/app + +COPY asciinema/ asciinema/ +COPY tests/ tests/ + +ENV LANG="en_US.utf8" + +USER nobody + +ENV SHELL="/bin/bash" + +# vim:ft=dockerfile diff --git a/tests/distros/Dockerfile.fedora b/tests/distros/Dockerfile.fedora new file mode 100644 index 0000000..e5abb51 --- /dev/null +++ b/tests/distros/Dockerfile.fedora @@ -0,0 +1,20 @@ +# syntax=docker/dockerfile:1.3 + +# https://medium.com/nttlabs/ubuntu-21-10-and-fedora-35-do-not-work-on-docker-20-10-9-1cd439d9921 +# https://www.mail-archive.com/ubuntu-bugs@lists.ubuntu.com/msg5971024.html +FROM registry.fedoraproject.org/fedora:34 + +RUN dnf install -y make python3 procps && dnf clean all + +WORKDIR /usr/src/app + +COPY asciinema/ asciinema/ +COPY tests/ tests/ + +ENV LANG="en_US.utf8" +ENV SHELL="/bin/bash" + +USER nobody + +ENTRYPOINT ["/bin/bash"] +# vim:ft=dockerfile diff --git a/tests/distros/Dockerfile.ubuntu b/tests/distros/Dockerfile.ubuntu new file mode 100644 index 0000000..38223c2 --- /dev/null +++ b/tests/distros/Dockerfile.ubuntu @@ -0,0 +1,32 @@ +# syntax=docker/dockerfile:1.3 + +FROM docker.io/library/ubuntu:20.04 + +ENV DEBIAN_FRONTENT="noninteractive" + +RUN apt-get update \ + && apt-get install -y \ + ca-certificates \ + locales \ + make \ + python3 \ + && localedef \ + -i en_US \ + -c \ + -f UTF-8 \ + -A /usr/share/locale/locale.alias \ + en_US.UTF-8 \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /usr/src/app + +COPY asciinema/ asciinema/ +COPY tests/ tests/ + +ENV LANG="en_US.utf8" + +USER nobody + +ENTRYPOINT ["/bin/bash"] + +# vim:ft=dockerfile |