[test] Update test distro Dockerfiles

* Add Dockerfile.{alpine,arch}
* Add test.distros Makefile target
This commit is contained in:
Davis Schirmer
2021-10-30 13:02:21 -04:00
parent 9eab5f5cb7
commit dcf4f3f9ca
3 changed files with 27 additions and 11 deletions

View File

@@ -12,6 +12,10 @@ test.unit:
test.integration:
tests/integration.sh
.PHONY: test.distros
test.distros:
tests/distros.sh
.PHONY: release
release: test tag push

View File

@@ -1,26 +1,38 @@
#!/usr/bin/env bash
set -e
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}"
docker build \
--tag="asciinema/asciinema:${tag}" \
--file="tests/distros/Dockerfile.${tag}" \
.
# shellcheck disable=SC2068
"${DOCKER}" build ${docker_opts[@]} .
docker run --rm -i "asciinema/asciinema:${tag}" tests/integration.sh
"${DOCKER}" run --rm -it "asciinema/asciinema:${tag}" tests/integration.sh
}
test_ ubuntu
test_ debian
test_ fedora
test_ centos
for distro in "${DISTROS[@]}"; do
test_ "${distro}"
done
printf "\n\e[1;32mAll tests passed.\e[0m\n"

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -ex
set -eExuo pipefail
if ! command -v "pkill" >/dev/null 2>&1; then
printf "error: pkill not installed\n"