Skip to content

Commit

Permalink
Merge pull request #1 from hash-rabbit/feat-goversion
Browse files Browse the repository at this point in the history
Feat goversion
  • Loading branch information
vamosdalian authored Dec 27, 2023
2 parents 60ca143 + 3746c8c commit 0c83ed2
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 11 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/tmp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Tmp

on:
push:
branches: [ "feat-goversion" ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'

- name: Build
run: go build -v

- name: Test
run: go test -v ./...

- name: Upload
id: upload
uses: actions/upload-artifact@v3
with:
name: auto-build
path: ./auto-build
4 changes: 2 additions & 2 deletions logic/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func StartTask(wr http.ResponseWriter, r *http.Request) {

t := &task{
id: tl.Id,
goversion: tk.GoVersion,
goversion: p.GoVersion,
p: p,
t: tk,
tl: tl,
Expand Down Expand Up @@ -287,7 +287,7 @@ func readline(str string) []string {
}

func (t *task) getEnv() []string {
env := make([]string, 0)
env := os.Environ()
if t.p.GoMod {
env = append(env, "GO111MODULE=on")
} else {
Expand Down
2 changes: 1 addition & 1 deletion logic/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func autobuild(taskid int64) {

t := &task{
id: tl.Id,
goversion: tk.GoVersion,
goversion: p.GoVersion,
p: p,
t: tk,
tl: tl,
Expand Down
6 changes: 3 additions & 3 deletions model/Task.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ const (
)

type Task struct {
Id int64 `xorm:"pk" json:"id"`
ProjectId int64 `xorm:"index" json:"project_id"`
GoVersion string `xorm:"index" json:"go_version_id"` // envid
Id int64 `xorm:"pk" json:"id"`
ProjectId int64 `xorm:"index" json:"project_id"`
// GoVersion string `xorm:"index" json:"go_version_id"` // envid
Branch string `xorm:"varchar(10)" json:"branch"`
AutoBuild bool `xorm:"Bool" json:"auto_build"`
MainFile string `xorm:"varchar(20)" json:"main_file"` // 主文件
Expand Down
8 changes: 4 additions & 4 deletions model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ func InitModel() {
log.Panicf("init sql lite error:%s", err)
}

// err = AuthMergeTable()
// if err != nil {
// log.Panicf("auto merge table error:%s", err)
// }
err = AuthMergeTable()
if err != nil {
log.Panicf("auto merge table error:%s", err)
}
}

func InitNode() error {
Expand Down
3 changes: 2 additions & 1 deletion model/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ type Project struct {
Url string `xorm:"varchar(50)" json:"url"`
MainBranch string `xorm:"varchar(30) default master" json:"main_branch"`
Token string `xorm:"varchar(50)" json:"token"`
GoVersion string `xorm:"index" json:"go_version_id"` // envid
GoMod bool `xorm:"bool" json:"go_mod"`
WorkSpace string `xorm:"varchar(50)" json:"workspace"` //only go path(not mod) used
WorkSpace string `xorm:"varchar(50)" json:"workspace"` // only go path(not mod) used
Env string `xorm:"varchar(255)" json:"env"` // 环境变量key1=value1;key2=value2
BeforeBuildCmd string `xorm:"varchar(255)" json:"before_build_cmd"`
AfterBuildCmd string `xorm:"varchar(255)" json:"after_build_cmd"`
Expand Down

0 comments on commit 0c83ed2

Please sign in to comment.