ci: add wrapper script for running ci locally
Linux only for now
This commit is contained in:
		
				
					committed by
					
						
						Trent Nelson
					
				
			
			
				
	
			
			
			
						parent
						
							761e324982
						
					
				
				
					commit
					0bc38153ca
				
			@@ -74,10 +74,13 @@ else
 | 
				
			|||||||
  export CI_BUILD_ID=
 | 
					  export CI_BUILD_ID=
 | 
				
			||||||
  export CI_COMMIT=
 | 
					  export CI_COMMIT=
 | 
				
			||||||
  export CI_JOB_ID=
 | 
					  export CI_JOB_ID=
 | 
				
			||||||
  export CI_OS_NAME=
 | 
					 | 
				
			||||||
  export CI_PULL_REQUEST=
 | 
					  export CI_PULL_REQUEST=
 | 
				
			||||||
  export CI_REPO_SLUG=
 | 
					  export CI_REPO_SLUG=
 | 
				
			||||||
  export CI_TAG=
 | 
					  export CI_TAG=
 | 
				
			||||||
 | 
					  # Don't override ci/run-local.sh
 | 
				
			||||||
 | 
					  if [[ -z $CL_LOCAL_RUN ]]; then
 | 
				
			||||||
 | 
					    export CI_OS_NAME=
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cat <<EOF
 | 
					cat <<EOF
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										54
									
								
								ci/run-local.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										54
									
								
								ci/run-local.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,54 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cd "$(dirname "$0")/.."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export CI_LOCAL_RUN=true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set -e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					case $(uname -o) in
 | 
				
			||||||
 | 
					  */Linux)
 | 
				
			||||||
 | 
					    export CI_OS_NAME=linux
 | 
				
			||||||
 | 
					    ;;
 | 
				
			||||||
 | 
					  *)
 | 
				
			||||||
 | 
					    echo "local CI runs are only supported on Linux" 1>&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
 | 
				
			||||||
		Reference in New Issue
	
	Block a user