2017-12-02 18:40:09 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
2021-10-30 13:02:21 -04:00
|
|
|
set -euo pipefail
|
2017-12-02 18:40:09 +01:00
|
|
|
|
2021-10-30 13:02:21 -04:00
|
|
|
readonly DISTROS=(
|
|
|
|
|
'arch'
|
|
|
|
|
'alpine'
|
|
|
|
|
'centos'
|
|
|
|
|
'debian'
|
|
|
|
|
'fedora'
|
|
|
|
|
'ubuntu'
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
readonly DOCKER='docker'
|
2017-12-02 18:40:09 +01:00
|
|
|
|
2021-10-29 23:04:09 -04:00
|
|
|
# do not redefine builtin `test`
|
|
|
|
|
test_() {
|
|
|
|
|
local -r tag="${1}"
|
2017-12-02 19:00:53 +01:00
|
|
|
|
2021-10-30 13:02:21 -04:00
|
|
|
local -ra docker_opts=(
|
|
|
|
|
"--tag=asciinema/asciinema:${tag}"
|
|
|
|
|
"--file=tests/distros/Dockerfile.${tag}"
|
|
|
|
|
)
|
|
|
|
|
|
2021-10-29 23:04:09 -04:00
|
|
|
printf "\e[1;32mTesting on %s...\e[0m\n\n" "${tag}"
|
|
|
|
|
|
2021-10-30 13:02:21 -04:00
|
|
|
# shellcheck disable=SC2068
|
|
|
|
|
"${DOCKER}" build ${docker_opts[@]} .
|
2021-10-29 23:04:09 -04:00
|
|
|
|
2021-10-30 13:02:21 -04:00
|
|
|
"${DOCKER}" run --rm -it "asciinema/asciinema:${tag}" tests/integration.sh
|
2017-12-02 18:40:09 +01:00
|
|
|
}
|
|
|
|
|
|
2017-12-02 19:00:53 +01:00
|
|
|
|
2021-10-30 13:02:21 -04:00
|
|
|
for distro in "${DISTROS[@]}"; do
|
|
|
|
|
test_ "${distro}"
|
|
|
|
|
done
|
2021-10-29 23:04:09 -04:00
|
|
|
|
|
|
|
|
printf "\n\e[1;32mAll tests passed.\e[0m\n"
|