Skip to content

Commit

Permalink
ci: bump Sage
Browse files Browse the repository at this point in the history
  • Loading branch information
odsod committed Apr 2, 2024
1 parent 7a736ae commit df9746b
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .sage/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module sage

go 1.19

require go.einride.tech/sage v0.272.0
require go.einride.tech/sage v0.278.0
4 changes: 2 additions & 2 deletions .sage/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
go.einride.tech/sage v0.272.0 h1:NxK2zVtsYJn9Wwp//Tz5gmQsiVwT0uXLkau5WJnnXR8=
go.einride.tech/sage v0.272.0/go.mod h1:EzV5uciFX7/2ho8EKB5K9JghOfXIxlzs694b+Tkl5GQ=
go.einride.tech/sage v0.278.0 h1:I3J2eM/5dIo6YYuozGE2hTNEjJpIaM/jESOY7tlfwZo=
go.einride.tech/sage v0.278.0/go.mod h1:EzV5uciFX7/2ho8EKB5K9JghOfXIxlzs694b+Tkl5GQ=
15 changes: 10 additions & 5 deletions .sage/sagefile.go → .sage/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"go.einride.tech/sage/tools/sggit"
"go.einride.tech/sage/tools/sggo"
"go.einride.tech/sage/tools/sggolangcilint"
"go.einride.tech/sage/tools/sggoreview"
"go.einride.tech/sage/tools/sggolines"
"go.einride.tech/sage/tools/sgmdformat"
"go.einride.tech/sage/tools/sgyamlfmt"
)
Expand All @@ -30,7 +30,7 @@ func main() {

func All(ctx context.Context) error {
sg.Deps(ctx, ConvcoCheck, FormatMarkdown, FormatYAML, GoGenerate, Proto.All)
sg.Deps(ctx, GoLint, GoReview, GoTest)
sg.Deps(ctx, GoLint, GoTest)
sg.SerialDeps(ctx, GoModTidy, GitVerifyNoDiff)
return nil
}
Expand All @@ -55,9 +55,14 @@ func GoLint(ctx context.Context) error {
return sggolangcilint.Run(ctx)
}

func GoReview(ctx context.Context) error {
sg.Logger(ctx).Println("reviewing Go files...")
return sggoreview.Command(ctx, "-c", "1", "./...").Run()
func GoLintFix(ctx context.Context) error {
sg.Logger(ctx).Println("fixing Go files...")
return sggolangcilint.Fix(ctx)
}

func GoLines(ctx context.Context) error {
sg.Logger(ctx).Println("wrapping Go lines...")
return sggolines.Run(ctx)
}

func GoModTidy(ctx context.Context) error {
Expand Down
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,22 @@ git-verify-no-diff: $(sagefile)
go-generate: $(sagefile)
@$(sagefile) GoGenerate

.PHONY: go-lines
go-lines: $(sagefile)
@$(sagefile) GoLines

.PHONY: go-lint
go-lint: $(sagefile)
@$(sagefile) GoLint

.PHONY: go-lint-fix
go-lint-fix: $(sagefile)
@$(sagefile) GoLintFix

.PHONY: go-mod-tidy
go-mod-tidy: $(sagefile)
@$(sagefile) GoModTidy

.PHONY: go-review
go-review: $(sagefile)
@$(sagefile) GoReview

.PHONY: go-test
go-test: $(sagefile)
@$(sagefile) GoTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,21 @@ func TestShelvesBookResourceName(t *testing.T) {
t.Run("bad top-level", func(t *testing.T) {
var name ShelvesBookResourceName
err := name.UnmarshalString("books/book")
assert.Error(t, err, "parse resource name 'books/book' with pattern 'shelves/{shelf}/books/{book}': segment shelves: got books")
assert.Error(
t,
err,
"parse resource name 'books/book' with pattern 'shelves/{shelf}/books/{book}': segment shelves: got books",
)
})

t.Run("bad wrong parent", func(t *testing.T) {
var name ShelvesBookResourceName
err := name.UnmarshalString("others/other/books/book")
assert.Error(t, err, "parse resource name 'others/other/books/book' with pattern 'shelves/{shelf}/books/{book}': segment shelves: got others")
assert.Error(
t,
err,
"parse resource name 'others/other/books/book' with pattern 'shelves/{shelf}/books/{book}': segment shelves: got others",
)
})
}

Expand All @@ -87,13 +95,21 @@ func TestPublishersBookResourceName(t *testing.T) {
t.Run("bad top-level", func(t *testing.T) {
var name PublishersBookResourceName
err := name.UnmarshalString("books/book")
assert.Error(t, err, "parse resource name 'books/book' with pattern 'publishers/{publisher}/books/{book}': segment publishers: got books")
assert.Error(
t,
err,
"parse resource name 'books/book' with pattern 'publishers/{publisher}/books/{book}': segment publishers: got books",
)
})

t.Run("bad wrong parent", func(t *testing.T) {
var name PublishersBookResourceName
err := name.UnmarshalString("others/other/books/book")
assert.Error(t, err, "parse resource name 'others/other/books/book' with pattern 'publishers/{publisher}/books/{book}': segment publishers: got others")
assert.Error(
t,
err,
"parse resource name 'others/other/books/book' with pattern 'publishers/{publisher}/books/{book}': segment publishers: got others",
)
})
}

Expand Down Expand Up @@ -148,7 +164,11 @@ func TestShelfResourceName(t *testing.T) {
t.Run("bad wrong parent", func(t *testing.T) {
var name ShelfResourceName
err := name.UnmarshalString("others/other/shelves/shelf")
assert.Error(t, err, "parse resource name 'others/other/shelves/shelf' with pattern 'shelves/{shelf}': segment shelves: got others")
assert.Error(
t,
err,
"parse resource name 'others/other/shelves/shelf' with pattern 'shelves/{shelf}': segment shelves: got others",
)
})
}

Expand All @@ -173,13 +193,21 @@ func TestLibrariesShelfResourceName(t *testing.T) {
t.Run("bad top-level", func(t *testing.T) {
var name LibrariesShelfResourceName
err := name.UnmarshalString("books/book")
assert.Error(t, err, "parse resource name 'books/book' with pattern 'libraries/{library}/shelves/{shelf}': segment libraries: got books")
assert.Error(
t,
err,
"parse resource name 'books/book' with pattern 'libraries/{library}/shelves/{shelf}': segment libraries: got books",
)
})

t.Run("bad wrong parent", func(t *testing.T) {
var name LibrariesShelfResourceName
err := name.UnmarshalString("others/other/shelves/shelf")
assert.Error(t, err, "parse resource name 'others/other/shelves/shelf' with pattern 'libraries/{library}/shelves/{shelf}': segment libraries: got others")
assert.Error(
t,
err,
"parse resource name 'others/other/shelves/shelf' with pattern 'libraries/{library}/shelves/{shelf}': segment libraries: got others",
)
})
}

Expand All @@ -204,12 +232,20 @@ func TestRoomsShelfResourceName(t *testing.T) {
t.Run("bad top-level", func(t *testing.T) {
var name RoomsShelfResourceName
err := name.UnmarshalString("books/book")
assert.Error(t, err, "parse resource name 'books/book' with pattern 'rooms/{room}/shelves/{shelf}': segment rooms: got books")
assert.Error(
t,
err,
"parse resource name 'books/book' with pattern 'rooms/{room}/shelves/{shelf}': segment rooms: got books",
)
})

t.Run("bad wrong parent", func(t *testing.T) {
var name RoomsShelfResourceName
err := name.UnmarshalString("others/other/shelves/shelf")
assert.Error(t, err, "parse resource name 'others/other/shelves/shelf' with pattern 'rooms/{room}/shelves/{shelf}': segment rooms: got others")
assert.Error(
t,
err,
"parse resource name 'others/other/shelves/shelf' with pattern 'rooms/{room}/shelves/{shelf}': segment rooms: got others",
)
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,31 @@ func TestBookResourceName(t *testing.T) {
t.Run("bad top-level", func(t *testing.T) {
var name BookResourceName
err := name.UnmarshalString("books/book")
assert.Error(t, err, "parse resource name 'books/book' with pattern 'shelves/{shelf}/books/{book}': segment shelves: got books")
assert.Error(
t,
err,
"parse resource name 'books/book' with pattern 'shelves/{shelf}/books/{book}': segment shelves: got books",
)
})

t.Run("bad wrong parent", func(t *testing.T) {
var name BookResourceName
err := name.UnmarshalString("others/other/books/book")
assert.Error(t, err, "parse resource name 'others/other/books/book' with pattern 'shelves/{shelf}/books/{book}': segment shelves: got others")
assert.Error(
t,
err,
"parse resource name 'others/other/books/book' with pattern 'shelves/{shelf}/books/{book}': segment shelves: got others",
)
})

t.Run("bad newer parent", func(t *testing.T) {
var name BookResourceName
err := name.UnmarshalString("publishers/publisher/books/book")
assert.Error(t, err, "parse resource name 'publishers/publisher/books/book' with pattern 'shelves/{shelf}/books/{book}': segment shelves: got publishers")
assert.Error(
t,
err,
"parse resource name 'publishers/publisher/books/book' with pattern 'shelves/{shelf}/books/{book}': segment shelves: got publishers",
)
})
}

Expand All @@ -93,13 +105,21 @@ func TestShelvesBookResourceName(t *testing.T) {
t.Run("bad top-level", func(t *testing.T) {
var name ShelvesBookResourceName
err := name.UnmarshalString("books/book")
assert.Error(t, err, "parse resource name 'books/book' with pattern 'shelves/{shelf}/books/{book}': segment shelves: got books")
assert.Error(
t,
err,
"parse resource name 'books/book' with pattern 'shelves/{shelf}/books/{book}': segment shelves: got books",
)
})

t.Run("bad wrong parent", func(t *testing.T) {
var name ShelvesBookResourceName
err := name.UnmarshalString("others/other/books/book")
assert.Error(t, err, "parse resource name 'others/other/books/book' with pattern 'shelves/{shelf}/books/{book}': segment shelves: got others")
assert.Error(
t,
err,
"parse resource name 'others/other/books/book' with pattern 'shelves/{shelf}/books/{book}': segment shelves: got others",
)
})
}

Expand All @@ -124,13 +144,21 @@ func TestPublishersBookResourceName(t *testing.T) {
t.Run("bad top-level", func(t *testing.T) {
var name PublishersBookResourceName
err := name.UnmarshalString("books/book")
assert.Error(t, err, "parse resource name 'books/book' with pattern 'publishers/{publisher}/books/{book}': segment publishers: got books")
assert.Error(
t,
err,
"parse resource name 'books/book' with pattern 'publishers/{publisher}/books/{book}': segment publishers: got books",
)
})

t.Run("bad wrong parent", func(t *testing.T) {
var name PublishersBookResourceName
err := name.UnmarshalString("others/other/books/book")
assert.Error(t, err, "parse resource name 'others/other/books/book' with pattern 'publishers/{publisher}/books/{book}': segment publishers: got others")
assert.Error(
t,
err,
"parse resource name 'others/other/books/book' with pattern 'publishers/{publisher}/books/{book}': segment publishers: got others",
)
})
}

Expand All @@ -157,7 +185,11 @@ func TestShelfResourceName(t *testing.T) {
t.Run("bad wrong parent", func(t *testing.T) {
var name ShelfResourceName
err := name.UnmarshalString("others/other/shelves/shelf")
assert.Error(t, err, "parse resource name 'others/other/shelves/shelf' with pattern 'shelves/{shelf}': segment shelves: got others")
assert.Error(
t,
err,
"parse resource name 'others/other/shelves/shelf' with pattern 'shelves/{shelf}': segment shelves: got others",
)
})
}

Expand All @@ -182,13 +214,21 @@ func TestLibrariesShelfResourceName(t *testing.T) {
t.Run("bad top-level", func(t *testing.T) {
var name LibrariesShelfResourceName
err := name.UnmarshalString("books/book")
assert.Error(t, err, "parse resource name 'books/book' with pattern 'libraries/{library}/shelves/{shelf}': segment libraries: got books")
assert.Error(
t,
err,
"parse resource name 'books/book' with pattern 'libraries/{library}/shelves/{shelf}': segment libraries: got books",
)
})

t.Run("bad wrong parent", func(t *testing.T) {
var name LibrariesShelfResourceName
err := name.UnmarshalString("others/other/shelves/shelf")
assert.Error(t, err, "parse resource name 'others/other/shelves/shelf' with pattern 'libraries/{library}/shelves/{shelf}': segment libraries: got others")
assert.Error(
t,
err,
"parse resource name 'others/other/shelves/shelf' with pattern 'libraries/{library}/shelves/{shelf}': segment libraries: got others",
)
})
}

Expand All @@ -213,12 +253,20 @@ func TestRoomsShelfResourceName(t *testing.T) {
t.Run("bad top-level", func(t *testing.T) {
var name RoomsShelfResourceName
err := name.UnmarshalString("books/book")
assert.Error(t, err, "parse resource name 'books/book' with pattern 'rooms/{room}/shelves/{shelf}': segment rooms: got books")
assert.Error(
t,
err,
"parse resource name 'books/book' with pattern 'rooms/{room}/shelves/{shelf}': segment rooms: got books",
)
})

t.Run("bad wrong parent", func(t *testing.T) {
var name RoomsShelfResourceName
err := name.UnmarshalString("others/other/shelves/shelf")
assert.Error(t, err, "parse resource name 'others/other/shelves/shelf' with pattern 'rooms/{room}/shelves/{shelf}': segment rooms: got others")
assert.Error(
t,
err,
"parse resource name 'others/other/shelves/shelf' with pattern 'rooms/{room}/shelves/{shelf}': segment rooms: got others",
)
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,21 @@ func TestBookResourceName(t *testing.T) {
t.Run("bad top-level", func(t *testing.T) {
var name BookResourceName
err := name.UnmarshalString("books/book")
assert.Error(t, err, "parse resource name 'books/book' with pattern 'shelves/{shelf}/books/{book}': segment shelves: got books")
assert.Error(
t,
err,
"parse resource name 'books/book' with pattern 'shelves/{shelf}/books/{book}': segment shelves: got books",
)
})

t.Run("bad wrong parent", func(t *testing.T) {
var name BookResourceName
err := name.UnmarshalString("others/other/books/book")
assert.Error(t, err, "parse resource name 'others/other/books/book' with pattern 'shelves/{shelf}/books/{book}': segment shelves: got others")
assert.Error(
t,
err,
"parse resource name 'others/other/books/book' with pattern 'shelves/{shelf}/books/{book}': segment shelves: got others",
)
})
}

Expand All @@ -61,6 +69,10 @@ func TestShelfResourceName(t *testing.T) {
t.Run("bad wrong parent", func(t *testing.T) {
var name ShelfResourceName
err := name.UnmarshalString("others/other/shelves/shelf")
assert.Error(t, err, "parse resource name 'others/other/shelves/shelf' with pattern 'shelves/{shelf}': segment shelves: got others")
assert.Error(
t,
err,
"parse resource name 'others/other/shelves/shelf' with pattern 'shelves/{shelf}': segment shelves: got others",
)
})
}

0 comments on commit df9746b

Please sign in to comment.