summaryrefslogtreecommitdiffstats
path: root/tests/distros.sh
blob: c34d2725c9e5d90c497649084d36cd14c89580cf (plain)
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
#!/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"