-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #444 from GoAdminGroup/pre-release
add drone ci
- Loading branch information
Showing
11 changed files
with
187 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
--- | ||
kind: pipeline | ||
type: docker | ||
name: api_mysql | ||
|
||
trigger: | ||
event: | ||
- pull_request | ||
|
||
clone: | ||
disable: true | ||
|
||
services: | ||
- name: db_mysql | ||
image: mysql:5.7 | ||
environment: | ||
MYSQL_ROOT_PASSWORD: root | ||
MYSQL_DATABASE: go-admin-test | ||
|
||
steps: | ||
- name: api | ||
image: chg80333/goadmin-test:v7 | ||
environment: | ||
GO111MODULE: on | ||
GOPROXY: https://goproxy.cn | ||
commands: | ||
- cd /go/src/github.com/GoAdminGroup/go-admin | ||
- git pull | ||
- git checkout $DRONE_COMMIT | ||
- 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:v7 | ||
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 checkout $DRONE_COMMIT | ||
- sleep 80 | ||
- make ms-test | ||
|
||
--- | ||
kind: pipeline | ||
type: docker | ||
name: api_postgres | ||
|
||
trigger: | ||
event: | ||
- pull_request | ||
|
||
clone: | ||
disable: true | ||
|
||
services: | ||
- name: db_pgsql | ||
image: postgres:10 | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_DB: go-admin-test | ||
POSTGRES_PASSWORD: root | ||
|
||
steps: | ||
- name: api | ||
image: chg80333/goadmin-test:v7 | ||
environment: | ||
GO111MODULE: on | ||
GOPROXY: https://goproxy.cn | ||
commands: | ||
- cd /go/src/github.com/GoAdminGroup/go-admin | ||
- git pull | ||
- git checkout $DRONE_COMMIT | ||
- sleep 80 | ||
- make pg-test | ||
|
||
--- | ||
kind: pipeline | ||
type: docker | ||
name: api_sqlite | ||
|
||
trigger: | ||
event: | ||
- pull_request | ||
|
||
clone: | ||
disable: true | ||
|
||
steps: | ||
- name: api | ||
image: chg80333/goadmin-test:v7 | ||
environment: | ||
GO111MODULE: on | ||
GOPROXY: https://goproxy.cn | ||
commands: | ||
- cd /go/src/github.com/GoAdminGroup/go-admin | ||
- git pull | ||
- git checkout $DRONE_COMMIT | ||
- sleep 80 | ||
- make sqlite-test | ||
|
||
--- | ||
kind: pipeline | ||
type: docker | ||
name: frontend | ||
|
||
trigger: | ||
event: | ||
- pull_request | ||
|
||
clone: | ||
disable: true | ||
|
||
services: | ||
- name: db_mysql | ||
image: mysql:5.7 | ||
environment: | ||
MYSQL_ROOT_PASSWORD: root | ||
MYSQL_DATABASE: go-admin-test | ||
|
||
steps: | ||
- name: chrome | ||
image: chg80333/goadmin-test:v7 | ||
environment: | ||
GO111MODULE: on | ||
GOPROXY: https://goproxy.cn | ||
commands: | ||
- cd /go/src/github.com/GoAdminGroup/go-admin | ||
- git pull | ||
- git checkout $DRONE_COMMIT | ||
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost & | ||
- sleep 8 | ||
- make web-test |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,11 +12,18 @@ TEST_CONFIG_MS_PATH=./../../common/config_ms.json | |
TEST_FRAMEWORK_DIR=./tests/frameworks | ||
|
||
## database configs | ||
MYSQL_HOST = 127.0.0.1 | ||
MYSQL_HOST = db_mysql | ||
MYSQL_PORT = 3306 | ||
MYSQL_USER = root | ||
MYSQL_PWD = root | ||
|
||
POSTGRESSQL_HOST = db_pgsql | ||
POSTGRESSQL_PORT = 5432 | ||
POSTGRESSQL_USER = postgres | ||
POSTGRESSQL_PWD = root | ||
|
||
TEST_DB = go-admin-test | ||
|
||
all: test | ||
|
||
## tests | ||
|
@@ -79,25 +86,20 @@ import-sqlite: | |
cp ./tests/data/admin.db ./tests/common/admin.db | ||
|
||
import-mysql: | ||
mysql -h$(MYSQL_HOST) -P${MYSQL_PORT} -u${MYSQL_USER} -p${MYSQL_PWD} -e "create database if not exists \`go-admin-test\`" | ||
mysql -h$(MYSQL_HOST) -P${MYSQL_PORT} -u${MYSQL_USER} -p${MYSQL_PWD} go-admin-test < ./tests/data/admin.sql | ||
mysql -h$(MYSQL_HOST) -P${MYSQL_PORT} -u${MYSQL_USER} -p${MYSQL_PWD} -e "create database if not exists \`${TEST_DB}\`" | ||
mysql -h$(MYSQL_HOST) -P${MYSQL_PORT} -u${MYSQL_USER} -p${MYSQL_PWD} ${TEST_DB} < ./tests/data/admin.sql | ||
|
||
import-postgresql: | ||
dropdb -U postgres go-admin-test | ||
createdb -U postgres go-admin-test | ||
psql -d go-admin-test -U postgres -f ./tests/data/admin_pg.sql | ||
PGPASSWORD=${POSTGRESSQL_PWD} dropdb -h ${POSTGRESSQL_HOST} -p ${POSTGRESSQL_PORT} -U ${POSTGRESSQL_USER} ${TEST_DB} | ||
PGPASSWORD=${POSTGRESSQL_PWD} createdb -h ${POSTGRESSQL_HOST} -p ${POSTGRESSQL_PORT} -U ${POSTGRESSQL_USER} ${TEST_DB} | ||
PGPASSWORD=${POSTGRESSQL_PWD} psql -h ${POSTGRESSQL_HOST} -p ${POSTGRESSQL_PORT} -d ${TEST_DB} -U ${POSTGRESSQL_USER} -f ./tests/data/admin_pg.sql | ||
|
||
import-mssql: | ||
docker exec mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P Aa123456 -Q "RESTORE DATABASE [goadmin] FROM DISK = N'/home/data/admin_ms.bak' WITH FILE = 1, NOUNLOAD, REPLACE, RECOVERY, STATS = 5" | ||
/opt/mssql-tools/bin/sqlcmd -S db_mssql -U SA -P Aa123456 -Q "RESTORE DATABASE [goadmin] FROM DISK = N'/home/data/admin_ms.bak' WITH FILE = 1, NOUNLOAD, REPLACE, RECOVERY, STATS = 5" | ||
|
||
backup-mssql: | ||
docker exec mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P Aa123456 -Q "BACKUP DATABASE [goadmin] TO DISK = N'/home/data/admin_ms.bak' WITH NOFORMAT, NOINIT, NAME = 'goadmin-full', SKIP, NOREWIND, NOUNLOAD, STATS = 10" | ||
|
||
fix-gf: | ||
go get -u -v github.com/gogf/[email protected] | ||
sudo chmod -R 777 $(GOPATH)/pkg/mod/github.com/gogf/[email protected]/net/ghttp/ghttp_server_handler.go | ||
sudo echo "\nfunc (s *Server) DefaultHttpHandle(w http.ResponseWriter, r *http.Request) { \n s.handleRequest(w, r) \n}\n" >> $(GOPATH)/pkg/mod/github.com/gogf/[email protected]/net/ghttp/ghttp_server_handler.go | ||
|
||
cp-mod: | ||
cp go.mod go.mod.old | ||
cp go.sum go.sum.old | ||
|
@@ -154,4 +156,4 @@ cli: | |
cp ./adm/build/windows/i386/adm_windows_i386_$(VERSION).zip ./adm/build/zip/ | ||
cp ./adm/build/mac/adm_darwin_x86_64_$(VERSION).zip ./adm/build/zip/ | ||
|
||
.PHONY: all fmt golint govet cp-mod restore-mod test black-box-test mysql-test sqlite-test import-sqlite import-mysql import-postgresql pg-test fix-gf lint cilint cli | ||
.PHONY: all fmt golint govet cp-mod restore-mod test black-box-test mysql-test sqlite-test import-sqlite import-mysql import-postgresql pg-test lint cilint cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters