diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml deleted file mode 100644 index 3a28bdcbc..000000000 --- a/.github/workflows/go.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Go - -on: - push: - branches: - - v6.x - pull_request: - branches: - - v6.x - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version-file: "src/go.mod" - - run: go run github.com/onsi/ginkgo/v2/ginkgo -r --race --randomize-all --randomize-suites --keep-going - working-directory: src - - vet: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version-file: "src/go.mod" - - run: go vet ./... - working-directory: src - - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version-file: "src/go.mod" - - uses: golangci/golangci-lint-action@v3.3.1 - with: - args: --config .golangci.yml - working-directory: src diff --git a/.github/workflows/scripts.yml b/.github/workflows/scripts.yml new file mode 100644 index 000000000..623020b8b --- /dev/null +++ b/.github/workflows/scripts.yml @@ -0,0 +1,28 @@ +name: scripts + +on: + push: + branches: + - v[0-9]* + pull_request: + branches: + - v[0-9]* + +jobs: + unit-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: "src/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: "src/go.mod" + - run: ./scripts/subtests/lint diff --git a/scripts/subtests/lint b/scripts/subtests/lint new file mode 100755 index 000000000..bb8f5c95b --- /dev/null +++ b/scripts/subtests/lint @@ -0,0 +1,18 @@ +#!/bin/bash + +set -eux +set -o pipefail + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +set +e +golangci_lint_executable=$(which golangci-lint) +set -e +if [ -z "${golangci_lint_executable}" ] || [ ! -x "${golangci_lint_executable}" ]; then + go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest +fi + +pushd "${SCRIPT_DIR}/../../src" > /dev/null + golangci-lint run ./... +popd > /dev/null + diff --git a/scripts/subtests/unit-test b/scripts/subtests/unit-test new file mode 100755 index 000000000..28d6e9674 --- /dev/null +++ b/scripts/subtests/unit-test @@ -0,0 +1,11 @@ +#!/bin/bash + +set -eux +set -o pipefail + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +pushd "${SCRIPT_DIR}/../../src" > /dev/null + go run github.com/onsi/ginkgo/v2/ginkgo -r --randomize-all --randomize-suites --fail-on-pending --keep-going --race --trace +popd > /dev/null + diff --git a/scripts/test b/scripts/test new file mode 100755 index 000000000..382cecd0a --- /dev/null +++ b/scripts/test @@ -0,0 +1,10 @@ +#!/bin/bash + +set -eux +set -o pipefail + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +"${SCRIPT_DIR}/subtests/lint" +"${SCRIPT_DIR}/subtests/unit-test" +