From 9eba08cb7a6b9f422b0a73177a2d7dc859a397b1 Mon Sep 17 00:00:00 2001 From: Joris Baum Date: Mon, 23 Feb 2026 09:49:58 +0100 Subject: [PATCH 1/2] fix: Add new test scripts See also https://github.com/cloudfoundry/loggregator-release/commit/612b9ad3c473b07d75b928e4062fac974a6614e3 --- scripts/subtests/lint | 14 ++++++++++++++ scripts/subtests/unit-test | 17 +++++++++++++++++ scripts/test | 13 ++++++------- 3 files changed, 37 insertions(+), 7 deletions(-) create mode 100755 scripts/subtests/lint create mode 100755 scripts/subtests/unit-test diff --git a/scripts/subtests/lint b/scripts/subtests/lint new file mode 100755 index 00000000..b2d91cf4 --- /dev/null +++ b/scripts/subtests/lint @@ -0,0 +1,14 @@ +#!/bin/bash + +set -eux +set -o pipefail + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +if ! command -v golangci-lint &> /dev/null; then + go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest +fi + +pushd "${SCRIPT_DIR}/../.." > /dev/null + golangci-lint run ./... +popd > /dev/null \ No newline at end of file diff --git a/scripts/subtests/unit-test b/scripts/subtests/unit-test new file mode 100755 index 00000000..783efc82 --- /dev/null +++ b/scripts/subtests/unit-test @@ -0,0 +1,17 @@ +#!/bin/bash + +set -eux +set -o pipefail + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +flags='-r --randomize-all --randomize-suites --fail-on-pending --keep-going --race --trace' +if [ "${CI:-false}" = 'false' ]; then + flags="${flags} -p" +fi +pushd "${SCRIPT_DIR}/../.." > /dev/null + if ! command -v ginkgo &> /dev/null; then + go install github.com/onsi/ginkgo/v2/ginkgo@latest + fi + ginkgo $flags +popd > /dev/null \ No newline at end of file diff --git a/scripts/test b/scripts/test index e6a5195b..3484a194 100755 --- a/scripts/test +++ b/scripts/test @@ -1,10 +1,9 @@ #!/bin/bash -go get github.com/onsi/gomega -go get github.com/cloudfoundry/dropsonde/... -go get github.com/golang/protobuf -go get golang.org/x/net -go get golang.org/x/text +set -eux +set -o pipefail -set -ex -ginkgo -r -race +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +"${SCRIPT_DIR}/subtests/lint" +"${SCRIPT_DIR}/subtests/unit-test" \ No newline at end of file From e2f79b7e30e6ffb2527fbdeafe9e7ef4af59385f Mon Sep 17 00:00:00 2001 From: Joris Baum Date: Mon, 23 Feb 2026 09:50:52 +0100 Subject: [PATCH 2/2] Fix: Use new test scripts in GH action We can do this because: * golanci-lint already uses go vet internally * ginkgo command does what `go test -race` did and more --- .github/workflows/go.yml | 39 ----------------------------------- .github/workflows/scripts.yml | 30 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 39 deletions(-) delete mode 100644 .github/workflows/go.yml create mode 100644 .github/workflows/scripts.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml deleted file mode 100644 index 55e86f63..00000000 --- a/.github/workflows/go.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Go - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - uses: actions/setup-go@v6 - with: - go-version-file: go.mod - - run: go test -race ./... - - vet: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - uses: actions/setup-go@v6 - with: - go-version-file: go.mod - - run: go vet ./... - - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - uses: actions/setup-go@v6 - with: - go-version-file: go.mod - - uses: golangci/golangci-lint-action@v9.2.0 - with: - args: --config .golangci.yml diff --git a/.github/workflows/scripts.yml b/.github/workflows/scripts.yml new file mode 100644 index 00000000..088ae53e --- /dev/null +++ b/.github/workflows/scripts.yml @@ -0,0 +1,30 @@ +name: scripts + +on: + push: + branches: + - main + - v[0-9]* + pull_request: + branches: + - main + - v[0-9]* + +jobs: + unit-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: "go.mod" + - run: ./scripts/subtests/unit-test + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: "go.mod" + - run: ./scripts/subtests/lint \ No newline at end of file