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
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:
contents: read
pull_requests: write
steps:
- uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
@ -49,46 +55,19 @@ jobs:
unzip -o -q ${{ matrix.profile }}.zip
git config --global --add safe.directory "$GITHUB_WORKSPACE"
# produces eunit.coverdata
- name: eunit
env:
PROFILE: ${{ matrix.profile }}
ENABLE_COVER_COMPILE: 1
CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}
run: make eunit
- run: make eunit
# produces proper.coverdata
- name: proper
env:
PROFILE: ${{ matrix.profile }}
ENABLE_COVER_COMPILE: 1
CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}
run: make proper
- run: make proper
- name: make cover
env:
PROFILE: ${{ matrix.profile }}
ENABLE_COVER_COMPILE: 1
CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}
run: make cover
- run: make cover
if: matrix.profile == 'emqx-enterprise'
- name: send to coveralls
if: github.repository == 'emqx/emqx'
env:
PROFILE: ${{ matrix.profile }}
ENABLE_COVER_COMPILE: 1
CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make coveralls
- run: make coveralls
if: github.repository == 'emqx/emqx' && matrix.profile == 'emqx-enterprise'
- name: get coveralls logs
- run: cat rebar3.crashdump
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:
runs-on: ${{ github.repository_owner == 'emqx' && fromJSON('["self-hosted","ephemeral","linux","x64"]') || 'ubuntu-22.04' }}
@ -104,6 +83,7 @@ jobs:
permissions:
contents: read
pull_requests: write
env:
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 }}
ENABLE_COVER_COMPILE: 1
CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
@ -130,45 +111,23 @@ jobs:
# produces $PROFILE-<app-name>-<otp-vsn>-sg<suitegroup>.coverdata
- 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
if: matrix.profile == 'emqx-enterprise'
run: |
./scripts/ct/run.sh --ci --app ${{ matrix.app }} --only-up
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
docker exec -e PROFILE="$PROFILE" -t erlang make cover
- name: send to coveralls
if: github.repository == 'emqx/emqx'
if: github.repository == 'emqx/emqx' && matrix.profile == 'emqx-enterprise'
run: |
ls _build/test/cover/*.coverdata || exit 0
./scripts/ct/run.sh --ci --app ${{ matrix.app }} --only-up
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
docker exec -e PROFILE="$PROFILE" -t erlang make coveralls
- name: get coveralls logs
- name: rebar3.crashdump
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
retention-days: 7
- name: compress logs
if: failure()
run: tar -czf logs.tar.gz _build/test/logs
@ -196,6 +155,13 @@ jobs:
permissions:
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:
- uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
@ -208,41 +174,21 @@ jobs:
# produces $PROFILE-<app-name>-<otp-vsn>-sg<suitegroup>.coverdata
- name: run common tests
env:
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"
run: make "${{ matrix.app }}-ct"
- name: make cover
env:
PROFILE: ${{ matrix.profile }}
SUITEGROUP: ${{ matrix.suitegroup }}
ENABLE_COVER_COMPILE: 1
CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
run: make cover
- run: make cover
if: matrix.profile == 'emqx-enterprise'
- name: send to coveralls
if: github.repository == 'emqx/emqx'
if: github.repository == 'emqx/emqx' && matrix.profile == 'emqx-enterprise'
env:
PROFILE: ${{ matrix.profile }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ls _build/test/cover/*.coverdata || exit 0
make coveralls
- name: get coveralls logs
- run: cat rebar3.crashdump
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
if: failure()
@ -256,7 +202,7 @@ jobs:
compression-level: 0
retention-days: 7
finish:
tests_passed:
needs:
- eunit_and_proper
- ct