Browse Source

chore(CI): update workflows

change target update repos event in build packages workflows

merge dialyzer test to run test case workflows
zhanghongtong 5 years ago
parent
commit
9f0c88cda9

+ 12 - 0
.ci/apps_tests/conf.env

@@ -0,0 +1,12 @@
+EMQX_AUTH__LDAP__SERVERS=ldap_server
+EMQX_AUTH__MONGO__SERVER=mongo_server:27017
+EMQX_AUTH__REDIS__SERVER=redis_server:6379
+EMQX_AUTH__MYSQL__SERVER=mysql_server:3306
+EMQX_AUTH__MYSQL__USERNAME=root
+EMQX_AUTH__MYSQL__PASSWORD=public
+EMQX_AUTH__MYSQL__DATABASE=mqtt
+EMQX_AUTH__PGSQL__SERVER=pgsql_server:5432
+EMQX_AUTH__PGSQL__USERNAME=root
+EMQX_AUTH__PGSQL__PASSWORD=public
+EMQX_AUTH__PGSQL__DATABASE=mqtt
+CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_

+ 2 - 0
.ci/apps_tests/docker-compose.yaml

@@ -12,6 +12,8 @@ services:
       - ldap_server
     networks:
       - emqx_bridge
+    env_file:
+      - conf.env
     environment:
       GITHUB_ACTIONS: ${GITHUB_ACTIONS}
       GITHUB_TOKEN: ${GITHUB_TOKEN}

+ 15 - 10
.github/workflows/build_packages.yaml

@@ -329,7 +329,7 @@ jobs:
       with:
         repo: emqx
         path: "packages/emqx-*"
-        token: ${{ secrets.AccessToken }}
+        token: ${{ github.token }}
     - name: update to emqx.io
       if: github.event_name == 'release'
       run: |
@@ -355,21 +355,26 @@ jobs:
     - name: update repo.emqx.io
       if: github.event_name == 'release'
       run: |
-        set -e -x -u
-        curl \
+        curl --silent --show-error \
           -H "Authorization: token ${{ secrets.AccessToken }}" \
           -H "Accept: application/vnd.github.v3+json" \
           -X POST \
-          -d "{\"ref\":\"v1.0.0\",\"inputs\":{\"version\": \"${{ env.version }}\", \"emqx_ce\": \"true\"}}" \
-          https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_repos.yaml/dispatches
+          -d "{\"ref\":\"v1.0.1\",\"inputs\":{\"version\": \"${{ env.version }}\", \"emqx_ce\": \"true\"}}" \
+          "https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_repos.yaml/dispatches"
+    - name: update homebrew packages
+      if: github.event_name == 'release'
+      run: |
+        if [ -z $(echo $version | grep -oE "(alpha|beta|rc)\.[0-9]") ]; then
+            curl --silent --show-error \
+              -H "Authorization: token ${{ secrets.AccessToken }}" \
+              -H "Accept: application/vnd.github.v3+json" \
+              -X POST \
+              -d "{\"ref\":\"v1.0.1\",\"inputs\":{\"version\": \"${{ env.version }}\"}}" \
+              "https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_homebrew.yaml/dispatches"
+        fi
     - uses: geekyeggo/delete-artifact@v1
       with:
         name: emqx
     - uses: geekyeggo/delete-artifact@v1
       with:
         name: emqx-edge
-    # - name: update homebrew packages
-    #   run: |
-    #     if [ ! -z $(echo $version | grep -oE "v[0-9]+\.[0-9]+(\.[0-9]+)?") ] && [ -z $(echo $version | grep -oE "(alpha|beta|rc)\.[0-9]") ]; then
-    #       curl -H "Authorization: token ${{ secrets.AccessToken }}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" -X POST -d "{\"event_type\":\"update_homebrew\",\"client_payload\":{\"version\": \"$version\"}}" https://api.github.com/repos/emqx/emqx-packages-docker/dispatches
-    #     fi

+ 0 - 12
.github/workflows/run_dialyzer.yaml

@@ -1,12 +0,0 @@
-name: Run dialyzer
-on: pull_request
-jobs:
-  run_dialyzer:
-    runs-on: ubuntu-latest
-    container:
-      image: erlang:23.2
-    steps:
-      - uses: actions/checkout@v1
-      - name: Code dialyzer
-        run: |
-          make dialyzer

+ 17 - 19
.github/workflows/run_test_cases.yaml

@@ -10,7 +10,18 @@ on:
   pull_request:
 
 jobs:
-    run_test_case:
+    run_static_analysis:
+        runs-on: ubuntu-20.04
+        container: emqx/build-env:erl23.2.2-ubuntu20.04
+
+        steps:
+        - uses: actions/checkout@v2
+        - name: xref
+          run: make xref
+        - name: dialyzer
+          run: make dialyzer
+
+    run_common_test:
         runs-on: ubuntu-20.04
 
         steps:
@@ -26,25 +37,12 @@ jobs:
           run: |
             docker-compose -f .ci/apps_tests/docker-compose.yaml build --no-cache
             docker-compose -f .ci/apps_tests/docker-compose.yaml up -d
-
-        - name: run tests
+        - name: run eunit
+          run: docker exec -i erlang bash -c "make eunit"
+        - name: run common test
+          run: docker exec -i erlang bash -c "make ct"
+        - name: run cover
           run: |
-            export EMQX_AUTH__LDAP__SERVERS=ldap_server \
-                   EMQX_AUTH__MONGO__SERVER=mongo_server:27017 \
-                   EMQX_AUTH__REDIS__SERVER=redis_server:6379 \
-                   EMQX_AUTH__MYSQL__SERVER=mysql_server:3306 \
-                   EMQX_AUTH__MYSQL__USERNAME=root \
-                   EMQX_AUTH__MYSQL__PASSWORD=public \
-                   EMQX_AUTH__MYSQL__DATABASE=mqtt \
-                   EMQX_AUTH__PGSQL__SERVER=pgsql_server:5432 \
-                   EMQX_AUTH__PGSQL__USERNAME=root \
-                   EMQX_AUTH__PGSQL__PASSWORD=public \
-                   EMQX_AUTH__PGSQL__DATABASE=mqtt \
-                   CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
-            printenv > .env
-            docker exec -i erlang bash -c "make xref"
-            docker exec --env-file .env -i erlang bash -c "make ct"
-            docker exec --env-file .env -i erlang bash -c "make eunit"
             docker exec -i erlang bash -c "make cover"
             docker exec -i erlang bash -c "make coveralls"
         - uses: actions/upload-artifact@v1