[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: test.integration:
tests/integration.sh tests/integration.sh
.PHONY: test.distros
test.distros:
tests/distros.sh
.PHONY: release .PHONY: release
release: test tag push release: test tag push

View File

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

View File

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