From 3895ec01f9eccbae02a27570e119a732f0464a6d Mon Sep 17 00:00:00 2001 From: Marek Siarkowicz Date: Mon, 28 Jun 2021 16:22:59 +0200 Subject: [PATCH] *: Upload test junit results --- .github/workflows/build.yaml | 56 ++++++++++++++++++++++++++ .github/workflows/e2e.yaml | 35 ---------------- .github/workflows/functional.yaml | 29 ------------- .github/workflows/grpcproxy.yaml | 30 -------------- .github/workflows/static-analysis.yaml | 29 +++++++++++++ .github/workflows/tests.yaml | 48 +++++++++++++--------- scripts/test_lib.sh | 9 +---- 7 files changed, 115 insertions(+), 121 deletions(-) create mode 100644 .github/workflows/build.yaml delete mode 100644 .github/workflows/e2e.yaml delete mode 100644 .github/workflows/functional.yaml delete mode 100644 .github/workflows/grpcproxy.yaml create mode 100644 .github/workflows/static-analysis.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 000000000000..4a74a180c581 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,56 @@ +name: Build +on: [push, pull_request] +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: + - linux-amd64 + - linux-386 + - darwin-amd64 + - windows-amd64 + - linux-arm + - linux-arm64 + - linux-ppc64le + - linux-s390x + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: "^1.16" + - env: + TARGET: ${{ matrix.target }} + run: | + echo "${TARGET}" + case "${TARGET}" in + linux-amd64) + GOARCH=amd64 PASSES='build' ./test.sh + ;; + linux-386) + GOARCH=386 PASSES='build' ./test.sh + ;; + darwin-amd64) + GO_BUILD_FLAGS='-v -mod=readonly' GOOS=darwin GOARCH=amd64 ./build.sh + ;; + windows-amd64) + GO_BUILD_FLAGS='-v -mod=readonly' GOOS=windows GOARCH=amd64 ./build.sh + ;; + linux-arm) + GO_BUILD_FLAGS='-v -mod=readonly' GOARCH=arm ./build.sh + ;; + linux-arm64) + GO_BUILD_FLAGS='-v -mod=readonly' GOARCH=arm64 ./build.sh + ;; + linux-ppc64le) + GO_BUILD_FLAGS='-v -mod=readonly' GOARCH=ppc64le ./build.sh + ;; + linux-s390x) + GO_BUILD_FLAGS='-v -mod=readonly' GOARCH=s390x ./build.sh + ;; + *) + echo "Failed to find target" + exit 1 + ;; + esac diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml deleted file mode 100644 index 4ec326b52eda..000000000000 --- a/.github/workflows/e2e.yaml +++ /dev/null @@ -1,35 +0,0 @@ -name: E2E -on: [push, pull_request] -jobs: - test: - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - target: - - linux-amd64-e2e - - linux-386-e2e - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 - with: - go-version: "^1.16" - - run: date - - env: - TARGET: ${{ matrix.target }} - run: | - echo "${TARGET}" - case "${TARGET}" in - linux-amd64-e2e) - PASSES='build release e2e' MANUAL_VER=v3.4.7 CPU='4' EXPECT_DEBUG='true' COVER='false' RACE='true' ./test.sh 2>&1 | tee test.log - ! egrep "(--- FAIL:|DATA RACE|panic: test timed out|appears to have leaked)" -B50 -A10 test.log - ;; - linux-386-e2e) - GOARCH=386 PASSES='build e2e' CPU='4' EXPECT_DEBUG='true' COVER='false' RACE='true' ./test.sh 2>&1 | tee test.log - ! egrep "(--- FAIL:|DATA RACE|panic: test timed out|appears to have leaked)" -B50 -A10 test.log - ;; - *) - echo "Failed to find target" - exit 1 - ;; - esac diff --git a/.github/workflows/functional.yaml b/.github/workflows/functional.yaml deleted file mode 100644 index 5fbceb8fcc3f..000000000000 --- a/.github/workflows/functional.yaml +++ /dev/null @@ -1,29 +0,0 @@ -name: functional-tests -on: [push, pull_request] -jobs: - test: - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - target: - - linux-amd64-functional - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 - with: - go-version: "^1.16" - - run: date - - env: - TARGET: ${{ matrix.target }} - run: | - echo "${TARGET}" - case "${TARGET}" in - linux-amd64-functional) - GO_BUILD_FLAGS='-v -mod=readonly' ./build.sh && GOARCH=amd64 PASSES='functional' ./test.sh - ;; - *) - echo "Failed to find target" - exit 1 - ;; - esac diff --git a/.github/workflows/grpcproxy.yaml b/.github/workflows/grpcproxy.yaml deleted file mode 100644 index 081d8be328f8..000000000000 --- a/.github/workflows/grpcproxy.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: grpcProxy-tests -on: [push, pull_request] -jobs: - test: - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - target: - - linux-amd64-grpcproxy - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 - with: - go-version: "^1.16" - - run: date - - env: - TARGET: ${{ matrix.target }} - run: | - echo "${TARGET}" - case "${TARGET}" in - linux-amd64-grpcproxy) - PASSES='build grpcproxy' CPU='4' COVER='false' RACE='true' ./test.sh 2>&1 | tee test.log - ! egrep "(--- FAIL:|DATA RACE|panic: test timed out|appears to have leaked)" -B50 -A10 test.log - ;; - *) - echo "Failed to find target" - exit 1 - ;; - esac diff --git a/.github/workflows/static-analysis.yaml b/.github/workflows/static-analysis.yaml new file mode 100644 index 000000000000..8ebc820013f4 --- /dev/null +++ b/.github/workflows/static-analysis.yaml @@ -0,0 +1,29 @@ +name: Static Analysis +on: [push, pull_request] +jobs: + run: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: + - linux-amd64-fmt + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: "^1.16" + - run: date + - env: + TARGET: ${{ matrix.target }} + run: | + echo "${TARGET}" + case "${TARGET}" in + linux-amd64-fmt) + GOARCH=amd64 PASSES='fmt bom dep' ./test.sh + ;; + *) + echo "Failed to find target" + exit 1 + ;; + esac diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index cf63ec25a82d..606f5304230f 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -1,5 +1,5 @@ name: Tests -on: [push, pull_request] +on: [push,pull_request] jobs: test: runs-on: ubuntu-latest @@ -7,13 +7,15 @@ jobs: fail-fast: false matrix: target: - - linux-amd64-fmt - linux-amd64-integration-1-cpu - linux-amd64-integration-2-cpu - linux-amd64-integration-4-cpu - linux-amd64-unit-4-cpu-race - - all-build + - linux-amd64-e2e + - linux-amd64-functional + - linux-amd64-grpcproxy - linux-386-unit-1-cpu + - linux-386-e2e steps: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 @@ -25,36 +27,42 @@ jobs: run: | echo "${TARGET}" case "${TARGET}" in - linux-amd64-fmt) - GOARCH=amd64 PASSES='fmt bom dep' ./test.sh - ;; linux-amd64-integration-1-cpu) - GOARCH=amd64 CPU=1 PASSES='integration' RACE='false' ./test.sh + GOARCH=amd64 CPU=1 PASSES='integration' RACE='false' JUNIT_REPORT_DIR=. ./test.sh ;; linux-amd64-integration-2-cpu) - GOARCH=amd64 CPU=2 PASSES='integration' RACE='false' ./test.sh + GOARCH=amd64 CPU=2 PASSES='integration' RACE='false' JUNIT_REPORT_DIR=. ./test.sh ;; linux-amd64-integration-4-cpu) - GOARCH=amd64 CPU=4 PASSES='integration' RACE='false' ./test.sh + GOARCH=amd64 CPU=4 PASSES='integration' RACE='false' JUNIT_REPORT_DIR=. ./test.sh ;; linux-amd64-unit-4-cpu-race) - GOARCH=amd64 PASSES='unit' RACE='true' CPU='4' ./test.sh -p=2 - ;; - all-build) - GOARCH=amd64 PASSES='build' ./test.sh - GOARCH=386 PASSES='build' ./test.sh - GO_BUILD_FLAGS='-v -mod=readonly' GOOS=darwin GOARCH=amd64 ./build.sh - GO_BUILD_FLAGS='-v -mod=readonly' GOOS=windows GOARCH=amd64 ./build.sh - GO_BUILD_FLAGS='-v -mod=readonly' GOARCH=arm ./build.sh - GO_BUILD_FLAGS='-v -mod=readonly' GOARCH=arm64 ./build.sh - GO_BUILD_FLAGS='-v -mod=readonly' GOARCH=ppc64le ./build.sh - GO_BUILD_FLAGS='-v -mod=readonly' GOARCH=s390x ./build.sh + GOARCH=amd64 PASSES='unit' RACE='true' CPU='4' JUNIT_REPORT_DIR=. ./test.sh -p=2 + ;; + linux-amd64-e2e) + PASSES='build release e2e' MANUAL_VER=v3.4.7 CPU='4' EXPECT_DEBUG='true' COVER='false' RACE='true' JUNIT_REPORT_DIR=. ./test.sh 2>&1 | tee test.log + ! egrep "(--- FAIL:|DATA RACE|panic: test timed out|appears to have leaked)" -B50 -A10 test.log + ;; + linux-amd64-functional) + GO_BUILD_FLAGS='-v -mod=readonly' ./build.sh && GOARCH=amd64 PASSES='functional' JUNIT_REPORT_DIR=. ./test.sh + ;; + linux-amd64-grpcproxy) + PASSES='build grpcproxy' CPU='4' COVER='false' RACE='true' JUNIT_REPORT_DIR=. ./test.sh 2>&1 | tee test.log + ! egrep "(--- FAIL:|DATA RACE|panic: test timed out|appears to have leaked)" -B50 -A10 test.log ;; linux-386-unit-1-cpu) GOARCH=386 PASSES='unit' RACE='false' CPU='1' ./test -p=4 ;; + linux-386-e2e) + GOARCH=386 PASSES='build e2e' CPU='4' EXPECT_DEBUG='true' COVER='false' RACE='true' ./test.sh 2>&1 | tee test.log + ! egrep "(--- FAIL:|DATA RACE|panic: test timed out|appears to have leaked)" -B50 -A10 test.log + ;; *) echo "Failed to find target" exit 1 ;; esac + - uses: actions/upload-artifact@v2 + if: always() + with: + path: ./**/junit_*.xml diff --git a/scripts/test_lib.sh b/scripts/test_lib.sh index 6a27e0591b40..60fba1f5adfc 100644 --- a/scripts/test_lib.sh +++ b/scripts/test_lib.sh @@ -231,13 +231,8 @@ function produce_junit_xmlreport { local junit_xml_filename junit_xml_filename="${junit_filename_prefix}.xml" - if ! command -v gotestsum >/dev/null 2>&1; then - log_callout "gotestsum not found; installing now" - pushd "${ETCD_ROOT_DIR}/tools/mod" >/dev/null || return - GO111MODULE=on go install gotest.tools/gotestsum - popd >/dev/null || return - fi - gotestsum --junitfile "${junit_xml_filename}" --raw-command cat "${junit_filename_prefix}"*.stdout + # Ensure that gotestsum is run without cross-compiling + GOARCH= run_go_tool gotest.tools/gotestsum --junitfile "${junit_xml_filename}" --raw-command cat "${junit_filename_prefix}"*.stdout || exit 1 if [ "${VERBOSE}" != "1" ]; then rm "${junit_filename_prefix}"*.stdout fi