forked from casdoor/casdoor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add migration ci test (casdoor#1600)
* feat: add migration ci test * feat: add migration ci test * feat: add migration ci test --------- Co-authored-by: Zayn Xie <84443886+xiaoniuren99@users.noreply.github.com>
- Loading branch information
1 parent
7181489
commit db401b2
Showing
1 changed file
with
61 additions
and
0 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,61 @@ | ||
name: Migration Test | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'object/migrator**' | ||
pull_request: | ||
paths: | ||
- 'object/migrator**' | ||
|
||
jobs: | ||
|
||
db-migrator-test: | ||
name: db-migrator-test | ||
runs-on: ubuntu-latest | ||
services: | ||
mysql: | ||
image: mysql:5.7 | ||
env: | ||
MYSQL_DATABASE: casdoor | ||
MYSQL_ROOT_PASSWORD: 123456 | ||
ports: | ||
- 3306:3306 | ||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: '^1.16.5' | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 | ||
- name: pull casdoor-master-latest | ||
run: | | ||
sudo apt update | ||
sudo apt install git | ||
sudo apt install net-tools | ||
sudo mkdir tmp | ||
cd tmp | ||
sudo git clone https://github.com/casdoor/casdoor.git | ||
cd .. | ||
working-directory: ./ | ||
- name: run casdoor-master-latest | ||
run: | | ||
sudo nohup go run main.go & | ||
sudo sleep 2m | ||
working-directory: ./tmp/casdoor | ||
- name: stop casdoor-master-latest | ||
run: | | ||
sudo kill -9 `sudo netstat -anltp | grep 8000 | awk '{print $7}' | cut -d / -f 1` | ||
working-directory: ./ | ||
- name: run casdoor-current-version | ||
run: | | ||
sudo nohup go run ./main.go & | ||
sudo sleep 2m | ||
working-directory: ./ | ||
- name: test port-8000 | ||
run: | | ||
if [[ `sudo netstat -anltp | grep 8000 | awk '{print $7}'` == "" ]];then echo 'db-migrator-test fail' && exit 1;fi; | ||
echo 'db-migrator-test pass' | ||
working-directory: ./ |