From fd8bdc4701e259b391fec5b01aac281459269d53 Mon Sep 17 00:00:00 2001 From: shivaji-dgraph Date: Wed, 18 Dec 2024 16:27:57 +0530 Subject: [PATCH] separate CI wrokflows --- ...aph-tests.yml => ci-dgraph-core-tests.yml} | 4 +- .github/workflows/ci-dgraph-systest-tests.yml | 59 +++++++++++++++++++ .github/workflows/ci-dgraph-vector-tests.yml | 59 +++++++++++++++++++ t/t.go | 35 ++++++++++- 4 files changed, 153 insertions(+), 4 deletions(-) rename .github/workflows/{ci-dgraph-tests.yml => ci-dgraph-core-tests.yml} (96%) create mode 100644 .github/workflows/ci-dgraph-systest-tests.yml create mode 100644 .github/workflows/ci-dgraph-vector-tests.yml diff --git a/.github/workflows/ci-dgraph-tests.yml b/.github/workflows/ci-dgraph-core-tests.yml similarity index 96% rename from .github/workflows/ci-dgraph-tests.yml rename to .github/workflows/ci-dgraph-core-tests.yml index 1e3b2533de5..d4910237af9 100644 --- a/.github/workflows/ci-dgraph-tests.yml +++ b/.github/workflows/ci-dgraph-core-tests.yml @@ -13,7 +13,7 @@ on: - main - 'release/**' jobs: - dgraph-tests: + dgraph-core-tests: if: github.event.pull_request.draft == false runs-on: warp-ubuntu-latest-x64-4x steps: @@ -52,7 +52,7 @@ jobs: # move the binary cp dgraph/dgraph ~/go/bin/dgraph # run the unit and integration tests - cd t; ./t + cd t; ./t --suite=core # clean up docker containers after test execution ./t -r # sleep diff --git a/.github/workflows/ci-dgraph-systest-tests.yml b/.github/workflows/ci-dgraph-systest-tests.yml new file mode 100644 index 00000000000..d9908b469c1 --- /dev/null +++ b/.github/workflows/ci-dgraph-systest-tests.yml @@ -0,0 +1,59 @@ +name: ci-dgraph-tests +on: + pull_request: + paths: + - '**/*.go' + - '**/go.mod' + types: + - opened + - reopened + - synchronize + - ready_for_review + branches: + - main + - 'release/**' +jobs: + dgraph-systest-tests: + if: github.event.pull_request.draft == false + runs-on: warp-ubuntu-latest-x64-4x + steps: + - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Install protobuf-compiler + run: sudo apt update && sudo apt install -y protobuf-compiler + - name: Check protobuf + run: | + cd ./protos + go mod tidy + make regenerate + git diff --exit-code -- . + - name: Make Linux Build and Docker Image + run: make docker-image + - name: Build Test Binary + run: | + #!/bin/bash + # build the test binary + cd t; go build . + - name: Clean Up Environment + run: | + #!/bin/bash + # clean cache + go clean -testcache + # clean up docker containers before test execution + cd t; ./t -r + - name: Run Unit Tests + run: | + #!/bin/bash + # go env settings + export GOPATH=~/go + # move the binary + cp dgraph/dgraph ~/go/bin/dgraph + # run the unit and integration tests + cd t; ./t --suite=systest + # clean up docker containers after test execution + ./t -r + # sleep + sleep 5 diff --git a/.github/workflows/ci-dgraph-vector-tests.yml b/.github/workflows/ci-dgraph-vector-tests.yml new file mode 100644 index 00000000000..07c3a4399b8 --- /dev/null +++ b/.github/workflows/ci-dgraph-vector-tests.yml @@ -0,0 +1,59 @@ +name: ci-dgraph-tests +on: + pull_request: + paths: + - '**/*.go' + - '**/go.mod' + types: + - opened + - reopened + - synchronize + - ready_for_review + branches: + - main + - 'release/**' +jobs: + dgraph-vector-tests: + if: github.event.pull_request.draft == false + runs-on: warp-ubuntu-latest-x64-4x + steps: + - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Install protobuf-compiler + run: sudo apt update && sudo apt install -y protobuf-compiler + - name: Check protobuf + run: | + cd ./protos + go mod tidy + make regenerate + git diff --exit-code -- . + - name: Make Linux Build and Docker Image + run: make docker-image + - name: Build Test Binary + run: | + #!/bin/bash + # build the test binary + cd t; go build . + - name: Clean Up Environment + run: | + #!/bin/bash + # clean cache + go clean -testcache + # clean up docker containers before test execution + cd t; ./t -r + - name: Run Unit Tests + run: | + #!/bin/bash + # go env settings + export GOPATH=~/go + # move the binary + cp dgraph/dgraph ~/go/bin/dgraph + # run the unit and integration tests + cd t; ./t --suite=vector + # clean up docker containers after test execution + ./t -r + # sleep + sleep 5 diff --git a/t/t.go b/t/t.go index 7009b173ec2..fd815ca8405 100644 --- a/t/t.go +++ b/t/t.go @@ -720,7 +720,7 @@ func testSuiteContains(suite string) bool { func isValidPackageForSuite(pkg string) bool { valid := false if testSuiteContains("all") { - valid = true + return true } if testSuiteContains("ldbc") { valid = valid || isLDBCPackage(pkg) @@ -731,6 +731,15 @@ func isValidPackageForSuite(pkg string) bool { if testSuiteContains("unit") { valid = valid || (!isLoadPackage(pkg) && !isLDBCPackage(pkg)) } + if testSuiteContains("vector") { + valid = valid || isVectorPackage(pkg) + } + if testSuiteContains("systest") { + valid = valid || isSystestPackage(pkg) + } + if testSuiteContains("core") { + valid = valid || isCorePackage(pkg) + } if valid { return valid } @@ -750,6 +759,28 @@ func isLDBCPackage(pkg string) bool { return strings.HasSuffix(pkg, "/systest/ldbc") } +func isSystestPackage(pkg string) bool { + if !strings.Contains(pkg, "/systest") { + return false + } + return !isExcludedFromSystest(pkg) +} + +func isExcludedFromSystest(pkg string) bool { + return isLDBCPackage(pkg) || isLoadPackage(pkg) || isVectorPackage(pkg) +} + +func isCorePackage(pkg string) bool { + if isSystestPackage(pkg) || isLDBCPackage(pkg) || isVectorPackage(pkg) || isLoadPackage(pkg) { + return false + } + return true +} + +func isVectorPackage(pkg string) bool { + return strings.HasSuffix(pkg, "/vector") +} + var datafiles = map[string]string{ "1million-noindex.schema": "https://github.com/dgraph-io/benchmarks/blob/master/data/1million-noindex.schema?raw=true", "1million.schema": "https://github.com/dgraph-io/benchmarks/blob/master/data/1million.schema?raw=true", @@ -1041,7 +1072,7 @@ func run() error { func validateAllowed(testSuite []string) { - allowed := []string{"all", "ldbc", "load", "unit"} + allowed := []string{"all", "ldbc", "load", "unit", "systest", "vector", "core"} for _, str := range testSuite { onlyAllowed := false for _, allowedStr := range allowed {