ci: make cover for emqx-enterprise only

This commit is contained in:
Ivan Dyachkov 2024-05-08 08:03:18 +02:00
parent 214d3427c3
commit 4c74b84b34
1 changed files with 34 additions and 88 deletions

View File

@ -37,8 +37,14 @@ jobs:
shell: bash shell: bash
container: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-ubuntu22.04" container: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-ubuntu22.04"
env:
PROFILE: ${{ matrix.profile }}
ENABLE_COVER_COMPILE: 1
CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}
permissions: permissions:
contents: read contents: read
pull_requests: write
steps: steps:
- uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
@ -49,46 +55,19 @@ jobs:
unzip -o -q ${{ matrix.profile }}.zip unzip -o -q ${{ matrix.profile }}.zip
git config --global --add safe.directory "$GITHUB_WORKSPACE" git config --global --add safe.directory "$GITHUB_WORKSPACE"
# produces eunit.coverdata # produces eunit.coverdata
- name: eunit - run: make eunit
env:
PROFILE: ${{ matrix.profile }}
ENABLE_COVER_COMPILE: 1
CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}
run: make eunit
# produces proper.coverdata # produces proper.coverdata
- name: proper - run: make proper
env:
PROFILE: ${{ matrix.profile }}
ENABLE_COVER_COMPILE: 1
CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}
run: make proper
- name: make cover - run: make cover
env: if: matrix.profile == 'emqx-enterprise'
PROFILE: ${{ matrix.profile }}
ENABLE_COVER_COMPILE: 1
CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}
run: make cover
- name: send to coveralls - run: make coveralls
if: github.repository == 'emqx/emqx' if: github.repository == 'emqx/emqx' && matrix.profile == 'emqx-enterprise'
env:
PROFILE: ${{ matrix.profile }}
ENABLE_COVER_COMPILE: 1
CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make coveralls
- name: get coveralls logs - run: cat rebar3.crashdump
if: failure() if: failure()
run: cat rebar3.crashdump
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: coverdata-${{ matrix.profile }}-${{ matrix.otp }}
path: _build/test/cover
retention-days: 7
ct_docker: ct_docker:
runs-on: ${{ github.repository_owner == 'emqx' && fromJSON('["self-hosted","ephemeral","linux","x64"]') || 'ubuntu-22.04' }} runs-on: ${{ github.repository_owner == 'emqx' && fromJSON('["self-hosted","ephemeral","linux","x64"]') || 'ubuntu-22.04' }}
@ -104,6 +83,7 @@ jobs:
permissions: permissions:
contents: read contents: read
pull_requests: write
env: env:
DOCKER_CT_RUNNER_IMAGE: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-ubuntu22.04" DOCKER_CT_RUNNER_IMAGE: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-ubuntu22.04"
@ -119,6 +99,7 @@ jobs:
SUITEGROUP: ${{ matrix.suitegroup }} SUITEGROUP: ${{ matrix.suitegroup }}
ENABLE_COVER_COMPILE: 1 ENABLE_COVER_COMPILE: 1
CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }} CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps: steps:
- uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
@ -130,45 +111,23 @@ jobs:
# produces $PROFILE-<app-name>-<otp-vsn>-sg<suitegroup>.coverdata # produces $PROFILE-<app-name>-<otp-vsn>-sg<suitegroup>.coverdata
- name: run common tests - name: run common tests
run: ./scripts/ct/run.sh --ci --app ${{ matrix.app }} run: ./scripts/ct/run.sh --ci --app ${{ matrix.app }} --keep-up
- name: make cover - name: make cover
if: matrix.profile == 'emqx-enterprise'
run: | run: |
./scripts/ct/run.sh --ci --app ${{ matrix.app }} --only-up docker exec -e PROFILE="$PROFILE" -t erlang make cover
docker exec \
-e IS_CI="$IS_CI" \
-e PROFILE="$PROFILE" \
-e CT_COVER_EXPORT_PREFIX="${CT_COVER_EXPORT_PREFIX:-}" \
-e BUILD_WITHOUT_QUIC=1 \
-t erlang make cover
./scripts/ct/run.sh --ci --app ${{ matrix.app }} --stop
- name: send to coveralls - name: send to coveralls
if: github.repository == 'emqx/emqx' if: github.repository == 'emqx/emqx' && matrix.profile == 'emqx-enterprise'
run: | run: |
ls _build/test/cover/*.coverdata || exit 0 ls _build/test/cover/*.coverdata || exit 0
./scripts/ct/run.sh --ci --app ${{ matrix.app }} --only-up docker exec -e PROFILE="$PROFILE" -t erlang make coveralls
docker exec \
-e IS_CI="$IS_CI" \
-e PROFILE="$PROFILE" \
-e GITHUB_ACTIONS=true \
-e GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" \
-e GITHUB_RUN_ID="${{ github.run_id }}" \
-e GITHUB_SHA="${{ github.sha }}" \
-e GITHUB_EVENT_NAME="${{ github.event_name }}" \
-t erlang make coveralls
./scripts/ct/run.sh --ci --app ${{ matrix.app }} --stop
- name: get coveralls logs - name: rebar3.crashdump
if: failure() if: failure()
run: cat rebar3.crashdump run: cat rebar3.crashdump
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: coverdata-${{ matrix.profile }}-${{ matrix.prefix }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
path: _build/test/cover
retention-days: 7
- name: compress logs - name: compress logs
if: failure() if: failure()
run: tar -czf logs.tar.gz _build/test/logs run: tar -czf logs.tar.gz _build/test/logs
@ -196,6 +155,13 @@ jobs:
permissions: permissions:
contents: read contents: read
pull_requests: write
env:
PROFILE: ${{ matrix.profile }}
SUITEGROUP: ${{ matrix.suitegroup }}
ENABLE_COVER_COMPILE: 1
CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
steps: steps:
- uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
@ -208,41 +174,21 @@ jobs:
# produces $PROFILE-<app-name>-<otp-vsn>-sg<suitegroup>.coverdata # produces $PROFILE-<app-name>-<otp-vsn>-sg<suitegroup>.coverdata
- name: run common tests - name: run common tests
env: run: make "${{ matrix.app }}-ct"
PROFILE: ${{ matrix.profile }}
SUITEGROUP: ${{ matrix.suitegroup }}
ENABLE_COVER_COMPILE: 1
CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
run: |
make "${{ matrix.app }}-ct"
- name: make cover - run: make cover
env: if: matrix.profile == 'emqx-enterprise'
PROFILE: ${{ matrix.profile }}
SUITEGROUP: ${{ matrix.suitegroup }}
ENABLE_COVER_COMPILE: 1
CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
run: make cover
- name: send to coveralls - name: send to coveralls
if: github.repository == 'emqx/emqx' if: github.repository == 'emqx/emqx' && matrix.profile == 'emqx-enterprise'
env: env:
PROFILE: ${{ matrix.profile }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
ls _build/test/cover/*.coverdata || exit 0 ls _build/test/cover/*.coverdata || exit 0
make coveralls make coveralls
- name: get coveralls logs - run: cat rebar3.crashdump
if: failure() if: failure()
run: cat rebar3.crashdump
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: coverdata-${{ matrix.profile }}-${{ matrix.prefix }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
path: _build/test/cover
if-no-files-found: warn # do not fail if no coverdata found
retention-days: 7
- name: compress logs - name: compress logs
if: failure() if: failure()
@ -256,7 +202,7 @@ jobs:
compression-level: 0 compression-level: 0
retention-days: 7 retention-days: 7
finish: tests_passed:
needs: needs:
- eunit_and_proper - eunit_and_proper
- ct - ct