Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Config GitHub Action for go tests (#97)

satoru81aadf0724be
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000000..ca7484bbbb
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,28 @@
+name: build
+
+on:
+ push:
+ branches:
+ - 'main'
+ pull_request:
+
+jobs:
+ golangci:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: golangci-lint
+ uses: golangci/golangci-lint-action@v2
+ with:
+ version: v1.29
+ go-tests:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+ - uses: actions/setup-go@v2
+ with:
+ go-version: 1.17
+ - run: go test ./...
diff --git a/.golangci.yaml b/.golangci.yaml
index 4c44c5fae9..2b81ff4879 100644
--- a/.golangci.yaml
+++ b/.golangci.yaml
@@ -1,3 +1,5 @@
linters:
disable:
- errcheck
+run:
+ timeout: 5m
diff --git a/server/task.go b/server/task.go
index 01c4eac60e..210269e2fc 100644
--- a/server/task.go
+++ b/server/task.go
@@ -240,22 +240,6 @@ func (s *Server) composeTaskListByPipelineAndStageID(ctx context.Context, pipeli
return taskList, nil
}
-func (s *Server) composeTaskByID(ctx context.Context, id int) (*api.Task, error) {
- taskFind := &api.TaskFind{
- ID: &id,
- }
- task, err := s.TaskService.FindTask(ctx, taskFind)
- if err != nil {
- return nil, err
- }
-
- if err := s.composeTaskRelationship(ctx, task); err != nil {
- return nil, err
- }
-
- return task, nil
-}
-
func (s *Server) composeTaskRelationship(ctx context.Context, task *api.Task) error {
var err error
diff --git a/server/task_check_scheduler.go b/server/task_check_scheduler.go
index 2e331441c5..edf385994d 100644
--- a/server/task_check_scheduler.go
+++ b/server/task_check_scheduler.go
@@ -13,10 +13,6 @@ import (
"go.uber.org/zap"
)
-const (
- taskCheckScheduleInterval = time.Duration(1) * time.Second
-)
-
// NewTaskCheckScheduler creates a task check scheduler.
func NewTaskCheckScheduler(logger *zap.Logger, server *Server) *TaskCheckScheduler {
return &TaskCheckScheduler{