Преглед изворни кода

chore(CI): app test workflows support enterprose repo

zhanghongtong пре 4 година
родитељ
комит
be4faa6d7c

.ci/apps_tests/.env → .ci/apps_tests/.opensource.env


+ 6 - 1
.ci/apps_tests/docker-compose.yaml

@@ -1,4 +1,4 @@
-version: '3'
+version: '3.9'
 
 services:
   erlang:
@@ -26,6 +26,11 @@ services:
       - ../../.:/emqx
     working_dir: /emqx
     tty: true
+    deploy:
+      resources:
+        reservations:
+          cpus: '0.5'
+          memory: 500M
 
   mysql_server:
     container_name: mysql

+ 6 - 5
.github/workflows/run_cts_tests.yaml

@@ -250,13 +250,16 @@ jobs:
         node_type:
         - single
         - cluster
+        exclude:
+        - redis_tag: 5
+          connect_type: tls
 
     steps:
       - uses: actions/checkout@v1
       - name: setup
         env:
           REDIS_TAG: ${{ matrix.redis_tag }}
-        if: matrix.connect_type == 'tls' && matrix.redis_tag != '5'
+        if: matrix.connect_type == 'tls'
         run: |
           set -exu
           docker-compose -f .ci/compatibility_tests/docker-compose-redis-${{ matrix.node_type }}-tls.yaml up -d
@@ -274,7 +277,6 @@ jobs:
           docker-compose -f .ci/compatibility_tests/docker-compose-redis-${{ matrix.node_type }}.yaml up -d
           echo EMQX_AUTH__REDIS__SSL=off >> "$GITHUB_ENV"
       - name: get server address
-        if: matrix.connect_type == 'tcp' || (matrix.connect_type == 'tls' && matrix.redis_tag != '5')
         run: |
           set -exu
           ipv4_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' redis)
@@ -292,7 +294,7 @@ jobs:
           EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:6379
           EOF
       - name: setup
-        if: matrix.node_type == 'single' && matrix.connect_type == 'tls' && matrix.redis_tag != '5'
+        if: matrix.node_type == 'single' && matrix.connect_type == 'tls'
         run: |
           set -exu
           cat <<-EOF >> "$GITHUB_ENV"
@@ -308,7 +310,7 @@ jobs:
           EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:7000
           EOF
       - name: setup
-        if: matrix.node_type == 'cluster' && matrix.connect_type == 'tls' && matrix.redis_tag != '5'
+        if: matrix.node_type == 'cluster' && matrix.connect_type == 'tls'
         run: |
           set -exu
           cat <<-EOF >> "$GITHUB_ENV"
@@ -316,7 +318,6 @@ jobs:
           EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:8000
           EOF
       - name: run test cases
-        if: matrix.connect_type == 'tcp' || (matrix.connect_type == 'tls' && matrix.redis_tag != '5')
         run: |
           export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
           printenv > .env

+ 37 - 1
.github/workflows/run_test_cases.yaml

@@ -16,6 +16,12 @@ jobs:
 
         steps:
         - uses: actions/checkout@v2
+        - name: set git credentials
+          run: |
+            if make emqx-ee --dry-run > /dev/null 2>&1; then
+              echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
+              git config --global credential.helper store
+            fi
         - name: xref
           run: make xref
         - name: dialyzer
@@ -26,7 +32,16 @@ jobs:
 
         steps:
         - uses: actions/checkout@v2
-        - name: set up
+        - name: set edition
+          id: set_edition
+          run: |
+            if make emqx-ee --dry-run > /dev/null 2>&1; then
+                echo "EDITION=enterprise" >> $GITHUB_ENV
+            else
+                echo "EDITION=opensource" >> $GITHUB_ENV
+            fi
+        - name: docker compose up
+          if: env.EDITION == 'opensource'
           env:
             MYSQL_TAG: 8
             REDIS_TAG: 6
@@ -37,6 +52,27 @@ 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: docker compose up
+          if: env.EDITION == 'enterprise'
+          env:
+            MYSQL_TAG: 8
+            REDIS_TAG: 6
+            MONGO_TAG: 4
+            PGSQL_TAG: 13
+            LDAP_TAG: 2.4.50
+            OPENTSDB_TAG: latest
+            INFLUXDB_TAG: 1.7.6
+            DYNAMODB_TAG: 1.11.477
+            TIMESCALE_TAG: latest-pg11
+            CASSANDRA_TAG: 3.11.6
+            RABBITMQ_TAG: 3.7
+            KAFKA_TAG: 2.5.0
+            PULSAR_TAG: 2.3.2
+            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          run: |
+            docker-compose -f .ci/apps_tests/docker-compose.yaml -f .ci/apps_tests/docker-compose.enterprise.yaml build --no-cache
+            docker-compose -f .ci/apps_tests/docker-compose.yaml -f .ci/apps_tests/docker-compose.enterprise.yaml up -d
+            docker exec -i erlang bash -c "echo \"https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com\" > /root/.git-credentials && git config --global credential.helper store"
         - name: run eunit
           run: |
             docker exec -i erlang bash -c "make eunit"