Skip to content

Commit

Permalink
Merge pull request #636 from chenhg5/feature/test_drone_ci
Browse files Browse the repository at this point in the history
test: update drone.ci
  • Loading branch information
chenhg5 authored Aug 19, 2024
2 parents bb6b738 + 3da2b07 commit aed45b8
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 580 deletions.
116 changes: 55 additions & 61 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,64 +19,62 @@ services:

steps:
- name: api
image: chg80333/goadmin-test:v8
image: chg80333/goadmin-test:v9
environment:
GO111MODULE: on
GOPROXY: https://goproxy.cn
commands:
- ssh-keygen -f "/root/.ssh/known_hosts" -R "github.com"
- ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
- cd /go/src/github.com/GoAdminGroup/go-admin
- git pull
- git fetch origin pull/$DRONE_PULL_REQUEST/head:pr$DRONE_PULL_REQUEST
- git checkout pr$DRONE_PULL_REQUEST
- go version
- sleep 80
- make mysql-test

---
kind: pipeline
type: docker
name: api_mssql

trigger:
event:
- pull_request

clone:
disable: true

volumes:
- name: data
temp: {}

services:
- name: db_mssql
image: mcr.microsoft.com/mssql/server:2017-latest
volumes:
- name: data
path: /home/data
environment:
ACCEPT_EULA: Y
SA_PASSWORD: Aa123456

steps:
- name: api
image: chg80333/goadmin-test:v8
volumes:
- name: data
path: /go/src/github.com/GoAdminGroup/go-admin/tests/data
environment:
GO111MODULE: on
GOPROXY: https://goproxy.cn
commands:
- ssh-keygen -f "/root/.ssh/known_hosts" -R "github.com"
- ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
- cd /go/src/github.com/GoAdminGroup/go-admin
- git pull
- git fetch origin pull/$DRONE_PULL_REQUEST/head:pr$DRONE_PULL_REQUEST
- git checkout pr$DRONE_PULL_REQUEST
- sleep 80
- make ms-test
- GOPROXY=https://goproxy.cn make mysql-test

# ---
# kind: pipeline
# type: docker
# name: api_mssql

# trigger:
# event:
# - pull_request

# clone:
# disable: true

# volumes:
# - name: data
# temp: {}

# services:
# - name: db_mssql
# image: mcr.microsoft.com/mssql/server:2017-latest
# volumes:
# - name: data
# path: /home/data
# environment:
# ACCEPT_EULA: Y
# SA_PASSWORD: Aa123456

# steps:
# - name: api
# image: chg80333/goadmin-test:v9
# volumes:
# - name: data
# path: /go/src/github.com/GoAdminGroup/go-admin/tests/data
# environment:
# GO111MODULE: on
# GOPROXY: https://goproxy.cn
# commands:
# - cd /go/src/github.com/GoAdminGroup/go-admin
# - git pull
# - git fetch origin pull/$DRONE_PULL_REQUEST/head:pr$DRONE_PULL_REQUEST
# - git checkout pr$DRONE_PULL_REQUEST
# - go version
# - sleep 80
# - GOPROXY=https://goproxy.cn make ms-test

---
kind: pipeline
Expand All @@ -100,19 +98,18 @@ services:

steps:
- name: api
image: chg80333/goadmin-test:v8
image: chg80333/goadmin-test:v9
environment:
GO111MODULE: on
GOPROXY: https://goproxy.cn
commands:
- ssh-keygen -f "/root/.ssh/known_hosts" -R "github.com"
- ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
- cd /go/src/github.com/GoAdminGroup/go-admin
- git pull
- git fetch origin pull/$DRONE_PULL_REQUEST/head:pr$DRONE_PULL_REQUEST
- git checkout pr$DRONE_PULL_REQUEST
- go version
- sleep 80
- make pg-test
- GOPROXY=https://goproxy.cn make pg-test

---
kind: pipeline
Expand All @@ -128,19 +125,18 @@ clone:

steps:
- name: api
image: chg80333/goadmin-test:v8
image: chg80333/goadmin-test:v9
environment:
GO111MODULE: on
GOPROXY: https://goproxy.cn
commands:
- ssh-keygen -f "/root/.ssh/known_hosts" -R "github.com"
- ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
- cd /go/src/github.com/GoAdminGroup/go-admin
- git pull
- git fetch origin pull/$DRONE_PULL_REQUEST/head:pr$DRONE_PULL_REQUEST
- git checkout pr$DRONE_PULL_REQUEST
- go version
- sleep 80
- make sqlite-test
- GOPROXY=https://goproxy.cn make sqlite-test

---
kind: pipeline
Expand All @@ -163,17 +159,15 @@ services:

