From 635904fcb6f7c16309fb5ec66f4c27c1d7703e15 Mon Sep 17 00:00:00 2001 From: Alex Goodman Date: Wed, 2 Mar 2022 12:51:37 -0500 Subject: [PATCH] Reduce PR check failures (#858) --- .github/workflows/codeql-analysis.yml | 8 +++--- .github/workflows/validations.yaml | 2 ++ test/install/test_harness.sh | 35 ++++++++++++++++++++++++--- 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 20083af53..ae80de85c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -7,10 +7,10 @@ name: "CodeQL Security Scan" on: push: - branches: [main] - pull_request: - # The branches below must be a subset of the branches above - branches: [main] + branches: + # only run when there are pushes to the main branch (not on PRs) + - main + schedule: - cron: '0 0 * * 3' diff --git a/.github/workflows/validations.yaml b/.github/workflows/validations.yaml index c047936af..bf50df0f1 100644 --- a/.github/workflows/validations.yaml +++ b/.github/workflows/validations.yaml @@ -2,6 +2,8 @@ name: "Validations" on: workflow_dispatch: push: + branches: + - main pull_request: env: diff --git a/test/install/test_harness.sh b/test/install/test_harness.sh index 0a1acec3a..8db34de36 100644 --- a/test/install/test_harness.sh +++ b/test/install/test_harness.sh @@ -5,6 +5,15 @@ TEST_INSTALL_SH=true . ../../install.sh set -u +echoerr() { + echo "$@" 1>&2 +} + +printferr() { + printf "%s" "$*" >&2 +} + + assertTrue() { if eval "$1"; then echo "assertTrue failed: $2" @@ -93,16 +102,34 @@ setup_snapshot_server() { python3 -m http.server --directory "$(snapshot_dir)" $serve_port &> /dev/null & worker_pid=$! - # it takes some time for the server to be ready... - sleep 3 + echoerr "serving up $(snapshot_dir) on port $serve_port" + + echoerr "$(ls -1 $(snapshot_dir) | sed 's/^/ ▕―― /')" + + check_snapshots_server_ready + + echoerr "snapshot server ready! (worker=${worker_pid})" echo "$worker_pid" } +check_snapshots_server_ready() { + i=0 + until $(curl -m 3 --output /dev/null --silent --head --fail localhost:$serve_port/); do + sleep 1 + ((i=i+1)) + if [ "$i" -gt "30" ]; then + echoerr "could not connect to local snapshot server! bailing..." + exit 1 + fi + printferr '.' + done +} + teardown_snapshot_server() { worker_pid="$1" - - kill $worker_pid + echoerr "stopping worker=${worker_pid}" + kill "$worker_pid" } snapshot_version() {