Skip to content

Commit 7fb93fe

Browse files
authored
Merge branch 'go-gitea:main' into main
2 parents 5ad8708 + 3778538 commit 7fb93fe

File tree

227 files changed

+3671
-6415
lines changed

Some content is hidden

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

227 files changed

+3671
-6415
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"version": "lts"
88
},
99
"ghcr.io/devcontainers/features/git-lfs:1.2.2": {},
10-
"ghcr.io/devcontainers-extra/features/poetry:2": {},
10+
"ghcr.io/jsburckhardt/devcontainer-features/uv:1": {},
1111
"ghcr.io/devcontainers/features/python:1": {
1212
"version": "3.12"
1313
},

.github/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ modifies/dependencies:
6161
- "package.json"
6262
- "package-lock.json"
6363
- "pyproject.toml"
64-
- "poetry.lock"
64+
- "uv.lock"
6565
- "go.mod"
6666
- "go.sum"
6767

.github/workflows/files-changed.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
- "tools/lint-templates-*.js"
7878
- "templates/**/*.tmpl"
7979
- "pyproject.toml"
80-
- "poetry.lock"
80+
- "uv.lock"
8181
8282
docker:
8383
- "Dockerfile"
@@ -98,4 +98,3 @@ jobs:
9898
- "**/*.yaml"
9999
- ".yamllint.yaml"
100100
- "pyproject.toml"
101-
- "poetry.lock"

.github/workflows/pull-compliance.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,13 @@ jobs:
3232
runs-on: ubuntu-latest
3333
steps:
3434
- uses: actions/checkout@v4
35-
- uses: actions/setup-python@v5
36-
with:
37-
python-version: "3.12"
35+
- uses: astral-sh/setup-uv@v6
36+
- run: uv python install 3.12
3837
- uses: actions/setup-node@v4
3938
with:
4039
node-version: 24
4140
cache: npm
4241
cache-dependency-path: package-lock.json
43-
- run: pip install poetry
4442
- run: make deps-py
4543
- run: make deps-frontend
4644
- run: make lint-templates
@@ -51,10 +49,8 @@ jobs:
5149
runs-on: ubuntu-latest
5250
steps:
5351
- uses: actions/checkout@v4
54-
- uses: actions/setup-python@v5
55-
with:
56-
python-version: "3.12"
57-
- run: pip install poetry
52+
- uses: astral-sh/setup-uv@v6
53+
- run: uv python install 3.12
5854
- run: make deps-py
5955
- run: make lint-yaml
6056

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -393,11 +393,11 @@ lint-actions: ## lint action workflow files
393393
.PHONY: lint-templates
394394
lint-templates: .venv node_modules ## lint template files
395395
@node tools/lint-templates-svg.js
396-
@poetry run djlint $(shell find templates -type f -iname '*.tmpl')
396+
@uv run --frozen djlint $(shell find templates -type f -iname '*.tmpl')
397397

398398
.PHONY: lint-yaml
399399
lint-yaml: .venv ## lint yaml files
400-
@poetry run yamllint -s .
400+
@uv run --frozen yamllint -s .
401401

402402
.PHONY: watch
403403
watch: ## watch everything and continuously rebuild
@@ -829,8 +829,8 @@ node_modules: package-lock.json
829829
npm install --no-save
830830
@touch node_modules
831831

832-
.venv: poetry.lock
833-
poetry install
832+
.venv: uv.lock
833+
uv sync
834834
@touch .venv
835835

836836
.PHONY: update
@@ -848,8 +848,8 @@ update-js: node-check | node_modules ## update js dependencies
848848
.PHONY: update-py
849849
update-py: node-check | node_modules ## update py dependencies
850850
npx updates -u -f pyproject.toml
851-
rm -rf .venv poetry.lock
852-
poetry install
851+
rm -rf .venv uv.lock
852+
uv sync
853853
@touch .venv
854854

855855
.PHONY: webpack

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
# linting
2828
python312
29-
poetry
29+
uv
3030

3131
# backend
3232
go_1_24

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ require (
131131
mvdan.cc/xurls/v2 v2.6.0
132132
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
133133
xorm.io/builder v0.3.13
134-
xorm.io/xorm v1.3.9
134+
xorm.io/xorm v1.3.10
135135
)
136136

