Преглед на файлове

ci: run static checks in separate jobs

So that prepare jobs would finish earlier and CI would give
faster feedback. Also point cache action at the correct location
of the PLT file.
Andrew Mayorov преди 2 години
родител
ревизия
827cd79eca
променени са 2 файла, в които са добавени 34 реда и са изтрити 10 реда
  1. 29 8
      .github/workflows/run_test_cases.yaml
  2. 5 2
      Makefile

+ 29 - 8
.github/workflows/run_test_cases.yaml

@@ -72,21 +72,14 @@ jobs:
       - uses: actions/checkout@v3
       - uses: actions/checkout@v3
         with:
         with:
           path: source
           path: source
-      - uses: actions/cache@v3
-        id: cache
-        with:
-          path: "$HOME/.cache/rebar3/rebar3_${{ matrix.otp }}_plt"
-          key: rebar3-dialyzer-plt-${{ matrix.otp }}
       - name: get_all_deps
       - name: get_all_deps
         working-directory: source
         working-directory: source
         env:
         env:
           PROFILE: ${{ matrix.profile }}
           PROFILE: ${{ matrix.profile }}
-            #DIAGNOSTIC: 1
         run: |
         run: |
           make ensure-rebar3
           make ensure-rebar3
           # fetch all deps and compile
           # fetch all deps and compile
-          make ${{ matrix.profile }}
-          make static_checks
+          make ${{ matrix.profile }}-compile
           make test-compile
           make test-compile
           cd ..
           cd ..
           zip -ryq source.zip source/* source/.[^.]*
           zip -ryq source.zip source/* source/.[^.]*
@@ -95,6 +88,34 @@ jobs:
           name: source-${{ matrix.profile }}-${{ matrix.otp }}
           name: source-${{ matrix.profile }}-${{ matrix.otp }}
           path: source.zip
           path: source.zip
 
 
+  static_checks:
+    needs:
+      - build-matrix
+      - prepare
+    runs-on: ${{ needs.build-matrix.outputs.runs-on }}
+    strategy:
+      fail-fast: false
+      matrix:
+        include: ${{ fromJson(needs.build-matrix.outputs.prepare) }}
+    container: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-ubuntu22.04"
+    steps:
+      - uses: AutoModality/action-clean@v1
+      - uses: actions/download-artifact@v3
+        with:
+          name: source-${{ matrix.profile }}-${{ matrix.otp }}
+          path: .
+      - name: unzip source code
+        run: unzip -o -q source.zip
+      - uses: actions/cache@v3
+        with:
+          path: "source/emqx_dialyzer_${{ matrix.otp }}_plt"
+          key: rebar3-dialyzer-plt-${{ matrix.profile }}-${{ matrix.otp }}
+      - name: run static checks
+        env:
+          PROFILE: ${{ matrix.profile }}
+        working-directory: source
+        run: make static_checks
+
   eunit_and_proper:
   eunit_and_proper:
     needs:
     needs:
       - build-matrix
       - build-matrix

+ 5 - 2
Makefile

@@ -74,6 +74,10 @@ proper: $(REBAR)
 test-compile: $(REBAR) merge-config
 test-compile: $(REBAR) merge-config
 	$(REBAR) as test compile
 	$(REBAR) as test compile
 
 
+.PHONY: $(REL_PROFILES:%=%-compile)
+$(REL_PROFILES:%=%-compile): $(REBAR) merge-config
+	$(REBAR) as $(@:%-compile=%) compile
+
 .PHONY: ct
 .PHONY: ct
 ct: $(REBAR) merge-config
 ct: $(REBAR) merge-config
 	@ENABLE_COVER_COMPILE=1 $(REBAR) ct --name $(CT_NODE_NAME) -c -v --cover_export_name $(CT_COVER_EXPORT_PREFIX)-ct
 	@ENABLE_COVER_COMPILE=1 $(REBAR) ct --name $(CT_NODE_NAME) -c -v --cover_export_name $(CT_COVER_EXPORT_PREFIX)-ct
@@ -89,10 +93,9 @@ APPS=$(shell $(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) merge-config
 	$(eval SUITES := $(shell $(SCRIPTS)/find-suites.sh $1))
 	$(eval SUITES := $(shell $(SCRIPTS)/find-suites.sh $1))
 ifneq ($(SUITES),)
 ifneq ($(SUITES),)
-		@$(SCRIPTS)/pre-compile.sh $(PROFILE)
 		@ENABLE_COVER_COMPILE=1 $(REBAR) ct -c -v \
 		@ENABLE_COVER_COMPILE=1 $(REBAR) ct -c -v \
 			--readable=$(CT_READABLE) \
 			--readable=$(CT_READABLE) \
 			--name $(CT_NODE_NAME) \
 			--name $(CT_NODE_NAME) \