| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- name: Run test case
- concurrency:
- group: test-${{ github.event_name }}-${{ github.ref }}
- cancel-in-progress: true
- on:
- workflow_call:
- inputs:
- builder:
- required: true
- type: string
- ct-matrix:
- required: true
- type: string
- ct-host:
- required: true
- type: string
- ct-docker:
- required: true
- type: string
- permissions:
- contents: read
- env:
- IS_CI: "yes"
- jobs:
- eunit_and_proper:
- runs-on: ${{ github.repository_owner == 'emqx' && fromJSON('["self-hosted","ephemeral","linux","x64"]') || 'ubuntu-22.04' }}
- name: "eunit_and_proper (${{ matrix.profile }})"
- strategy:
- fail-fast: false
- matrix:
- include: ${{ fromJson(inputs.ct-matrix) }}
- defaults:
- run:
- shell: bash
- container: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-ubuntu22.04"
- steps:
- - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
- with:
- name: ${{ matrix.profile }}
- - name: extract artifact
- run: |
- 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
- # produces proper.coverdata
- - name: proper
- env:
- PROFILE: ${{ matrix.profile }}
- ENABLE_COVER_COMPILE: 1
- CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}
- run: make proper
- - 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' }}
- name: "${{ matrix.app }}-${{ matrix.suitegroup }} (${{ matrix.profile }})"
- strategy:
- fail-fast: false
- matrix:
- include: ${{ fromJson(inputs.ct-docker) }}
- defaults:
- run:
- shell: bash
- steps:
- - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
- with:
- name: ${{ matrix.profile }}
- - name: extract artifact
- run: |
- unzip -o -q ${{ matrix.profile }}.zip
- git config --global --add safe.directory "$GITHUB_WORKSPACE"
- # produces $PROFILE-<app-name>-<otp-vsn>-sg<suitegroup>.coverdata
- - name: run common tests
- env:
- DOCKER_CT_RUNNER_IMAGE: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-ubuntu22.04"
- MONGO_TAG: "5"
- MYSQL_TAG: "8"
- PGSQL_TAG: "13"
- REDIS_TAG: "7.0"
- INFLUXDB_TAG: "2.5.0"
- TDENGINE_TAG: "3.0.2.4"
- OPENTS_TAG: "9aa7f88"
- MINIO_TAG: "RELEASE.2023-03-20T20-16-18Z"
- PROFILE: ${{ matrix.profile }}
- SUITEGROUP: ${{ matrix.suitegroup }}
- ENABLE_COVER_COMPILE: 1
- CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
- run: ./scripts/ct/run.sh --ci --app ${{ matrix.app }}
- - 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
- - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
- if: failure()
- with:
- name: logs-${{ matrix.profile }}-${{ matrix.prefix }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
- path: logs.tar.gz
- compression-level: 0
- retention-days: 7
- ct:
- runs-on: ${{ github.repository_owner == 'emqx' && fromJSON('["self-hosted","ephemeral","linux","x64"]') || 'ubuntu-22.04' }}
- name: "${{ matrix.app }}-${{ matrix.suitegroup }} (${{ matrix.profile }})"
- strategy:
- fail-fast: false
- matrix:
- include: ${{ fromJson(inputs.ct-host) }}
- container: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-ubuntu22.04"
- defaults:
- run:
- shell: bash
- steps:
- - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
- with:
- name: ${{ matrix.profile }}
- - name: extract artifact
- run: |
- unzip -o -q ${{ matrix.profile }}.zip
- git config --global --add safe.directory "$GITHUB_WORKSPACE"
- # 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"
- - 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()
- run: tar -czf logs.tar.gz _build/test/logs
- - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
- if: failure()
- with:
- name: logs-${{ matrix.profile }}-${{ matrix.prefix }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
- path: logs.tar.gz
- compression-level: 0
- retention-days: 7
- tests_passed:
- needs:
- - eunit_and_proper
- - ct
- - ct_docker
- runs-on: ubuntu-22.04
- strategy:
- fail-fast: false
- steps:
- - run: echo "All tests passed"
- make_cover:
- needs:
- - eunit_and_proper
- - ct
- - ct_docker
- runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }}
- container: ${{ inputs.builder }}
- strategy:
- fail-fast: false
- matrix:
- profile:
- - emqx-enterprise
- steps:
- - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
- with:
- name: ${{ matrix.profile }}
- - name: extract artifact
- run: |
- unzip -o -q ${{ matrix.profile }}.zip
- git config --global --add safe.directory "$GITHUB_WORKSPACE"
- - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
- name: download coverdata
- with:
- pattern: coverdata-${{ matrix.profile }}-*
- path: _build/test/cover
- merge-multiple: true
- - name: make cover
- env:
- PROFILE: emqx-enterprise
- run: make cover
- - name: send to coveralls
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- PROFILE: emqx-enterprise
- run: make coveralls
- - name: get coveralls logs
- if: failure()
- run: cat rebar3.crashdump
- # do this in a separate job
- upload_coverdata:
- needs: make_cover
- runs-on: ubuntu-22.04
- steps:
- - name: Coveralls Finished
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
- curl -v -k https://coveralls.io/webhook \
- --header "Content-Type: application/json" \
- --data "{\"repo_name\":\"$GITHUB_REPOSITORY\",\"repo_token\":\"$GITHUB_TOKEN\",\"payload\":{\"build_num\":$GITHUB_RUN_ID,\"status\":\"done\"}}" || true
|