From 0bc38153ca0e5160915c59f1148fb8efffbbd856 Mon Sep 17 00:00:00 2001 From: Trent Nelson Date: Mon, 21 Jun 2021 21:21:42 -0600 Subject: [PATCH] ci: add wrapper script for running ci locally Linux only for now --- ci/env.sh | 5 ++++- ci/run-local.sh | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100755 ci/run-local.sh diff --git a/ci/env.sh b/ci/env.sh index d075b25999..df7ed1ce6a 100644 --- a/ci/env.sh +++ b/ci/env.sh @@ -74,10 +74,13 @@ else export CI_BUILD_ID= export CI_COMMIT= export CI_JOB_ID= - export CI_OS_NAME= export CI_PULL_REQUEST= export CI_REPO_SLUG= export CI_TAG= + # Don't override ci/run-local.sh + if [[ -z $CL_LOCAL_RUN ]]; then + export CI_OS_NAME= + fi fi cat <&2 + exit 1 + ;; +esac + +steps=() +steps+=(test-sanity) +steps+=(shellcheck) +steps+=(test-checks) +steps+=(test-coverage) +steps+=(test-stable) +steps+=(test-stable-perf) +steps+=(test-downstream-builds) +steps+=(test-bench) +steps+=(test-local-cluster) + +step_index=0 +if [[ -n "$1" ]]; then + start_step="$1" + while [[ $step_index -lt ${#steps[@]} ]]; do + step="${steps[$step_index]}" + if [[ "$step" = "$start_step" ]]; then + break + fi + step_index=$((step_index + 1)) + done + if [[ $step_index -eq ${#steps[@]} ]]; then + echo "unexpected start step: \"$start_step\"" 1>&2 + exit 1 + else + echo "** starting at step: \"$start_step\" **" + echo + fi +fi + +while [[ $step_index -lt ${#steps[@]} ]]; do + step="${steps[$step_index]}" + cmd="ci/${step}.sh" + $cmd + step_index=$((step_index + 1)) +done