Commit 5e4d086af7
5e4d086af731f28762c5622bfb9c61e032206328
parent: 23159cdf3a
Verified · cmc ci/build: success ci/lint: failure ci/test: success
cmc <hello@cleberg.net> · 2026-09-11 02:23 UTC
Add gitbay CI: build, test, lint
Three jobs in .gitbay/ci.yml on the runner's default image. Lint pins
golangci-lint v2.13.2 through go run. The tree's five existing lint
findings are fixed here so the first lint build is green.
Closes #7
Layout: unified · split
.gitbay/ci.yml
added
+19
| @@ -0,0 +1,19 @@ |
| 1 | # gitbay CI. One build per push per job; each step runs with `sh -c` and the |
| 2 | # job stops at the first failure. The image is the runner's default, named |
| 3 | # here so a bump is a deliberate change. |
| 4 | jobs: |
| 5 | build: |
| 6 | image: localhost/gitbay-ci:2 |
| 7 | steps: |
| 8 | - go build ./... |
| 9 | - go vet ./... |
| 10 | test: |
| 11 | image: localhost/gitbay-ci:2 |
| 12 | steps: |
| 13 | - go test ./... -count=1 -race -timeout 10m |
| 14 | # Pinned, and run through `go run` so the image needs no linter of its own. |
| 15 | # The first run on a runner compiles it; later runs hit the module cache. |
| 16 | lint: |
| 17 | image: localhost/gitbay-ci:2 |
| 18 | steps: |
| 19 | - go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.13.2 run ./... |
app/i18n.go
+1 −1
| @@ -87,7 +87,7 @@ func ResolveLang(acceptLanguage string) string { |
| 87 | 87 | return DefaultLang |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | | for _, part := range strings.Split(acceptLanguage, ",") { |
| 90 | for part := range strings.SplitSeq(acceptLanguage, ",") { |
| 91 | 91 | tag := strings.TrimSpace(part) |
| 92 | 92 | if i := strings.Index(tag, ";"); i >= 0 { |
| 93 | 93 | tag = tag[:i] |
app/i18n_test.go
+1 −1
| @@ -27,7 +27,7 @@ func TestEnglishCatalogueCoversEveryKeyTheTemplatesUse(t *testing.T) { |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | for _, f := range files { |
| 30 | | src, err := os.ReadFile(f) |
| 30 | src, err := os.ReadFile(f) //nolint:gosec // G304: the test reads the repository's own template files |
| 31 | 31 | if err != nil { |
| 32 | 32 | t.Fatalf("read %s: %v", f, err) |
| 33 | 33 | } |
app/parsers.go
+3 −3
| @@ -79,9 +79,6 @@ func (s skunkyart) ParseComments(c devianter.Comments, daError devianter.Error) |
| 79 | 79 | return cmmts.String() |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | | // DeviationList renders devs as an HTML grid, or as an Atom feed when the |
| 83 | | // request asked for one and allowAtom permits it. NSFW entries are dropped |
| 84 | | // unless the instance allows them. Passing content adds a navigation bar. |
| 85 | 82 | // VisibleDeviation reports whether a deviation may be shown by this instance. |
| 86 | 83 | // |
| 87 | 84 | // Both the HTML listing and the JSON API ask this, deliberately: an API that |
| @@ -95,6 +92,9 @@ func VisibleDeviation(d *devianter.Deviation) bool { |
| 95 | 92 | return !d.NSFW || CFG.Nsfw |
| 96 | 93 | } |
| 97 | 94 | |
| 95 | // DeviationList renders devs as an HTML grid, or as an Atom feed when the |
| 96 | // request asked for one and allowAtom permits it. NSFW entries are dropped |
| 97 | // unless the instance allows them. Passing content adds a navigation bar. |
| 98 | 98 | func (s skunkyart) DeviationList(devs []devianter.Deviation, allowAtom bool, content ...DeviationList) string { |
| 99 | 99 | if s.Atom && s.Page > 1 { |
| 100 | 100 | s.ReturnHTTPError(400) |
app/util.go
+1 −4
| @@ -393,10 +393,7 @@ func (s skunkyart) NavBase(c DeviationList) string { |
| 393 | 393 | // i reached 1, so page one rendered no numbers at all. With nothing before it |
| 394 | 394 | // to link back to and no further page to link on, the whole panel came out as |
| 395 | 395 | // a bare <br>. |
| 396 | | last := c.Pages |
| 397 | | if p > last { |
| 398 | | last = p |
| 399 | | } |
| 396 | last := max(c.Pages, p) |
| 400 | 397 | |
| 401 | 398 | for i, x := p-6, 0; (i <= last && i <= p+6) && x < 12; i++ { |
| 402 | 399 | if i > 0 { |