Browse Source

gitlab 自动测试相关脚本

hu hao 5 years ago
parent
commit
fe904d24f9
3 changed files with 8 additions and 6 deletions
  1. 5 5
      .gitlab-ci.yml
  2. 2 0
      ci/executeCommand.sh
  3. 1 1
      ci/judgePush.sh

+ 5 - 5
.gitlab-ci.yml

@@ -25,8 +25,8 @@ test:
     - testwas
   script:
     - echo "run test....."
-    - path=`pwd`
-    - sudo bash ci/judgePush.sh $path
+#    - path=`pwd`
+#    - sudo bash ci/judgePush.sh $path
 #    - vendor/bin/phpunit --testsuite=Unit
 
 deploy:
@@ -35,8 +35,8 @@ deploy:
     - testwas
   script:
     - echo "deploy ...."
-    - cd /var/www/bswas_test && sudo git config --global credential.helper store
-    - sudo git pull
-    - sudo bash ci/executeCommand.sh
+#    - cd /var/www/bswas_test && sudo git config --global credential.helper store
+#    - sudo git pull
+#    - sudo bash ci/executeCommand.sh
 #  only:
 #    - master

+ 2 - 0
ci/executeCommand.sh

@@ -17,6 +17,8 @@ for file in `ls $update_path`
             sudo yarn install
         elif [ "resources" == "$file" ]; then
             sudo yarn run prod
+        elif [ "database" == "$file" ]; then
+            sudo php artisan migrate
         fi
     done
 

+ 1 - 1
ci/judgePush.sh

@@ -28,7 +28,7 @@ for menu in `cd "$path" && find -type f -mmin -5 |grep -v .git|grep -v vendor`
     do
     #判断文件夹是否存在
         if [ $(dirname "${menu#./}") != "." ]; then
-             mkdir -p $(dirname "${menu#./}") && cp  "$path"/"${menu#./}" /var/www/update/$(dirname "${menu#./}")
+             mkdir -p $(dirname "${menu#./}") && cp "$path"/"${menu#./}" /var/www/update/$(dirname "${menu#./}")
             else
                 cp -r "$path"/"${menu#./}" /var/www/update
         fi