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
This commit is contained in:
Zaiming (Stone) Shi 2022-08-12 14:18:55 +02:00
parent c82a05a0e7
commit fbb97b16be
3 changed files with 21 additions and 7 deletions

View File

@ -145,6 +145,10 @@ jobs:
fail-fast: false
matrix:
app_name: ${{ fromJson(needs.prepare.outputs.fast_ct_apps) }}
profile:
- emqx
- emqx-enterprise
runs-on: aws-amd64
container: "ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-ubuntu20.04"
defaults:
@ -163,8 +167,22 @@ jobs:
# produces <app-name>.coverdata
- name: run common test
working-directory: source
env:
PROFILE: ${{ matrix.profile }}
WHICH_APP: ${{ matrix.app_name }}
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
with:
name: coverdata

View File

@ -79,11 +79,7 @@ APPS=$(shell $(CURDIR)/scripts/find-apps.sh)
.PHONY: $(APPS:%=%-ct)
define gen-app-ct-target
$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)
endef
$(foreach app,$(APPS),$(eval $(call gen-app-ct-target,$(app))))

2
build
View File

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