till 5 năm trước cách đây
mục cha
commit
65d4d1766f
6 tập tin đã thay đổi với 92 bổ sung0 xóa
  1. 1 0
      answer7bucks
  2. 17 0
      automator_test/main.py
  3. 35 0
      deploy/update.php
  4. 26 0
      deploy/updateserver.php
  5. 5 0
      package.json
  6. 8 0
      yarn.lock

+ 1 - 0
answer7bucks

@@ -0,0 +1 @@
+Subproject commit 5f97e4684f74eb2d162d514bf212d889772c1861

+ 17 - 0
automator_test/main.py

@@ -0,0 +1,17 @@
+# coding=utf-8
+from fastAutoTest.core.wx.wxEngine import WxDriver
+import os
+
+# 进入小程序
+if __name__ == '__main__':
+    wxDriver = WxDriver()
+    wxDriver.initDriver()
+    # wxDriver.clickElementByXpath('/html/body/div[1]/div/div[3]/p')
+    wxDriver.clickFirstElementByText('进入平台')
+    wxDriver.returnLastPage()
+    # wxDriver.returnLastPage()
+    # 截图
+    dirPath = os.path.split(os.path.realpath(__file__))[0]
+    PIC_SRC = os.path.join(dirPath, '/screenshot/pic.png')
+    wxDriver.d.screenshot(PIC_SRC)
+    wxDriver.close()

+ 35 - 0
deploy/update.php

@@ -0,0 +1,35 @@
+<?php
+error_reporting(E_ALL);
+header("Content-type: text/html; charset=utf-8");
+$p = json_decode($_REQUEST["hook"]); // json转换
+$fp = fopen("./log.txt", 'a');
+$lastcommit = $p->push_data->commits[count($js->push_data->commits) - 1]; // 获取最后的commit
+print_r($_SERVER);
+//if (strstr($lastcommit->message, "release")) // 这里意为:如果最后的commit包含"release"则进行自动发布。
+//{ 
+    echo "<br>\n---- PWD ----- \n\n<br>";
+    echo exec("pwd",$res1); // 进入目录
+    print_r($res1);
+    echo "<br>\n---- PRINTENV ----- \n\n<br>";
+    echo exec("printenv", $res2); // 进入目录
+    print_r($res2);
+    echo "<br>\n---- CD ----- \n\n<br>";
+    echo exec("cd ./"); // 进入目录
+    echo "<br>\n---- GIT ----- \n\n<br>";
+    echo exec("git pull origin master", $res3); // 进行git拉取,前提是使用了ssh
+    print_r($res3);
+    echo "<br>";
+    echo exec("git log --graph", $res4); // 进行git拉取,前提是使用了ssh
+    for($i=0;$i<count($res4);$i++){
+        echo 	$res4[$i] . "<br>";
+    }
+    echo "<br>";
+    fwrite($fp, "※" . date('Y-m-d H:i:s') . "\t" . $lastcommit->message . "\t" . $lastcommit->author->name . "\n"); // 进行记录
+    echo "Pull Success";
+//} else {
+//    fwrite($fp, date('Y-m-d H:i:s') . "\t" . $lastcommit->message . "\t" . $lastcommit->author->name . "\n");
+//}
+
+fclose($fp);
+
+?>

+ 26 - 0
deploy/updateserver.php

@@ -0,0 +1,26 @@
+B1;95;0c<?php
+error_reporting(E_ALL);
+header("Content-type: text/html; charset=utf-8");
+$p = json_decode($_REQUEST["hook"]); // json转换
+$fp = fopen("./log.txt", 'a');
+$lastcommit = $p->push_data->commits[count($js->push_data->commits) - 1]; 
+print_r($_SERVER);
+    echo "<br>\n---- PRINTENV ----- \n\n<br>";
+    echo exec("printenv", $res2);
+    var_dump($res2);
+    echo "<br>\n---- RUNNING : sudo supervisor start all ----- \n\n<br>";
+    echo exec("sudo supervisorctl restart all ", $res3); 
+    echo "\n<br>";
+    var_dump($res3);
+    echo "<br>";
+    echo "cd /home/nginx/quiz/quizapp-be && git pull ; git log --graph --oneline";
+    echo exec("cd /home/nginx/quiz/quizapp-be && git pull ; git log --graph --oneline", $res4); 
+    for($i=0;$i<count($res4);$i++){
+        echo 	$res4[$i] . "<br>\n";
+    }
+    echo "<br>";
+    fwrite($fp, "※" . date('Y-m-d H:i:s') . "\t" . $lastcommit->message . "\t" . $lastcommit->author->name . "\n"); // 进行记录
+
+fclose($fp);
+
+?>

+ 5 - 0
package.json

@@ -0,0 +1,5 @@
+{
+  "dependencies": {
+    "vant-weapp": "^0.5.4"
+  }
+}

+ 8 - 0
yarn.lock

@@ -0,0 +1,8 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+
+vant-weapp@^0.5.4:
+  version "0.5.4"
+  resolved "http://registry.npm.taobao.org/vant-weapp/download/vant-weapp-0.5.4.tgz#db2a44eb10e37502f32de992feeb4c08673c450e"
+  integrity sha1-2ypE6xDjdQLzLemS/utMCGc8RQ4=