Browse Source

Init codecov

Update readame

Revert "Update readame"

This reverts commit 869ddcd6cb852a155d3df3b334bb51f36d811c9d.

Update readame

Revert "Init codecov"

This reverts commit 4b82076b2e585ed462150b9f05d2ab84a9ca12ca.

Init codecov
tumao 3 years ago
parent
commit
ac2455d58d
5 changed files with 930 additions and 43 deletions
  1. 50 37
      .github/workflows/dev.yml
  2. 1 0
      README.md
  3. 27 0
      codecov.yml
  4. 10 1
      express/package.json
  5. 842 5
      express/yarn.lock

+ 50 - 37
.github/workflows/dev.yml

@@ -2,7 +2,7 @@ name: Milvus insight dev release
 
 
 on:
 on:
   pull_request_target:
   pull_request_target:
-    branches: [main]
+    branches: [dev]
     types: [closed]
     types: [closed]
 
 
 jobs:
 jobs:
@@ -16,6 +16,19 @@ jobs:
         with:
         with:
           node-version: 12
           node-version: 12
 
 
+      - name: Run express tests
+        run: |
+          cd express
+          yarn install
+          yarn test:cov
+      
+      - name: Upload coverage to Codecov
+        uses: codecov/codecov-action@v2
+        with:
+          # token: ${{ secrets.CODECOV_TOKEN }}
+          directory: '../../express/coverage/'
+          flags: express
+
       - name: Login to DockerHub
       - name: Login to DockerHub
         uses: docker/login-action@v1
         uses: docker/login-action@v1
         with:
         with:
@@ -23,49 +36,49 @@ jobs:
           password: ${{ secrets.DOCKER_PWD }}
           password: ${{ secrets.DOCKER_PWD }}
 
 
       - name: Docker Build
       - name: Docker Build
-        run: docker build -t milvusdb/milvus-insight:dev --build-arg VERSION=dev .
+        run: docker build -t tumao/milvus-insight:dev --build-arg VERSION=dev .
 
 
       - name: Docker Push Dev
       - name: Docker Push Dev
-        run: docker push milvusdb/milvus-insight:dev
+        run: docker push tumao/milvus-insight:dev
 
 
-  k8s:
-    runs-on: ubuntu-latest
-    needs: build
-    steps:
-      - uses: actions/checkout@v2
-      - name: Setup Node.js
-        uses: actions/setup-node@v1
-        with:
-          node-version: 12
+  # k8s:
+  #   runs-on: ubuntu-latest
+  #   needs: build
+  #   steps:
+  #     - uses: actions/checkout@v2
+  #     - name: Setup Node.js
+  #       uses: actions/setup-node@v1
+  #       with:
+  #         node-version: 12
 
 
-      - name: Install OpenVPN and kubectl
-        run: |
-          sudo apt-get update
-          sudo apt-get install openvpn -y
-          sudo apt-get install -y apt-transport-https ca-certificates curl
-          sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
-          echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
-          sudo apt-get update
-          sudo apt-get install kubectl -y
+  #     - name: Install OpenVPN and kubectl
+  #       run: |
+  #         sudo apt-get update
+  #         sudo apt-get install openvpn -y
+  #         sudo apt-get install -y apt-transport-https ca-certificates curl
+  #         sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
+  #         echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
+  #         sudo apt-get update
+  #         sudo apt-get install kubectl -y
 
 
-      - name: Connect VPN
-        uses: golfzaptw/action-connect-ovpn@master
-        id: connect_vpn
-        with:
-          FILE_OVPN: '.github/workflows/client.ovpn'
-        env:
-          CA_CRT: ${{ secrets.VPN_CA}}
-          USER_CRT: ${{ secrets.VPN_CRT }}
-          USER_KEY: ${{ secrets.VPN_KEY }}
+  #     - name: Connect VPN
+  #       uses: golfzaptw/action-connect-ovpn@master
+  #       id: connect_vpn
+  #       with:
+  #         FILE_OVPN: '.github/workflows/client.ovpn'
+  #       env:
+  #         CA_CRT: ${{ secrets.VPN_CA}}
+  #         USER_CRT: ${{ secrets.VPN_CRT }}
+  #         USER_KEY: ${{ secrets.VPN_KEY }}
 
 
-      - name: Deploy to cluster
-        run: |
-          echo ${{ secrets.kubeconfig }} > config64
-          base64 -d config64 > kubeconfig
-          kubectl delete pods -n ued -l app=milvus-insight --kubeconfig=kubeconfig
-          sleep 60
+  #     - name: Deploy to cluster
+  #       run: |
+  #         echo ${{ secrets.kubeconfig }} > config64
+  #         base64 -d config64 > kubeconfig
+  #         kubectl delete pods -n ued -l app=milvus-insight --kubeconfig=kubeconfig
+  #         sleep 60
 
 
-  check:
+  # check:
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
     needs: [build, k8s]
     needs: [build, k8s]
     steps:
     steps:

