ci: refactor, find-app.sh produced matrix

This commit is contained in:
Zaiming (Stone) Shi 2022-11-18 19:22:02 +01:00
parent 06cb7aeb48
commit aeac9bf43f
1 changed files with 28 additions and 54 deletions

View File

@ -14,27 +14,27 @@ on:
pull_request: pull_request:
jobs: jobs:
prepare_ce: prepare:
runs-on: aws-amd64 runs-on: aws-amd64
# prepare source with any OTP version, no need for a matrix # prepare source with any OTP version, no need for a matrix
container: "ghcr.io/emqx/emqx-builder/5.0-18:1.13.4-24.3.4.2-1-ubuntu20.04" container: "ghcr.io/emqx/emqx-builder/5.0-18:1.13.4-24.3.4.2-1-ubuntu20.04"
outputs: outputs:
fast_ct_apps: ${{ steps.run_find_apps.outputs.fast_ct_apps }} fast_ct_apps: ${{ steps.find_ct_apps.outputs.fast_ct_apps }}
docker_ct_apps: ${{ steps.run_find_apps.outputs.docker_ct_apps }} docker_ct_apps: ${{ steps.find_ct_apps.outputs.docker_ct_apps }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
path: source path: source
- name: find_ct_apps - name: Find CT Apps
working-directory: source working-directory: source
id: run_find_apps id: find_ct_apps
run: | run: |
fast_ct_apps="$(./scripts/find-apps.sh --ct fast --json)" fast_ct_apps="$(./scripts/find-apps.sh --ci fast)"
docker_ct_apps="$(./scripts/find-apps.sh --ct docker --json)" docker_ct_apps="$(./scripts/find-apps.sh --ci docker)"
echo "fast-ct-apps: $fast_ct_apps" echo "fast: $fast_ct_apps"
echo "docer-ct-apps: $docker_ct_apps" echo "docker: $docker_ct_apps"
echo "::set-output name=fast_ct_apps_ce::$fast_ct_apps" echo "::set-output name=fast_ct_apps::$fast_ct_apps"
echo "::set-output name=docker_ct_apps_ce::$docker_ct_apps" echo "::set-output name=docker_ct_apps::$docker_ct_apps"
- name: get_all_deps - name: get_all_deps
working-directory: source working-directory: source
env: env:
@ -55,23 +55,10 @@ jobs:
runs-on: aws-amd64 runs-on: aws-amd64
# prepare source with any OTP version, no need for a matrix # prepare source with any OTP version, no need for a matrix
container: "ghcr.io/emqx/emqx-builder/5.0-18:1.13.4-24.3.4.2-1-ubuntu20.04" container: "ghcr.io/emqx/emqx-builder/5.0-18:1.13.4-24.3.4.2-1-ubuntu20.04"
outputs:
fast_ct_apps: ${{ steps.run_find_apps.outputs.fast_ct_apps }}
docker_ct_apps: ${{ steps.run_find_apps.outputs.docker_ct_apps }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
path: source path: source
- name: find_ct_apps
working-directory: source
id: run_find_apps
run: |
fast_ct_apps="$(./scripts/find-apps.sh --ct fast --json)"
docker_ct_apps="$(./scripts/find-apps.sh --ct docker --json)"
echo "fast-ct-apps: $fast_ct_apps"
echo "docer-ct-apps: $docker_ct_apps"
echo "::set-output name=fast_ct_apps_ee::$fast_ct_apps"
echo "::set-output name=docker_ct_apps_ee::$docker_ct_apps"
- name: get_all_deps - name: get_all_deps
working-directory: source working-directory: source
env: env:
@ -90,8 +77,8 @@ jobs:
eunit_and_proper: eunit_and_proper:
needs: needs:
- prepare
- prepare_ee - prepare_ee
- prepare_ce
runs-on: aws-amd64 runs-on: aws-amd64
strategy: strategy:
fail-fast: false fail-fast: false
@ -135,15 +122,12 @@ jobs:
ct_docker: ct_docker:
needs: needs:
- prepare
- prepare_ee - prepare_ee
- prepare_ce
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
profile: app: ${{ fromJson(needs.prepare.outputs.docker_ct_apps) }}
- emqx
- emqx-enterprise
app_name: ${{ fromJson(needs.prepare.outputs.docker_ct_apps) }}
otp_release: otp_release:
- "erlang24" - "erlang24"
@ -156,7 +140,7 @@ jobs:
- uses: AutoModality/action-clean@v1 - uses: AutoModality/action-clean@v1
- uses: actions/download-artifact@v3 - uses: actions/download-artifact@v3
with: with:
name: source-${{ matrix.profile }} name: source-${{ matrix.app[1] }}
path: . path: .
- name: unzip source code - name: unzip source code
run: unzip -q source.zip run: unzip -q source.zip
@ -167,9 +151,12 @@ jobs:
MYSQL_TAG: 8 MYSQL_TAG: 8
PGSQL_TAG: 13 PGSQL_TAG: 13
REDIS_TAG: 6 REDIS_TAG: 6
WHICH_APP: ${{ matrix.app[0] }}
PROFILE: ${{ matrix.app[1] }}
run: | run: |
echo $PROFILE
rm _build/default/lib/rocksdb/_build/cmake/CMakeCache.txt rm _build/default/lib/rocksdb/_build/cmake/CMakeCache.txt
./scripts/ct/run.sh --app ${{ matrix.app_name }} ./scripts/ct/run.sh --app $WHICH_APP
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:
name: coverdata name: coverdata
@ -177,21 +164,17 @@ jobs:
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
if: failure() if: failure()
with: with:
name: logs_${{ matrix.otp_release }}-${{ matrix.profile }} name: logs_${{ matrix.otp_release }}-${{ matrix.app[0] }}-${{ matrix.app[1] }}
path: source/_build/test/logs path: source/_build/test/logs
ct: ct:
needs: needs:
- prepare
- prepare_ee - prepare_ee
- prepare_ce
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
app_name: ${{ fromJson(needs.prepare.outputs.fast_ct_apps) }} app: ${{ 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-18:1.13.4-24.3.4.2-1-ubuntu20.04" container: "ghcr.io/emqx/emqx-builder/5.0-18:1.13.4-24.3.4.2-1-ubuntu20.04"
defaults: defaults:
@ -202,28 +185,19 @@ jobs:
- uses: AutoModality/action-clean@v1 - uses: AutoModality/action-clean@v1
- uses: actions/download-artifact@v3 - uses: actions/download-artifact@v3
with: with:
name: source-${{ matrix.profile }} name: source-${{ matrix.app[1] }}
path: . path: .
- name: unzip source code - name: unzip source code
run: unzip -q source.zip run: unzip -q source.zip
# produces <app-name>.coverdata # produces $PROFILE-<app-name>.coverdata
- name: run common test - name: run common test
working-directory: source working-directory: source
env: env:
PROFILE: ${{ matrix.profile }} WHICH_APP: ${{ matrix.app[0] }}
WHICH_APP: ${{ matrix.app_name }} PROFILE: ${{ matrix.app[1] }}
run: | run: |
if [[ "$PROFILE" != 'emqx-enterprise' ]]; then
case "$WHICH_APP" in
lib-ee/*)
echo "skip_opensource_edition_test_for_lib-ee"
;;
*)
make "${WHICH_APP}-ct" make "${WHICH_APP}-ct"
;;
esac
fi
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:
name: coverdata name: coverdata
@ -232,7 +206,7 @@ jobs:
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
if: failure() if: failure()
with: with:
name: logs_${{ matrix.otp_release }}-${{ matrix.profile }} name: logs_${{ matrix.otp_release }}-${{ matrix.app[0] }}-${{ matrix.app[1] }}
path: source/_build/test/logs path: source/_build/test/logs
make_cover: make_cover: