Quellcode durchsuchen

ci: test all apps with dual profile

no need to test emqx-enterprise profile if the
EMQX_RELEASE_EDITION compilation flag is not used though
Zaiming (Stone) Shi vor 3 Jahren
Ursprung
Commit
fbb97b16be
3 geänderte Dateien mit 21 neuen und 7 gelöschten Zeilen
  1. 19 1
      .github/workflows/run_test_cases.yaml
  2. 1 5
      Makefile
  3. 1 1
      build

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

@@ -145,6 +145,10 @@ jobs:
           fail-fast: false
           fail-fast: false
           matrix:
           matrix:
             app_name: ${{ fromJson(needs.prepare.outputs.fast_ct_apps) }}
             app_name: ${{ fromJson(needs.prepare.outputs.fast_ct_apps) }}
+            profile:
+              - emqx
+              - emqx-enterprise
+
         runs-on: aws-amd64
         runs-on: aws-amd64
         container: "ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-ubuntu20.04"
         container: "ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-ubuntu20.04"
         defaults:
         defaults:
@@ -163,8 +167,22 @@ jobs:
           # produces <app-name>.coverdata
           # produces <app-name>.coverdata
         - name: run common test
         - name: run common test
           working-directory: source
           working-directory: source
+          env:
+            PROFILE: ${{ matrix.profile }}
+            WHICH_APP: ${{ matrix.app_name }}
           run: |
           run: |
-            make ${{ matrix.app_name }}-ct
+            if [ "$PROFILE" = 'emqx-enterprise' ]; then
+              COMPILE_FLAGS="$(grep -R "EMQX_RELEASE_EDITION" "$WHICH_APP" | wc -l || true)"
+              if [ "$COMPILE_FLAGS" -gt 0 ]; then
+                # need to clean first because the default profile was
+                make clean
+                make "${WHICH_APP}-ct"
+              else
+                echo "no_common_test_run_for_app ${WHICH_APP}"
+              fi
+            else
+              make "${WHICH_APP}-ct"
+            fi
         - uses: actions/upload-artifact@v1
         - uses: actions/upload-artifact@v1
           with:
           with:
             name: coverdata
             name: coverdata

+ 1 - 5
Makefile

@@ -79,11 +79,7 @@ APPS=$(shell $(CURDIR)/scripts/find-apps.sh)
 .PHONY: $(APPS:%=%-ct)
 .PHONY: $(APPS:%=%-ct)
 define gen-app-ct-target
 define gen-app-ct-target
 $1-ct: $(REBAR)
 $1-ct: $(REBAR)
-ifeq (,$(findstring lib-ee,$1))
-	@./scripts/pre-compile.sh emqx
-else
-	@./scripts/pre-compile.sh emqx-enterprise
-endif
+	@./scripts/pre-compile.sh $(PROFILE)
 	@ENABLE_COVER_COMPILE=1 $(REBAR) ct --name $(CT_NODE_NAME) -c -v --cover_export_name $(subst /,-,$1) --suite $(shell $(CURDIR)/scripts/find-suites.sh $1)
 	@ENABLE_COVER_COMPILE=1 $(REBAR) ct --name $(CT_NODE_NAME) -c -v --cover_export_name $(subst /,-,$1) --suite $(shell $(CURDIR)/scripts/find-suites.sh $1)
 endef
 endef
 $(foreach app,$(APPS),$(eval $(call gen-app-ct-target,$(app))))
 $(foreach app,$(APPS),$(eval $(call gen-app-ct-target,$(app))))

+ 1 - 1
build

@@ -106,7 +106,7 @@ assert_no_compile_time_only_deps() {
 }
 }
 
 
 make_rel() {
 make_rel() {
-    ./scripts/pre-compile.sh $PROFILE
+    ./scripts/pre-compile.sh "$PROFILE"
     # compile all beams
     # compile all beams
     ./rebar3 as "$PROFILE" compile
     ./rebar3 as "$PROFILE" compile
     # generate docs (require beam compiled), generated to etc and priv dirs
     # generate docs (require beam compiled), generated to etc and priv dirs