steps:
- name: chrome
image: chg80333/goadmin-test:v8
image: chg80333/goadmin-test:v9
environment:
GO111MODULE: on
GOPROXY: https://goproxy.cn
commands:
- ssh-keygen -f "/root/.ssh/known_hosts" -R "github.com"
- ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
- cd /go/src/github.com/GoAdminGroup/go-admin
- git pull
- git fetch origin pull/$DRONE_PULL_REQUEST/head:pr$DRONE_PULL_REQUEST
- git checkout pr$DRONE_PULL_REQUEST
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
- sleep 8
- make web-test
- GOPROXY=https://goproxy.cn make web-test
26 changes: 13 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,46 +34,46 @@ mysql-test: $(TEST_FRAMEWORK_DIR)/*
go get github.com/ugorji/go/codec@none
for file in $^ ; do \
make import-mysql ; \
gotest -mod=mod -gcflags=all=-l -v ./$${file}/... -args $(TEST_CONFIG_PATH) ; \
go test -mod=mod -gcflags=all=-l -v ./$${file}/... -args $(TEST_CONFIG_PATH) ; \
done

sqlite-test: $(TEST_FRAMEWORK_DIR)/*
for file in $^ ; do \
make import-sqlite ; \
gotest -mod=mod -gcflags=all=-l ./$${file}/... -args $(TEST_CONFIG_SQLITE_PATH) ; \
go test -mod=mod -gcflags=all=-l ./$${file}/... -args $(TEST_CONFIG_SQLITE_PATH) ; \
done

pg-test: $(TEST_FRAMEWORK_DIR)/*
for file in $^ ; do \
make import-postgresql ; \
gotest -mod=mod -gcflags=all=-l ./$${file}/... -args $(TEST_CONFIG_PQ_PATH) ; \
go test -mod=mod -gcflags=all=-l ./$${file}/... -args $(TEST_CONFIG_PQ_PATH) ; \
done

ms-test: $(TEST_FRAMEWORK_DIR)/*
for file in $^ ; do \
make import-mssql ; \
gotest -mod=mod -gcflags=all=-l ./$${file}/... -args $(TEST_CONFIG_MS_PATH) ; \
go test -mod=mod -gcflags=all=-l ./$${file}/... -args $(TEST_CONFIG_MS_PATH) ; \
done

## tests: user acceptance tests

web-test: import-mysql
gotest -mod=mod ./tests/web/...
go test -mod=mod ./tests/web/...
rm -rf ./tests/web/User*

web-test-debug: import-mysql
gotest -mod=mod ./tests/web/... -args true
go test -mod=mod ./tests/web/... -args true

## tests: unit tests

unit-test:
gotest -mod=mod ./adm/...
gotest -mod=mod ./context/...
gotest -mod=mod ./modules/...
gotest -mod=mod ./plugins/admin/controller/...
gotest -mod=mod ./plugins/admin/modules/parameter/...
gotest -mod=mod ./plugins/admin/modules/table/...
gotest -mod=mod ./plugins/admin/modules/...
go test -mod=mod ./adm/...
go test -mod=mod ./context/...
go test -mod=mod ./modules/...
go test -mod=mod ./plugins/admin/controller/...
go test -mod=mod ./plugins/admin/modules/parameter/...
go test -mod=mod ./plugins/admin/modules/table/...
go test -mod=mod ./plugins/admin/modules/...

## tests: helpers

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,3 @@ See the [docs](https://book.go-admin.cn) for more details.
<strong>here to join into the develop team</strong>

[join telegram](https://t.me/joinchat/NlyH6Bch2QARZkArithKvg)

10 changes: 2 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module github.com/GoAdminGroup/go-admin

go 1.21
go 1.21.5

require (
github.com/360EntSecGroup-Skylar/excelize v1.4.1
github.com/GoAdminGroup/html v0.0.1
github.com/GoAdminGroup/themes v0.0.45
github.com/GoAdminGroup/themes v0.0.48
github.com/NebulousLabs/fastrand v0.0.0-20181203155948-6fb6489aac4e
github.com/agiledragon/gomonkey v2.0.2+incompatible
github.com/astaxie/beego v1.12.1
Expand Down Expand Up @@ -77,8 +77,6 @@ require (
github.com/gobuffalo/logger v1.0.7 // indirect
github.com/gobuffalo/meta v0.3.3 // indirect
github.com/gobuffalo/nulls v0.4.2 // indirect
github.com/gobuffalo/packd v1.0.1 // indirect
github.com/gobuffalo/packr/v2 v2.8.3 // indirect
github.com/gobuffalo/plush/v4 v4.1.18 // indirect
github.com/gobuffalo/refresh v1.13.3 // indirect
github.com/gobuffalo/tags/v3 v3.1.4 // indirect
Expand All @@ -103,7 +101,6 @@ require (
github.com/joho/godotenv v1.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/karrick/godirwalk v1.16.1 // indirect
github.com/kataras/blocks v0.0.8 // indirect
github.com/kataras/golog v0.1.11 // indirect
github.com/kataras/pio v0.0.13 // indirect
Expand All @@ -113,9 +110,6 @@ require (
github.com/labstack/gommon v0.4.2 // indirect
github.com/mailgun/raymond/v2 v2.0.48 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/markbates/errx v1.1.0 // indirect
github.com/markbates/oncer v1.0.0 // indirect
github.com/markbates/safe v1.0.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
Expand Down
Loading

0 comments on commit aed45b8

Please sign in to comment.