mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-21 00:31:15 -03:00
Use test_driver directly instead of CMake in the docker tests. Deal with the read-only "/fish-source" by exporting "CARGO_TARGET_DIR=$HOME/fish-build". It seems correct to also inject this environment variable into the interactive debugging shells. Add some logging to make this override more obvious to the user. Adopt "build_tools/check.sh", because that defines the full set of checks that we (eventually) want to run in CI. In particular, this will also run "tests/checks/po-files-up-to-date.fish" which "cargo b && cargo t && tests/test_driver.py" does not, due to the REQUIRES clause. Since most docker images have some lints/warnings today, disable those for now. Use "docker_run_tests.sh --lint" to override. The default may be changed in future.
62 lines
1.6 KiB
Bash
Executable File
62 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
usage() {
|
|
cat << EOF
|
|
Usage: $(basename "$0") [--shell-before] [--shell-after] DOCKERFILE
|
|
Options:
|
|
--shell-before Before the tests start, run a bash shell
|
|
--shell-after After the tests end, run a bash shell
|
|
--lint, --no-lint Enable/disable linting and failure on warnings
|
|
EOF
|
|
exit 1
|
|
}
|
|
|
|
DOCKER_EXTRA_ARGS=""
|
|
|
|
export DOCKER_BUILDKIT=1
|
|
|
|
# Exit on failure.
|
|
set -e
|
|
|
|
# Get fish source directory.
|
|
FISH_SRC_DIR=$(cd "$( dirname "$0" )"/.. >/dev/null && pwd)
|
|
|
|
# Parse args.
|
|
while [ $# -gt 1 ]; do
|
|
case "$1" in
|
|
--shell-before)
|
|
DOCKER_EXTRA_ARGS="$DOCKER_EXTRA_ARGS --env FISH_RUN_SHELL_BEFORE_TESTS=1"
|
|
;;
|
|
--shell-after)
|
|
DOCKER_EXTRA_ARGS="$DOCKER_EXTRA_ARGS --env FISH_RUN_SHELL_AFTER_TESTS=1"
|
|
;;
|
|
--lint)
|
|
DOCKER_EXTRA_ARGS="$DOCKER_EXTRA_ARGS --env FISH_CHECK_LINT=true"
|
|
;;
|
|
--no-lint)
|
|
DOCKER_EXTRA_ARGS="$DOCKER_EXTRA_ARGS --env FISH_CHECK_LINT=false"
|
|
;;
|
|
*)
|
|
usage
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
DOCKERFILE="$1"
|
|
test -n "$DOCKERFILE" || usage
|
|
|
|
# Construct a docker image.
|
|
IMG_TAGNAME="ghcr.io/fish-shell/fish-ci/$(basename -s .Dockerfile "$DOCKERFILE"):latest"
|
|
docker build \
|
|
-t "$IMG_TAGNAME" \
|
|
-f "$DOCKERFILE" \
|
|
"$FISH_SRC_DIR"/docker/context/
|
|
|
|
# Run tests in it, allowing them to fail without failing this script.
|
|
# shellcheck disable=SC2086 # $DOCKER_EXTRA_ARGS should have globbing and splitting applied.
|
|
docker run -it \
|
|
--mount type=bind,source="$FISH_SRC_DIR",target=/fish-source,readonly \
|
|
$DOCKER_EXTRA_ARGS \
|
|
"$IMG_TAGNAME"
|