Skip to content

Commit 06de3f4

Browse files
authored
chore(deps): updated go, alpine, frontend/webapp and golangci lint (#1063)
* deps: go 1.24 & alpine 3.21 * deps: update * fix: golangci-lint config * ci: fix golangci-lint version * ci: upgraded golangci-lint-action to v8.0.0 * deps: pin go into 1.24.3 * fix: updated openbsd test version to 7.7 * ci: updated cross-platform-actions * ci: updated cross-platform-action to latest master * ci: force openbsd to update quirks to 7.7 * ci: revert quirks change * fix: freebsd downloads golang directly * merge master * chore: checking the go binary * chore: give executable permissions * chore: freebsd -> openbsd * deps: updated webapp deps * deps: updated frontend deps * deps: updated go deps * ci: updated openbsd golang version * deps: updated alpine to 3.22 * deps: updated golangci-lint * deps: pinned swag to 1.16.4 * ci: ignore openbsd failures * test(e2e): enhance container log handling and cleanup * test(e2e): disable ryiuk
1 parent da56f82 commit 06de3f4

File tree

13 files changed

+2061
-1276
lines changed

13 files changed

+2061
-1276
lines changed

.github/workflows/_golangci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: golangci-lint
1414
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # 8.0.0
1515
with:
16-
version: "v2.1.6"
16+
version: "v2.5.0"
1717

1818
# Optional: working directory, useful for monorepos
1919
# working-directory: somedir

.github/workflows/_test.yml

Lines changed: 60 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
options: >-
2222
--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
2323
ports:
24-
- 5432:5432
24+
- 5432:5432
2525
mariadb:
2626
image: mariadb:10.5.27
2727
env:
@@ -32,7 +32,7 @@ jobs:
3232
options: >-
3333
--health-cmd="/usr/local/bin/healthcheck.sh --connect" --health-interval 10s --health-timeout 5s --health-retries 5
3434
ports:
35-
- 3306:3306
35+
- 3306:3306
3636
mysql:
3737
image: mysql:8.0.40
3838
env:
@@ -46,43 +46,43 @@ jobs:
4646
--health-timeout=5s
4747
--health-retries=3
4848
ports:
49-
- 3307:3306
49+
- 3307:3306
5050

5151
name: Go unit tests (ubuntu-latest)
5252
steps:
53-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
54-
55-
- name: Setup go
56-
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
57-
with:
58-
go-version-file: ./go.mod
59-
60-
- name: Set up gotestfmt
61-
uses: gotesttools/gotestfmt-action@8b4478c7019be847373babde9300210e7de34bfb # v2.2.0
62-
63-
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3
64-
with:
65-
path: |
66-
~/.cache/go-build
67-
~/go/pkg
68-
key: golangci-lint.cache-{platform-arch}-{interval_number}-{go.mod_hash}
69-
restore-keys: |
70-
golangci-lint.cache-{interval_number}-
71-
golangci-lint.cache-
72-
73-
- run: make unittest
74-
env:
75-
SHIORI_TEST_PG_URL: "postgres://shiori:shiori@localhost:5432/shiori?sslmode=disable"
76-
SHIORI_TEST_MYSQL_URL: "shiori:shiori@(localhost:3306)/shiori"
77-
SHIORI_TEST_MARIADB_URL: "shiori:shiori@(localhost:3307)/shiori"
78-
CGO_ENABLED: 1 # go test -race requires cgo
79-
80-
- run: go build -tags osusergo,netgo -ldflags="-s -w -X main.version=$(git describe --tags) -X main.date=$(date --iso-8601=seconds)"
81-
82-
- name: Upload coverage reports to Codecov
83-
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # 5.4.3
84-
env:
85-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
53+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
54+
55+
- name: Setup go
56+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
57+
with:
58+
go-version-file: ./go.mod
59+
60+
- name: Set up gotestfmt
61+
uses: gotesttools/gotestfmt-action@8b4478c7019be847373babde9300210e7de34bfb # v2.2.0
62+
63+
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3
64+
with:
65+
path: |
66+
~/.cache/go-build
67+
~/go/pkg
68+
key: golangci-lint.cache-{platform-arch}-{interval_number}-{go.mod_hash}
69+
restore-keys: |
70+
golangci-lint.cache-{interval_number}-
71+
golangci-lint.cache-
72+
73+
- run: make unittest
74+
env:
75+
SHIORI_TEST_PG_URL: "postgres://shiori:shiori@localhost:5432/shiori?sslmode=disable"
76+
SHIORI_TEST_MYSQL_URL: "shiori:shiori@(localhost:3306)/shiori"
77+
SHIORI_TEST_MARIADB_URL: "shiori:shiori@(localhost:3307)/shiori"
78+
CGO_ENABLED: 1 # go test -race requires cgo
79+
80+
- run: go build -tags osusergo,netgo -ldflags="-s -w -X main.version=$(git describe --tags) -X main.date=$(date --iso-8601=seconds)"
81+
82+
- name: Upload coverage reports to Codecov
83+
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # 5.4.3
84+
env:
85+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
8686

8787
test-windows-macos:
8888
strategy:
@@ -91,41 +91,41 @@ jobs:
9191
runs-on: ${{ matrix.os }}
9292
name: Go unit tests (${{ matrix.os }})
9393
steps:
94-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
95-
96-
- name: Setup go
97-
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
98-
with:
99-
go-version-file: ./go.mod
94+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
10095

101-
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3
102-
with:
103-
path: |
104-
~/.cache/go-build
105-
~/go/pkg
106-
key: golangci-lint.cache-{platform-arch}-{interval_number}-{go.mod_hash}
107-
restore-keys: |
108-
golangci-lint.cache-{interval_number}-
109-
golangci-lint.cache-
96+
- name: Setup go
97+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
98+
with:
99+
go-version-file: ./go.mod
110100

111-
- run: make unittest GO_TEST_FLAGS="-tags test_sqlite_only -race -v -count=1"
112-
env:
113-
CGO_ENABLED: 1 # go test -race requires cgo
101+
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3
102+
with:
103+
path: |
104+
~/.cache/go-build
105+
~/go/pkg
106+
key: golangci-lint.cache-{platform-arch}-{interval_number}-{go.mod_hash}
107+
restore-keys: |
108+
golangci-lint.cache-{interval_number}-
109+
golangci-lint.cache-
110+
111+
- run: make unittest GO_TEST_FLAGS="-tags test_sqlite_only -race -v -count=1"
112+
env:
113+
CGO_ENABLED: 1 # go test -race requires cgo
114114

115-
- run: go build -tags osusergo,netgo -ldflags="-s -w -X main.version=$(git describe --tags) -X main.date=$(date --iso-8601=seconds)"
115+
- run: go build -tags osusergo,netgo -ldflags="-s -w -X main.version=$(git describe --tags) -X main.date=$(date --iso-8601=seconds)"
116116

117117
# Please note BSD support is offered on a best-effort basis, this check is not blocking but for us to be aware of issues.
118118
# This test also does not take into consideration the go version specified in the go.mod file and just uses the
119119
# latest version available in the openbsd package repository.
120120
test-bsd:
121+
continue-on-error: true
121122
runs-on: ubuntu-latest
122123
strategy:
123124
matrix:
124125
os:
125126
- name: openbsd
126127
architecture: x86-64
127-
version: '7.5'
128-
128+
version: "7.7"
129129
steps:
130130
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
131131

@@ -141,5 +141,7 @@ jobs:
141141
cpu_count: 1
142142
run: |
143143
sudo pkg_add -u
144-
sudo pkg_add gmake git go
144+
sudo pkg_add gmake git
145+
curl -L https://go.dev/dl/go1.25.1.openbsd-amd64.tar.gz | sudo tar -C /usr/local -xzf -
146+
export PATH=$PATH:/usr/local/go/bin
145147
gmake unittest GO_TEST_FLAGS="-tags test_sqlite_only -v -count=1"

.golangci.bck.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Docs: https://golangci-lint.run/usage/configuration/#config-file
2+
run:
3+
timeout: 5m
4+
5+
issues:
6+
max-issues-per-linter: 0
7+
max-same-issues: 0
8+
exclude-dirs:
9+
- internal/mocks
10+
11+
linters-settings:
12+
gofmt:
13+
simplify: true
14+
govet:
15+
enable-all: true
16+
disable:
17+
- fieldalignment
18+
19+
linters:
20+
disable-all: true
21+
enable:
22+
- copyloopvar
23+
- gofmt
24+
- gosimple
25+
# - govet # Re-enable when all shadow declarations are fixed
26+
- ineffassign
27+
- predeclared
28+
- staticcheck
29+
- unconvert
30+
- unused

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ LDFLAGS += -s -w -X main.version=$(BUILD_HASH) -X main.date=$(BUILD_TIME)
1616
# Build (container)
1717
CONTAINER_RUNTIME := docker
1818
CONTAINERFILE_NAME := Dockerfile
19-
CONTAINER_ALPINE_VERSION := 3.21
19+
CONTAINER_ALPINE_VERSION := 3.22
2020
BUILDX_PLATFORMS := linux/amd64,linux/arm64,linux/arm/v7
2121

2222
# This is used for local development only, forcing linux to create linux only images but with the arch

bun.lockb

-8 Bytes
Binary file not shown.

e2e/e2eutil/containers.go

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package e2eutil
22

33
import (
44
"context"
5+
"io"
56
"os"
7+
"strings"
68
"testing"
79
"time"
810

@@ -77,11 +79,60 @@ func NewShioriContainer(t *testing.T, tag string) ShioriContainer {
7779
container, err := testcontainers.GenericContainer(context.Background(), containerDefinition)
7880
require.NoError(t, err)
7981
t.Cleanup(func() {
80-
require.NoError(t, container.Terminate(context.Background()))
82+
// Print container logs on test failure for debugging
83+
if t.Failed() {
84+
printContainerLogs(t, container, "Container logs on test failure:")
85+
}
86+
87+
// Terminate container with error handling
88+
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
89+
defer cancel()
90+
if err := container.Terminate(ctx); err != nil {
91+
// Log the error but don't fail the test cleanup
92+
t.Logf("Warning: Failed to terminate container: %v", err)
93+
}
8194
})
8295

8396
return ShioriContainer{
8497
t: t,
8598
Container: container,
8699
}
87100
}
101+
102+
// printContainerLogs prints the container logs for debugging purposes
103+
func printContainerLogs(t *testing.T, container testcontainers.Container, prefix string) {
104+
if container == nil {
105+
t.Logf("%s Container is nil, cannot retrieve logs", prefix)
106+
return
107+
}
108+
109+
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
110+
defer cancel()
111+
112+
logs, err := container.Logs(ctx)
113+
if err != nil {
114+
t.Logf("%s Failed to get container logs: %v", prefix, err)
115+
return
116+
}
117+
defer logs.Close()
118+
119+
logBytes, err := io.ReadAll(logs)
120+
if err != nil {
121+
t.Logf("%s Failed to read container logs: %v", prefix, err)
122+
return
123+
}
124+
125+
if len(logBytes) == 0 {
126+
t.Logf("%s No container logs available", prefix)
127+
return
128+
}
129+
130+
// Split logs into lines and add prefix
131+
logLines := strings.Split(strings.TrimSpace(string(logBytes)), "\n")
132+
t.Logf("%s", prefix)
133+
for i, line := range logLines {
134+
if line != "" {
135+
t.Logf(" [%d] %s", i+1, line)
136+
}
137+
}
138+
}

0 commit comments

Comments
 (0)