137137
require (

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -955,5 +955,5 @@ strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251 h1:mUcz5b3
955955
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251/go.mod h1:FJGmPh3vz9jSos1L/F91iAgnC/aejc0wIIrF2ZwJxdY=
956956
xorm.io/builder v0.3.13 h1:a3jmiVVL19psGeXx8GIurTp7p0IIgqeDmwhcR6BAOAo=
957957
xorm.io/builder v0.3.13/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE=
958-
xorm.io/xorm v1.3.9 h1:TUovzS0ko+IQ1XnNLfs5dqK1cJl1H5uHpWbWqAQ04nU=
959-
xorm.io/xorm v1.3.9/go.mod h1:LsCCffeeYp63ssk0pKumP6l96WZcHix7ChpurcLNuMw=
958+
xorm.io/xorm v1.3.10 h1:yR83hTT4mKIPyA/lvWFTzS35xjLwkiYnwdw0Qupeh0o=
959+
xorm.io/xorm v1.3.10/go.mod h1:Lo7hmsFF0F0GbDE7ubX5ZKa+eCf0eCuiJAUG3oI5cxQ=

models/actions/run.go

Lines changed: 55 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -282,77 +282,72 @@ func CancelPreviousJobs(ctx context.Context, repoID int64, ref, workflowID strin
282282
// InsertRun inserts a run
283283
// The title will be cut off at 255 characters if it's longer than 255 characters.
284284
func InsertRun(ctx context.Context, run *ActionRun, jobs []*jobparser.SingleWorkflow) error {
285-
ctx, committer, err := db.TxContext(ctx)
286-
if err != nil {
287-
return err
288-
}
289-
defer committer.Close()
290-
291-
index, err := db.GetNextResourceIndex(ctx, "action_run_index", run.RepoID)
292-
if err != nil {
293-
return err
294-
}
295-
run.Index = index
296-
run.Title = util.EllipsisDisplayString(run.Title, 255)
297-
298-
if err := db.Insert(ctx, run); err != nil {
299-
return err
300-
}
301-
302-
if run.Repo == nil {
303-
repo, err := repo_model.GetRepositoryByID(ctx, run.RepoID)
285+
return db.WithTx(ctx, func(ctx context.Context) error {
286+
index, err := db.GetNextResourceIndex(ctx, "action_run_index", run.RepoID)
304287
if err != nil {
305288
return err
306289
}
307-
run.Repo = repo
308-
}
290+
run.Index = index
291+
run.Title = util.EllipsisDisplayString(run.Title, 255)
309292

310-
if err := updateRepoRunsNumbers(ctx, run.Repo); err != nil {
311-
return err
312-
}
313-
314-
runJobs := make([]*ActionRunJob, 0, len(jobs))
315-
var hasWaiting bool
316-
for _, v := range jobs {
317-
id, job := v.Job()
318-
needs := job.Needs()
319-
if err := v.SetJob(id, job.EraseNeeds()); err != nil {
293+
if err := db.Insert(ctx, run); err != nil {
320294
return err
321295
}
322-
payload, _ := v.Marshal()
323-
status := StatusWaiting
324-
if len(needs) > 0 || run.NeedApproval {
325-
status = StatusBlocked
326-
} else {
327-
hasWaiting = true
296+
297+
if run.Repo == nil {
298+
repo, err := repo_model.GetRepositoryByID(ctx, run.RepoID)
299+
if err != nil {
300+
return err
301+
}
302+
run.Repo = repo
328303
}
329-
job.Name = util.EllipsisDisplayString(job.Name, 255)
330-
runJobs = append(runJobs, &ActionRunJob{
331-
RunID: run.ID,
332-
RepoID: run.RepoID,
333-
OwnerID: run.OwnerID,
334-
CommitSHA: run.CommitSHA,
335-
IsForkPullRequest: run.IsForkPullRequest,
336-
Name: job.Name,
337-
WorkflowPayload: payload,
338-
JobID: id,
339-
Needs: needs,
340-
RunsOn: job.RunsOn(),
341-
Status: status,
342-
})
343-
}
344-
if err := db.Insert(ctx, runJobs); err != nil {
345-
return err
346-
}
347304

348-
// if there is a job in the waiting status, increase tasks version.
349-
if hasWaiting {
350-
if err := IncreaseTaskVersion(ctx, run.OwnerID, run.RepoID); err != nil {
305+
if err := updateRepoRunsNumbers(ctx, run.Repo); err != nil {
351306
return err
352307
}
353-
}
354308

355-
return committer.Commit()
309+
runJobs := make([]*ActionRunJob, 0, len(jobs))
310+
var hasWaiting bool
311+
for _, v := range jobs {
312+
id, job := v.Job()
313+
needs := job.Needs()
314+
if err := v.SetJob(id, job.EraseNeeds()); err != nil {
315+
return err
316+
}
317+
payload, _ := v.Marshal()
318+
status := StatusWaiting
319+
if len(needs) > 0 || run.NeedApproval {
320+
status = StatusBlocked
321+
} else {
322+
hasWaiting = true
323+
}
324+
job.Name = util.EllipsisDisplayString(job.Name, 255)
325+
runJobs = append(runJobs, &ActionRunJob{
326+
RunID: run.ID,
327+
RepoID: run.RepoID,
328+
OwnerID: run.OwnerID,
329+
CommitSHA: run.CommitSHA,
330+
IsForkPullRequest: run.IsForkPullRequest,
331+
Name: job.Name,
332+
WorkflowPayload: payload,
333+
JobID: id,
334+
Needs: needs,
335+
RunsOn: job.RunsOn(),
336+
Status: status,
337+
})
338+
}
339+
if err := db.Insert(ctx, runJobs); err != nil {
340+
return err
341+
}
342+
343+
// if there is a job in the waiting status, increase tasks version.
344+
if hasWaiting {
345+
if err := IncreaseTaskVersion(ctx, run.OwnerID, run.RepoID); err != nil {
346+
return err
347+
}
348+
}
349+
return nil
350+
})
356351
}
357352

358353
func GetRunByRepoAndID(ctx context.Context, repoID, runID int64) (*ActionRun, error) {

0 commit comments

Comments
 (0)