From df0bc3eef4b5b4157c9402fa1a44138097a56bc7 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 26 Apr 2022 15:55:21 -0400 Subject: [PATCH 1/4] Switch to the shared lint action --- .github/workflows/build.yaml | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 68fc1ae..d2d03d3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -10,35 +10,17 @@ on: - "*" jobs: lint: - name: "Lint" + name: "Lint Go" runs-on: "ubuntu-latest" steps: - - uses: "actions/setup-go@v2" - with: - go-version: "^1.16" - - name: "Install linting tools" - # This is done before checking out, as to not modify go.mod - run: "go install mvdan.cc/gofumpt/gofumports@v0.1.1" - - uses: "actions/checkout@v2" - - uses: "bewuethr/yamllint-action@v1.1.1" - with: - config-file: ".yamllint" - - name: "Go Mod Tidy" - run: "go mod tidy && bash -c '[ $(git status --porcelain | tee /dev/fd/2 | wc -c) -eq 0 ]'" - - name: "Formatting (gofumpt)" - run: | - GOFUMPT_OUTPUT="$(find . -iname '*.go' -type f | grep -v pb.go | grep -v 'pb.*.go' | xargs gofumports -d)" - if [ -n "$GOFUMPT_OUTPUT" ]; then - echo "All the following files are not correctly formatted" - echo "${GOFUMPT_OUTPUT}" - exit 1 - fi - - uses: "golangci/golangci-lint-action@v2" + - uses: "actions/checkout@v3" + - uses: "actions/setup-go@v3" with: - version: "v1.43" - skip-go-installation: true - skip-pkg-cache: true - skip-build-cache: false + go-version: "~1.18" + - uses: "authzed/actions/gofumpt@main" + - uses: "authzed/actions/go-mod-tidy@main" + - uses: "authzed/actions/go-generate@main" + - uses: "authzed/actions/golangci-lint@main" test: name: "Test" From b9ea6750880c7009a1fa4d02f1040ec2398fda75 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 26 Apr 2022 16:00:39 -0400 Subject: [PATCH 2/4] Switch test action to use shared actions --- .github/workflows/build.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d2d03d3..457eaee 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -26,13 +26,14 @@ jobs: name: "Test" runs-on: "ubuntu-latest" steps: - - uses: "actions/checkout@v2" - - uses: "actions/setup-go@v2" + - uses: "actions/checkout@v3" + - uses: "actions/setup-go@v3" with: - go-version: "^1.16" - - uses: "authzed/action-testserver@v3" - - name: "go test" - run: "go test -tags integration ./..." + go-version: "~1.18" + - uses: "authzed/action-spicedb@v1" + - uses: "authzed/actions/go-test@main" + with: + tags: "integration" protobuf: name: "Generate Protobufs" From 0fd5d40fa9b3f3fd726e0c093250de2aa59a9654 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 26 Apr 2022 16:19:47 -0400 Subject: [PATCH 3/4] Parallelize the test suite --- proto/authzed/api/validation_test/tuples_test.go | 4 ++++ v0/flatten_test.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/proto/authzed/api/validation_test/tuples_test.go b/proto/authzed/api/validation_test/tuples_test.go index fc0b418..0b91c87 100644 --- a/proto/authzed/api/validation_test/tuples_test.go +++ b/proto/authzed/api/validation_test/tuples_test.go @@ -154,6 +154,8 @@ func TestV0CoreObjectValidity(t *testing.T) { for _, relation := range relations { testName := fmt.Sprintf("%s:%s#%s@%s", ns.name, objectID.name, relation.name, subjectID.name) t.Run(testName, func(t *testing.T) { + t.Parallel() + require := require.New(t) v0ObjectValid := ns.valid && objectID.valid && (relation.validity == alwaysValid || @@ -267,6 +269,8 @@ func TestV1CoreObjectValidity(t *testing.T) { for _, relation := range relations { testName := fmt.Sprintf("%s:%s#%s@%s", ns.name, objectID.name, relation.name, subjectID.name) t.Run(testName, func(t *testing.T) { + t.Parallel() + require := require.New(t) objRef := &v1.ObjectReference{ diff --git a/v0/flatten_test.go b/v0/flatten_test.go index 1014475..eadfc7a 100644 --- a/v0/flatten_test.go +++ b/v0/flatten_test.go @@ -113,6 +113,8 @@ func TestFlatten(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { + t.Parallel() + var flattened userSet = make(map[string]struct{}) flattened.add(flatten(tc.tree)...) From 63d5223335c2b039a9b94b3058441abc304a9e89 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 26 Apr 2022 17:27:34 -0400 Subject: [PATCH 4/4] Disable race detector on authzed-go tests --- .github/workflows/build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 457eaee..1f7c265 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -34,6 +34,7 @@ jobs: - uses: "authzed/actions/go-test@main" with: tags: "integration" + race: "false" protobuf: name: "Generate Protobufs"