Skip to content

Commit ea2bc92

Browse files
authored
Merge branch 'main' into support-actions-concurrency
Signed-off-by: Zettat123 <zettat123@gmail.com>
2 parents 96d6938 + 65cd3f5 commit ea2bc92

File tree

182 files changed

+3173
-3457
lines changed

Some content is hidden

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

182 files changed

+3173
-3457
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

models/actions/run_job.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,10 @@ func AggregateJobStatus(jobs []*ActionRunJob) Status {
194194
return StatusCancelled
195195
case hasRunning:
196196
return StatusRunning
197-
case hasFailure:
198-
return StatusFailure
199197
case hasWaiting:
200198
return StatusWaiting
199+
case hasFailure:
200+
return StatusFailure
201201
case hasBlocked:
202202
return StatusBlocked
203203
default:

models/actions/run_job_status_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func TestAggregateJobStatus(t *testing.T) {
6464
{[]Status{StatusFailure, StatusSuccess}, StatusFailure},
6565
{[]Status{StatusFailure, StatusSkipped}, StatusFailure},
6666
{[]Status{StatusFailure, StatusCancelled}, StatusCancelled},
67-
{[]Status{StatusFailure, StatusWaiting}, StatusFailure},
67+
{[]Status{StatusFailure, StatusWaiting}, StatusWaiting},
6868
{[]Status{StatusFailure, StatusRunning}, StatusRunning},
6969
{[]Status{StatusFailure, StatusBlocked}, StatusFailure},
7070

models/actions/schedule.go

Lines changed: 39 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -56,65 +56,54 @@ func CreateScheduleTask(ctx context.Context, rows []*ActionSchedule) error {
5656
return nil
5757
}
5858

59-
// Begin transaction
60-
ctx, committer, err := db.TxContext(ctx)
61-
if err != nil {
62-
return err
63-
}
64-
defer committer.Close()
65-
66-
// Loop through each schedule row
67-
for _, row := range rows {
68-
row.Title = util.EllipsisDisplayString(row.Title, 255)
69-
// Create new schedule row
70-
if err = db.Insert(ctx, row); err != nil {
71-
return err
72-
}
73-
74-
// Loop through each schedule spec and create a new spec row
75-
now := time.Now()
76-
77-
for _, spec := range row.Specs {
78-
specRow := &ActionScheduleSpec{
79-
RepoID: row.RepoID,
80-
ScheduleID: row.ID,
81-
Spec: spec,
82-
}
83-
// Parse the spec and check for errors
84-
schedule, err := specRow.Parse()
85-
if err != nil {
86-
continue // skip to the next spec if there's an error
59+
return db.WithTx(ctx, func(ctx context.Context) error {
60+
// Loop through each schedule row
61+
for _, row := range rows {
62+
row.Title = util.EllipsisDisplayString(row.Title, 255)
63+
// Create new schedule row
64+
if err := db.Insert(ctx, row); err != nil {
65+
return err
8766
}
8867

89-
specRow.Next = timeutil.TimeStamp(schedule.Next(now).Unix())
90-
91-
// Insert the new schedule spec row
92-
if err = db.Insert(ctx, specRow); err != nil {
93-
return err
68+
// Loop through each schedule spec and create a new spec row
69+
now := time.Now()
70+
71+
for _, spec := range row.Specs {
72+
specRow := &ActionScheduleSpec{
73+
RepoID: row.RepoID,
74+
ScheduleID: row.ID,
75+
Spec: spec,
76+
}
77+
// Parse the spec and check for errors
78+
schedule, err := specRow.Parse()
79+
if err != nil {
80+
continue // skip to the next spec if there's an error
81+
}
82+
83+
specRow.Next = timeutil.TimeStamp(schedule.Next(now).Unix())
84+
85+
// Insert the new schedule spec row
86+
if err = db.Insert(ctx, specRow); err != nil {
87+
return err
88+
}
9489
}
9590
}
96-
}
97-
98-
// Commit transaction
99-
return committer.Commit()
91+
return nil
92+
})
10093
}
10194

10295
func DeleteScheduleTaskByRepo(ctx context.Context, id int64) error {
103-
ctx, committer, err := db.TxContext(ctx)
104-
if err != nil {
105-
return err
106-
}
107-
defer committer.Close()
108-
109-
if _, err := db.GetEngine(ctx).Delete(&ActionSchedule{RepoID: id}); err != nil {
110-
return err
111-
}
96+
return db.WithTx(ctx, func(ctx context.Context) error {
97+
if _, err := db.GetEngine(ctx).Delete(&ActionSchedule{RepoID: id}); err != nil {
98+
return err
99+
}
112100

113-
if _, err := db.GetEngine(ctx).Delete(&ActionScheduleSpec{RepoID: id}); err != nil {
114-
return err
115-
}
101+
if _, err := db.GetEngine(ctx).Delete(&ActionScheduleSpec{RepoID: id}); err != nil {
102+
return err
103+
}
116104

117-
return committer.Commit()
105+
return nil
106+
})
118107
}
119108

120109
func CleanRepoScheduleTasks(ctx context.Context, repo *repo_model.Repository) ([]*ActionRunJob, error) {

0 commit comments

Comments
 (0)