Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions bin/verify-exercises-in-docker
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ copy_example_or_examplar_to_solution() {
}

pull_docker_image() {
docker pull exercism/lean-test-runner ||
die $'Could not find the `exercism/lean-test-runner` Docker image.\nCheck the test runner docs at https://exercism.org/docs/building/tooling/test-runners for more information.'
docker pull "${image}" ||
die $'Could not find the `'"${image}"$'` Docker image.\nCheck the test runner docs at https://exercism.org/docs/building/tooling/test-runners for more information.'
}

run_tests() {
Expand All @@ -43,8 +43,9 @@ run_tests() {
--read-only \
--mount type=bind,src="${PWD}",dst=/solution \
--mount type=bind,src="${PWD}",dst=/output \
--mount type=tmpfs,dst=/tmp \
exercism/lean-test-runner "${slug}" /solution /output
--tmpfs /tmp:exec \
"${image}" "${slug}" /solution /output
jq -re '.message // .status' "${PWD}/results.json"
jq -e '.status == "pass"' "${PWD}/results.json" >/dev/null 2>&1
}

Expand Down Expand Up @@ -83,7 +84,19 @@ verify_exercises() {
((count > 0)) || die 'no matching exercises found!'
}

pull_docker_image
image=''
while getopts :i: opt; do
case $opt in
i) image=$OPTARG ;;
?) echo >&2 "Unknown option: -$OPTARG"; exit 1 ;;
esac
done
shift "$((OPTIND - 1))"

if [[ -z "${image}" ]]; then
image="exercism/lean-test-runner"
pull_docker_image
fi

exercise_slug="${1:-*}"
verify_exercises "${exercise_slug}"
Loading