Skip to content

Commit f81ec57

Browse files
authored
Merge branch 'main' into lunny/add_migration_and_doctor_fix_repo_runners
2 parents 889082e + 5df9fd3 commit f81ec57

File tree

104 files changed

+5451
-4873
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+5451
-4873
lines changed

.eslintrc.cjs

Lines changed: 60 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const vitestPlugin = require('@vitest/eslint-plugin');
12
const restrictedSyntax = ['WithStatement', 'ForInStatement', 'LabeledStatement', 'SequenceExpression'];
23

34
module.exports = {
@@ -37,15 +38,20 @@ module.exports = {
3738
'eslint-plugin-regexp',
3839
'eslint-plugin-sonarjs',
3940
'eslint-plugin-unicorn',
40-
'eslint-plugin-vitest',
41-
'eslint-plugin-vitest-globals',
4241
'eslint-plugin-wc',
4342
],
4443
env: {
4544
es2024: true,
4645
node: true,
4746
},
4847
overrides: [
48+
{
49+
files: ['**/*.cjs'],
50+
rules: {
51+
'import-x/no-commonjs': [0],
52+
'@typescript-eslint/no-require-imports': [0],
53+
},
54+
},
4955
{
5056
files: ['web_src/**/*'],
5157
globals: {
@@ -82,59 +88,58 @@ module.exports = {
8288
},
8389
{
8490
files: ['**/*.test.*', 'web_src/js/test/setup.ts'],
85-
env: {
86-
'vitest-globals/env': true,
87-
},
91+
plugins: ['@vitest/eslint-plugin'],
92+
globals: vitestPlugin.environments.env.globals,
8893
rules: {
89-
'vitest/consistent-test-filename': [0],
90-
'vitest/consistent-test-it': [0],
91-
'vitest/expect-expect': [0],
92-
'vitest/max-expects': [0],
93-
'vitest/max-nested-describe': [0],
94-
'vitest/no-alias-methods': [0],
95-
'vitest/no-commented-out-tests': [0],
96-
'vitest/no-conditional-expect': [0],
97-
'vitest/no-conditional-in-test': [0],
98-
'vitest/no-conditional-tests': [0],
99-
'vitest/no-disabled-tests': [0],
100-
'vitest/no-done-callback': [0],
101-
'vitest/no-duplicate-hooks': [0],
102-
'vitest/no-focused-tests': [0],
103-
'vitest/no-hooks': [0],
104-
'vitest/no-identical-title': [2],
105-
'vitest/no-interpolation-in-snapshots': [0],
106-
'vitest/no-large-snapshots': [0],
107-
'vitest/no-mocks-import': [0],
108-
'vitest/no-restricted-matchers': [0],
109-
'vitest/no-restricted-vi-methods': [0],
110-
'vitest/no-standalone-expect': [0],
111-
'vitest/no-test-prefixes': [0],
112-
'vitest/no-test-return-statement': [0],
113-
'vitest/prefer-called-with': [0],
114-
'vitest/prefer-comparison-matcher': [0],
115-
'vitest/prefer-each': [0],
116-
'vitest/prefer-equality-matcher': [0],
117-
'vitest/prefer-expect-resolves': [0],
118-
'vitest/prefer-hooks-in-order': [0],
119-
'vitest/prefer-hooks-on-top': [2],
120-
'vitest/prefer-lowercase-title': [0],
121-
'vitest/prefer-mock-promise-shorthand': [0],
122-
'vitest/prefer-snapshot-hint': [0],
123-
'vitest/prefer-spy-on': [0],
124-
'vitest/prefer-strict-equal': [0],
125-
'vitest/prefer-to-be': [0],
126-
'vitest/prefer-to-be-falsy': [0],
127-
'vitest/prefer-to-be-object': [0],
128-
'vitest/prefer-to-be-truthy': [0],
129-
'vitest/prefer-to-contain': [0],
130-
'vitest/prefer-to-have-length': [0],
131-
'vitest/prefer-todo': [0],
132-
'vitest/require-hook': [0],
133-
'vitest/require-to-throw-message': [0],
134-
'vitest/require-top-level-describe': [0],
135-
'vitest/valid-describe-callback': [2],
136-
'vitest/valid-expect': [2],
137-
'vitest/valid-title': [2],
94+
'@vitest/consistent-test-filename': [0],
95+
'@vitest/consistent-test-it': [0],
96+
'@vitest/expect-expect': [0],
97+
'@vitest/max-expects': [0],
98+
'@vitest/max-nested-describe': [0],
99+
'@vitest/no-alias-methods': [0],
100+
'@vitest/no-commented-out-tests': [0],
101+
'@vitest/no-conditional-expect': [0],
102+
'@vitest/no-conditional-in-test': [0],
103+
'@vitest/no-conditional-tests': [0],
104+
'@vitest/no-disabled-tests': [0],
105+
'@vitest/no-done-callback': [0],
106+
'@vitest/no-duplicate-hooks': [0],
107+
'@vitest/no-focused-tests': [0],
108+
'@vitest/no-hooks': [0],
109+
'@vitest/no-identical-title': [2],
110+
'@vitest/no-interpolation-in-snapshots': [0],
111+
'@vitest/no-large-snapshots': [0],
112+
'@vitest/no-mocks-import': [0],
113+
'@vitest/no-restricted-matchers': [0],
114+
'@vitest/no-restricted-vi-methods': [0],
115+
'@vitest/no-standalone-expect': [0],
116+
'@vitest/no-test-prefixes': [0],
117+
'@vitest/no-test-return-statement': [0],
118+
'@vitest/prefer-called-with': [0],
119+
'@vitest/prefer-comparison-matcher': [0],
120+
'@vitest/prefer-each': [0],
121+
'@vitest/prefer-equality-matcher': [0],
122+
'@vitest/prefer-expect-resolves': [0],
123+
'@vitest/prefer-hooks-in-order': [0],
124+
'@vitest/prefer-hooks-on-top': [2],
125+
'@vitest/prefer-lowercase-title': [0],
126+
'@vitest/prefer-mock-promise-shorthand': [0],
127+
'@vitest/prefer-snapshot-hint': [0],
128+
'@vitest/prefer-spy-on': [0],
129+
'@vitest/prefer-strict-equal': [0],
130+
'@vitest/prefer-to-be': [0],
131+
'@vitest/prefer-to-be-falsy': [0],
132+
'@vitest/prefer-to-be-object': [0],
133+
'@vitest/prefer-to-be-truthy': [0],
134+
'@vitest/prefer-to-contain': [0],
135+
'@vitest/prefer-to-have-length': [0],
136+
'@vitest/prefer-todo': [0],
137+
'@vitest/require-hook': [0],
138+
'@vitest/require-to-throw-message': [0],
139+
'@vitest/require-top-level-describe': [0],
140+
'@vitest/valid-describe-callback': [2],
141+
'@vitest/valid-expect': [2],
142+
'@vitest/valid-title': [2],
138143
},
139144
},
140145
{
@@ -163,7 +168,7 @@ module.exports = {
163168
{
164169
files: ['tests/e2e/**'],
165170
plugins: [
166-
'eslint-plugin-playwright'
171+
'eslint-plugin-playwright',
167172
],
168173
extends: [
169174
'plugin:playwright/recommended',

.mailmap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build stage
2-
FROM docker.io/library/golang:1.23-alpine3.21 AS build-env
2+
FROM docker.io/library/golang:1.24-alpine3.21 AS build-env
33

44
ARG GOPROXY
55
ENV GOPROXY=${GOPROXY:-direct}

Dockerfile.rootless

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build stage
2-
FROM docker.io/library/golang:1.23-alpine3.21 AS build-env
2+
FROM docker.io/library/golang:1.24-alpine3.21 AS build-env
33

44
ARG GOPROXY
55
ENV GOPROXY=${GOPROXY:-direct}

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ SHASUM ?= shasum -a 256
2323
HAS_GO := $(shell hash $(GO) > /dev/null 2>&1 && echo yes)
2424
COMMA := ,
2525

26-
XGO_VERSION := go-1.23.x
26+
XGO_VERSION := go-1.24.x
2727

2828
AIR_PACKAGE ?= github.com/air-verse/air@v1
2929
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/[email protected]
@@ -144,7 +144,7 @@ TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(FOMAN
144144
GO_DIRS := build cmd models modules routers services tests
145145
WEB_DIRS := web_src/js web_src/css
146146

147-
ESLINT_FILES := web_src/js tools *.js *.ts tests/e2e
147+
ESLINT_FILES := web_src/js tools *.js *.ts *.cjs tests/e2e
148148
STYLELINT_FILES := web_src/css web_src/js/components/*.vue
149149
SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) templates options/locale/locale_en-US.ini .github $(filter-out CHANGELOG.md, $(wildcard *.go *.js *.md *.yml *.yaml *.toml))
150150
EDITORCONFIG_FILES := templates .github/workflows options/locale/locale_en-US.ini

cmd/migrate_storage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func migrateActionsLog(ctx context.Context, dstStorage storage.ObjectStorage) er
196196

197197
func migrateActionsArtifacts(ctx context.Context, dstStorage storage.ObjectStorage) error {
198198
return db.Iterate(ctx, nil, func(ctx context.Context, artifact *actions_model.ActionArtifact) error {
199-
if artifact.Status == int64(actions_model.ArtifactStatusExpired) {
199+
if artifact.Status == actions_model.ArtifactStatusExpired {
200200
return nil
201201
}
202202

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
poetry
3030

3131
# backend
32-
go_1_23
32+
go_1_24
3333
gofumpt
3434
sqlite
3535
];
3636
shellHook = ''
37-
export GO="${pkgs.go_1_23}/bin/go"
38-
export GOROOT="${pkgs.go_1_23}/share/go"
37+
export GO="${pkgs.go_1_24}/bin/go"
38+
export GOROOT="${pkgs.go_1_24}/share/go"
3939
'';
4040
};
4141
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module code.gitea.io/gitea
22

3-
go 1.23
3+
go 1.24
44

55
// rfc5280 said: "The serial number is an integer assigned by the CA to each certificate."
66
// But some CAs use negative serial number, just relax the check. related:

models/actions/artifact.go

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type ActionArtifact struct {
4848
ContentEncoding string // The content encoding of the artifact
4949
ArtifactPath string `xorm:"index unique(runid_name_path)"` // The path to the artifact when runner uploads it
5050
ArtifactName string `xorm:"index unique(runid_name_path)"` // The name of the artifact when runner uploads it
51-
Status int64 `xorm:"index"` // The status of the artifact, uploading, expired or need-delete
51+
Status ArtifactStatus `xorm:"index"` // The status of the artifact, uploading, expired or need-delete
5252
CreatedUnix timeutil.TimeStamp `xorm:"created"`
5353
UpdatedUnix timeutil.TimeStamp `xorm:"updated index"`
5454
ExpiredUnix timeutil.TimeStamp `xorm:"index"` // The time when the artifact will be expired
@@ -68,7 +68,7 @@ func CreateArtifact(ctx context.Context, t *ActionTask, artifactName, artifactPa
6868
RepoID: t.RepoID,
6969
OwnerID: t.OwnerID,
7070
CommitSHA: t.CommitSHA,
71-
Status: int64(ArtifactStatusUploadPending),
71+
Status: ArtifactStatusUploadPending,
7272
ExpiredUnix: timeutil.TimeStamp(time.Now().Unix() + timeutil.Day*expiredDays),
7373
}
7474
if _, err := db.GetEngine(ctx).Insert(artifact); err != nil {
@@ -108,12 +108,19 @@ func UpdateArtifactByID(ctx context.Context, id int64, art *ActionArtifact) erro
108108

109109
type FindArtifactsOptions struct {
110110
db.ListOptions
111-
RepoID int64
112-
RunID int64
113-
ArtifactName string
114-
Status int
111+
RepoID int64
112+
RunID int64
113+
ArtifactName string
114+
Status int
115+
FinalizedArtifactsV4 bool
116+
}
117+
118+
func (opts FindArtifactsOptions) ToOrders() string {
119+
return "id"
115120
}
116121

122+
var _ db.FindOptionsOrder = (*FindArtifactsOptions)(nil)
123+
117124
func (opts FindArtifactsOptions) ToConds() builder.Cond {
118125
cond := builder.NewCond()
119126
if opts.RepoID > 0 {
@@ -128,11 +135,15 @@ func (opts FindArtifactsOptions) ToConds() builder.Cond {
128135
if opts.Status > 0 {
129136
cond = cond.And(builder.Eq{"status": opts.Status})
130137
}
138+
if opts.FinalizedArtifactsV4 {
139+
cond = cond.And(builder.Eq{"status": ArtifactStatusUploadConfirmed}.Or(builder.Eq{"status": ArtifactStatusExpired}))
140+
cond = cond.And(builder.Eq{"content_encoding": "application/zip"})
141+
}
131142

132143
return cond
133144
}
134145

135-
// ActionArtifactMeta is the meta data of an artifact
146+
// ActionArtifactMeta is the meta-data of an artifact
136147
type ActionArtifactMeta struct {
137148
ArtifactName string
138149
FileSize int64
@@ -166,18 +177,18 @@ func ListPendingDeleteArtifacts(ctx context.Context, limit int) ([]*ActionArtifa
166177

167178
// SetArtifactExpired sets an artifact to expired
168179
func SetArtifactExpired(ctx context.Context, artifactID int64) error {
169-
_, err := db.GetEngine(ctx).Where("id=? AND status = ?", artifactID, ArtifactStatusUploadConfirmed).Cols("status").Update(&ActionArtifact{Status: int64(ArtifactStatusExpired)})
180+
_, err := db.GetEngine(ctx).Where("id=? AND status = ?", artifactID, ArtifactStatusUploadConfirmed).Cols("status").Update(&ActionArtifact{Status: ArtifactStatusExpired})
170181
return err
171182
}
172183

173184
// SetArtifactNeedDelete sets an artifact to need-delete, cron job will delete it
174185
func SetArtifactNeedDelete(ctx context.Context, runID int64, name string) error {
175-
_, err := db.GetEngine(ctx).Where("run_id=? AND artifact_name=? AND status = ?", runID, name, ArtifactStatusUploadConfirmed).Cols("status").Update(&ActionArtifact{Status: int64(ArtifactStatusPendingDeletion)})
186+
_, err := db.GetEngine(ctx).Where("run_id=? AND artifact_name=? AND status = ?", runID, name, ArtifactStatusUploadConfirmed).Cols("status").Update(&ActionArtifact{Status: ArtifactStatusPendingDeletion})
176187
return err
177188
}
178189

179190
// SetArtifactDeleted sets an artifact to deleted
180191
func SetArtifactDeleted(ctx context.Context, artifactID int64) error {
181-
_, err := db.GetEngine(ctx).ID(artifactID).Cols("status").Update(&ActionArtifact{Status: int64(ArtifactStatusDeleted)})
192+
_, err := db.GetEngine(ctx).ID(artifactID).Cols("status").Update(&ActionArtifact{Status: ArtifactStatusDeleted})
182193
return err
183194
}

0 commit comments

Comments
 (0)