From 7b1069ad6355228e413557eaaadfbd025090a3db Mon Sep 17 00:00:00 2001 From: Chao Chen Date: Sun, 19 Mar 2023 23:02:17 -0700 Subject: [PATCH] add etcd test analyzer build and integrate into measure-test-flakiness workflow Signed-off-by: Chao Chen --- .github/workflows/measure-test-flakiness.yaml | 9 ++++++--- Makefile | 4 ++++ scripts/build_etcd_test_analyzer.sh | 6 ++++++ scripts/build_lib.sh | 18 ++++++++++++++++++ 4 files changed, 34 insertions(+), 3 deletions(-) create mode 100755 scripts/build_etcd_test_analyzer.sh diff --git a/.github/workflows/measure-test-flakiness.yaml b/.github/workflows/measure-test-flakiness.yaml index 9fbb8993b706..dfb9d042bd0a 100644 --- a/.github/workflows/measure-test-flakiness.yaml +++ b/.github/workflows/measure-test-flakiness.yaml @@ -2,7 +2,7 @@ name: Measure Test Flakiness on: schedule: - - cron: "0 0 * * 0" + - cron: "0 0 * * 0" # run every Sunday at midnight permissions: read-all @@ -12,6 +12,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 - - run: "./scripts/measure-test-flakiness.sh" - env: + - env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + ./scripts/measure-test-flakiness.sh + GOARCH=amd64 ./scripts/build_etcd_test_analyzer.sh + bin/etcd-test-analyzer run -token $GITHUB_TOKEN -max-age=168h -workflow Tests -branch main diff --git a/Makefile b/Makefile index cf9d51eb8425..0d56cc6c5cf7 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,10 @@ build: tools: GO_BUILD_FLAGS="${GO_BUILD_FLAGS} -v" ./scripts/build_tools.sh +.PHONY: test-analyzer +test-analyzer: + GO_BUILD_FLAGS="${GO_BUILD_FLAGS} -v" ./scripts/build_etcd_test_analyzer.sh + # Tests GO_TEST_FLAGS?= diff --git a/scripts/build_etcd_test_analyzer.sh b/scripts/build_etcd_test_analyzer.sh new file mode 100755 index 000000000000..ee8da5e574e7 --- /dev/null +++ b/scripts/build_etcd_test_analyzer.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +source ./scripts/test_lib.sh +source ./scripts/build_lib.sh + +run_build etcd_test_analyzer_build diff --git a/scripts/build_lib.sh b/scripts/build_lib.sh index 5fe6dd67e692..4262e9aac9d2 100755 --- a/scripts/build_lib.sh +++ b/scripts/build_lib.sh @@ -80,6 +80,24 @@ tools_build() { done } +etcd_test_analyzer_build() { + out="bin" + tool="etcd-test-analyzer" + dst="${PWD}/${out}/${tool}" + if [[ -n "${BINDIR}" ]]; then out="${BINDIR}"; fi + pushd /tmp || return 1 + if [[ ! -d "$tool" ]]; then + git clone "https://github.com/endocrimes/$tool.git" + fi + cd "$tool" || return 1 + echo "Building" "'${tool}'" "to" "'${dst}'"... + run env GO_BUILD_FLAGS="${GO_BUILD_FLAGS}" CGO_ENABLED=0 go build ${GO_BUILD_FLAGS} \ + -trimpath \ + -installsuffix=cgo \ + -o="${dst}" || return 2 + popd || return 1 +} + run_build() { echo Running "$1" if $1; then