mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-07 21:24:33 +08:00
Add podman to launch test (#4882)
Users can set the DOCKER environnement variable to select Docker or Podman to run the tests. Co-authored-by: L'HOSPITAL Logan <lhospitallogan@gmail.com>
This commit is contained in:
28
run-tests
28
run-tests
@@ -1,12 +1,13 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
DOCKER=${DOCKER:-docker}
|
||||||
|
export DOCKER
|
||||||
# Author: w0rp <devw0rp@gmail.com>
|
# Author: w0rp <devw0rp@gmail.com>
|
||||||
#
|
#
|
||||||
# This script runs tests for the ALE project. Run `./run-tests --help` for
|
# This script runs tests for the ALE project. Run `./run-tests --help` for
|
||||||
# options, or read the output below.
|
# options, or read the output below.
|
||||||
#
|
#
|
||||||
|
|
||||||
image=denseanalysis/ale
|
image=docker.io/denseanalysis/ale
|
||||||
|
|
||||||
# Create docker image tag based on Dockerfile contents
|
# Create docker image tag based on Dockerfile contents
|
||||||
if [ -n "$(command -v md5)" ]; then
|
if [ -n "$(command -v md5)" ]; then
|
||||||
@@ -155,7 +156,18 @@ set -eu
|
|||||||
|
|
||||||
# Check if docker un image is available locally
|
# Check if docker un image is available locally
|
||||||
has_image=$(docker images --quiet "${image}:${image_tag}" | wc -l)
|
has_image=$(docker images --quiet "${image}:${image_tag}" | wc -l)
|
||||||
arch=$(docker info -f '{{ .Architecture }}')
|
|
||||||
|
if [[ "$DOCKER" == docker ]]; then
|
||||||
|
arch=$(docker info -f '{{ .Architecture }}')
|
||||||
|
elif [[ "$DOCKER" == podman ]]; then
|
||||||
|
arch=$(podman info -f '{{ .Host.Arch }}')
|
||||||
|
if [[ "$arch" == "amd64" ]]; then
|
||||||
|
arch="x86_64"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "The DOCKER environnement variable must be docker or podman, not ${DOCKER}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
download_image() {
|
download_image() {
|
||||||
if [[ $arch != x86_64 ]]; then
|
if [[ $arch != x86_64 ]]; then
|
||||||
@@ -174,12 +186,12 @@ if [ "$has_image" -eq 0 ] && ! download_image; then
|
|||||||
if [[ $arch != x86_64 ]]; then
|
if [[ $arch != x86_64 ]]; then
|
||||||
echo "Building testbed/vim:24 for $arch"
|
echo "Building testbed/vim:24 for $arch"
|
||||||
testbed_vim_ref=902917c4caa50db2f2e80009b839605602f9f014
|
testbed_vim_ref=902917c4caa50db2f2e80009b839605602f9f014
|
||||||
docker build -t "testbed/vim:$testbed_vim_ref" "https://github.com/Vimjas/vim-testbed.git#$testbed_vim_ref"
|
"$DOCKER" build -t "testbed/vim:$testbed_vim_ref" "https://github.com/Vimjas/vim-testbed.git#$testbed_vim_ref"
|
||||||
build_args+=( --build-arg TESTBED_VIM_VERSION="$testbed_vim_ref" )
|
build_args+=( --build-arg TESTBED_VIM_VERSION="$testbed_vim_ref" )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker build "${build_args[@]}" -t "${image}:${image_tag}" .
|
"$DOCKER" build "${build_args[@]}" -t "${image}:${image_tag}" .
|
||||||
docker tag "${image}:${image_tag}" "${image}:latest"
|
"$DOCKER" tag "${image}:${image_tag}" "${image}:latest"
|
||||||
|
|
||||||
if [[ -z "${DOCKER_HUB_USER:-}" || -z "${DOCKER_HUB_PASS:-}" ]]; then
|
if [[ -z "${DOCKER_HUB_USER:-}" || -z "${DOCKER_HUB_PASS:-}" ]]; then
|
||||||
echo "Docker Hub credentials not set, skip push"
|
echo "Docker Hub credentials not set, skip push"
|
||||||
@@ -192,7 +204,7 @@ else
|
|||||||
echo "Docker run image ${image}:${image_tag} ready"
|
echo "Docker run image ${image}:${image_tag} ready"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker tag "${image}:${image_tag}" "${image}:latest"
|
"$DOCKER" tag "${image}:${image_tag}" "${image}:latest"
|
||||||
|
|
||||||
output_dir=$(mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir')
|
output_dir=$(mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir')
|
||||||
|
|
||||||
@@ -225,7 +237,7 @@ cancel_tests() {
|
|||||||
|
|
||||||
trap cancel_tests INT TERM
|
trap cancel_tests INT TERM
|
||||||
|
|
||||||
for vim in $(docker run --rm "$DOCKER_RUN_IMAGE" ls /vim-build/bin | grep '^neovim\|^vim' ); do
|
for vim in $("$DOCKER" run --rm "$DOCKER_RUN_IMAGE" ls /vim-build/bin | grep '^neovim\|^vim' ); do
|
||||||
if ( [[ $vim =~ ^vim-v8.0 ]] && ((run_vim_80_tests)) ) \
|
if ( [[ $vim =~ ^vim-v8.0 ]] && ((run_vim_80_tests)) ) \
|
||||||
|| ( [[ $vim =~ ^vim-v9.0 ]] && ((run_vim_90_tests)) ) \
|
|| ( [[ $vim =~ ^vim-v9.0 ]] && ((run_vim_90_tests)) ) \
|
||||||
|| ( [[ $vim =~ ^neovim-v0.6 ]] && ((run_neovim_06_tests)) ) \
|
|| ( [[ $vim =~ ^neovim-v0.6 ]] && ((run_neovim_06_tests)) ) \
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ echo 'Custom warnings/errors follow:'
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
docker run "${docker_flags[@]}" test/script/custom-linting-rules . || exit_code=$?
|
"$DOCKER" run "${docker_flags[@]}" test/script/custom-linting-rules . || exit_code=$?
|
||||||
set +o pipefail
|
set +o pipefail
|
||||||
echo
|
echo
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ echo 'Duplicate tags follow:'
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
docker run "${docker_flags[@]}" test/script/check-duplicate-tags . || exit_code=$?
|
"$DOCKER" run "${docker_flags[@]}" test/script/check-duplicate-tags . || exit_code=$?
|
||||||
set +o pipefail
|
set +o pipefail
|
||||||
echo
|
echo
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ echo 'Invalid tag references tags follow:'
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
docker run "${docker_flags[@]}" test/script/check-tag-references || exit_code=$?
|
"$DOCKER" run "${docker_flags[@]}" test/script/check-tag-references || exit_code=$?
|
||||||
set +o pipefail
|
set +o pipefail
|
||||||
|
|
||||||
echo '========================================'
|
echo '========================================'
|
||||||
@@ -45,7 +45,7 @@ echo 'Differences follow:'
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
docker run "${docker_flags[@]}" test/script/check-supported-tools-tables || exit_code=$?
|
"$DOCKER" run "${docker_flags[@]}" test/script/check-supported-tools-tables || exit_code=$?
|
||||||
set +o pipefail
|
set +o pipefail
|
||||||
|
|
||||||
echo '========================================'
|
echo '========================================'
|
||||||
@@ -55,7 +55,7 @@ echo 'Badly aligned tags follow:'
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
docker run "${docker_flags[@]}" test/script/check-tag-alignment || exit_code=$?
|
"$DOCKER" run "${docker_flags[@]}" test/script/check-tag-alignment || exit_code=$?
|
||||||
set +o pipefail
|
set +o pipefail
|
||||||
|
|
||||||
echo '========================================'
|
echo '========================================'
|
||||||
@@ -64,7 +64,7 @@ echo '========================================'
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
docker run "${docker_flags[@]}" test/script/check-toc || exit_code=$?
|
"$DOCKER" run "${docker_flags[@]}" test/script/check-toc || exit_code=$?
|
||||||
set +o pipefail
|
set +o pipefail
|
||||||
|
|
||||||
echo '========================================'
|
echo '========================================'
|
||||||
@@ -72,7 +72,7 @@ echo 'Check Python code'
|
|||||||
echo '========================================'
|
echo '========================================'
|
||||||
echo
|
echo
|
||||||
|
|
||||||
docker run --rm -v "$PWD:/testplugin" "$DOCKER_RUN_IMAGE" \
|
"$DOCKER" run --rm -v "$PWD:/testplugin" "$DOCKER_RUN_IMAGE" \
|
||||||
python -W ignore -m unittest discover /testplugin/test/python \
|
python -W ignore -m unittest discover /testplugin/test/python \
|
||||||
|| exit_code=$?
|
|| exit_code=$?
|
||||||
echo
|
echo
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ while [ "$tries" -lt 5 ]; do
|
|||||||
exit_code=0
|
exit_code=0
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${docker_flags[@]}" \
|
"$DOCKER" run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${docker_flags[@]}" \
|
||||||
"/vim-build/bin/$vim" -u test/vimrc ${headless} \
|
"/vim-build/bin/$vim" -u test/vimrc ${headless} \
|
||||||
"+Vader! $tests" 2>&1 | filter-vader-output | color-vader-output || exit_code=$?
|
"+Vader! $tests" 2>&1 | filter-vader-output | color-vader-output || exit_code=$?
|
||||||
set +o pipefail
|
set +o pipefail
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ echo 'Vint warnings/errors follow:'
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
docker run -a stdout "${docker_flags[@]}" vint -s . || exit_code=$?
|
"$DOCKER" run -a stdout "${docker_flags[@]}" vint -s . || exit_code=$?
|
||||||
set +o pipefail
|
set +o pipefail
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user