All checks were successful
Build and Release / Create Release (push) Successful in 0s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 3m7s
Build and Release / Lint (push) Successful in 5m21s
Build and Release / Unit Tests (push) Successful in 5m46s
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Successful in 3m44s
Build and Release / Build Binaries (amd64, darwin, linux-latest) (push) Successful in 4m4s
Build and Release / Build Binaries (arm64, darwin, linux-latest) (push) Successful in 3m23s
Build and Release / Build Binaries (arm64, linux, linux-latest) (push) Successful in 3m47s
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Successful in 8h6m28s
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
// Copyright 2022 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package actions
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"code.gitcaddy.com/server/models/db"
|
|
"code.gitcaddy.com/server/modules/timeutil"
|
|
)
|
|
|
|
// ActionTaskStep represents a step of ActionTask
|
|
type ActionTaskStep struct {
|
|
ID int64
|
|
Name string `xorm:"VARCHAR(255)"`
|
|
TaskID int64 `xorm:"index unique(task_index)"`
|
|
Index int64 `xorm:"index unique(task_index)"`
|
|
RepoID int64 `xorm:"index"`
|
|
Status Status `xorm:"index"`
|
|
LogIndex int64
|
|
LogLength int64
|
|
Started timeutil.TimeStamp
|
|
Stopped timeutil.TimeStamp
|
|
Created timeutil.TimeStamp `xorm:"created"`
|
|
Updated timeutil.TimeStamp `xorm:"updated"`
|
|
}
|
|
|
|
func (step *ActionTaskStep) Duration() time.Duration {
|
|
return calculateDuration(step.Started, step.Stopped, step.Status)
|
|
}
|
|
|
|
func init() {
|
|
db.RegisterModel(new(ActionTaskStep))
|
|
}
|
|
|
|
func GetTaskStepsByTaskID(ctx context.Context, taskID int64) ([]*ActionTaskStep, error) {
|
|
var steps []*ActionTaskStep
|
|
return steps, db.GetEngine(ctx).Where("task_id=?", taskID).OrderBy("`index` ASC").Find(&steps)
|
|
}
|