Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to the shared actions #58

Merged
merged 4 commits into from Apr 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
48 changes: 16 additions & 32 deletions .github/workflows/build.yaml
Expand Up @@ -10,47 +10,31 @@ 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"
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"
race: "false"

protobuf:
name: "Generate Protobufs"
Expand Down
4 changes: 4 additions & 0 deletions proto/authzed/api/validation_test/tuples_test.go
Expand Up @@ -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 ||
Expand Down Expand Up @@ -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{
Expand Down
2 changes: 2 additions & 0 deletions v0/flatten_test.go
Expand Up @@ -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)...)

Expand Down