+ 1 - 0
README.md

@@ -1,6 +1,7 @@
 # Milvus insight
 # Milvus insight
 [![typescript](https://badges.aleen42.com/src/typescript.svg)](https://badges.aleen42.com/src/typescript.svg)
 [![typescript](https://badges.aleen42.com/src/typescript.svg)](https://badges.aleen42.com/src/typescript.svg)
 [![downloads](https://img.shields.io/docker/pulls/milvusdb/milvus-insight)](https://img.shields.io/docker/pulls/milvusdb/milvus-insight)
 [![downloads](https://img.shields.io/docker/pulls/milvusdb/milvus-insight)](https://img.shields.io/docker/pulls/milvusdb/milvus-insight)
+[![codecov](https://codecov.io/gh/Tumao727/milvus-insight/branch/dev/graph/badge.svg?token=qB4H3VIHEJ)](https://codecov.io/gh/Tumao727/milvus-insight)
 
 
 Milvus insight provides an intuitive and efficient GUI for Milvus, allowing you to interact with your databases and manage your data with just few clicks.
 Milvus insight provides an intuitive and efficient GUI for Milvus, allowing you to interact with your databases and manage your data with just few clicks.
 
 

+ 27 - 0
codecov.yml

@@ -0,0 +1,27 @@
+coverage:
+  status:
+    project:
+      default:
+        flags:
+          - client
+          - express
+      client:
+        target: auto
+        flags:
+          - client
+      express:
+        target: auto
+        flags:
+          - express
+comment:
+  layout: "reach, diff, flags, files"
+  require_changes: true
+flags:
+  client:
+    paths:
+      - client/
+    carryforward: true
+  express:
+    paths:
+      - express/
+    carryforward: true

+ 10 - 1
express/package.json

@@ -14,6 +14,12 @@
     "rimraf": "^3.0.2",
     "rimraf": "^3.0.2",
     "socket.io": "^4.3.1"
     "socket.io": "^4.3.1"
   },
   },
+  "jest": {
+    "testEnvironment": "node",
+    "coveragePathIgnorePatterns": [
+      "/node_modules/"
+    ]
+  },
   "devDependencies": {
   "devDependencies": {
     "@types/cors": "^2.8.12",
     "@types/cors": "^2.8.12",
     "@types/express": "^4.17.13",
     "@types/express": "^4.17.13",
@@ -21,6 +27,8 @@
     "@types/node": "^16.11.6",
     "@types/node": "^16.11.6",
     "@types/node-cron": "^3.0.0",
     "@types/node-cron": "^3.0.0",
     "@types/ws": "^8.2.0",
     "@types/ws": "^8.2.0",
+    "jest": "^27.3.1",
+    "supertest": "^6.1.6",
     "ts-node": "^10.4.0",
     "ts-node": "^10.4.0",
     "tslint": "^6.1.3",
     "tslint": "^6.1.3",
     "typescript": "^4.4.4"
     "typescript": "^4.4.4"
@@ -32,7 +40,8 @@
     "start": "node .",
     "start": "node .",
     "start:plugin": "yarn build && cross-env PLUGIN_DEV=1 node dist/milvus-insight/express/src/app.js",
     "start:plugin": "yarn build && cross-env PLUGIN_DEV=1 node dist/milvus-insight/express/src/app.js",
     "start:prod": "node dist/app.js",
     "start:prod": "node dist/app.js",
-    "test": "echo \"Error: no test specified\" && exit 1",
+    "test": "cross-env NODE_ENV=test jest --testTimeout=10000 --passWithNoTests",
+    "test:cov": "cross-env NODE_ENV=test jest --testTimeout=10000 --passWithNoTests --coverage",
     "clean": "rimraf dist"
     "clean": "rimraf dist"
   }
   }
 }
 }

File diff suppressed because it is too large
+ 842 - 5
express/yarn.lock


Some files were not shown because too many files changed in this diff