| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- name: Run test case
- concurrency:
- group: test-${{ github.event_name }}-${{ github.ref }}
- cancel-in-progress: true
- on:
- workflow_call:
- inputs:
- runner:
- required: true
- type: string
- builder:
- required: true
- type: string
- ct-matrix:
- required: true
- type: string
- ct-host:
- required: true
- type: string
- ct-docker:
- required: true
- type: string
- env:
- IS_CI: "yes"
- jobs:
- eunit_and_proper:
- runs-on: ${{ inputs.runner }}
- 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: AutoModality/action-clean@v1
- - uses: actions/download-artifact@v3
- 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 }}
- CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}
- run: make eunit
- # produces proper.coverdata
- - name: proper
- env:
- PROFILE: ${{ matrix.profile }}
- CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}
- run: make proper
- - uses: actions/upload-artifact@v3
- with:
- name: coverdata
- path: _build/test/cover
- ct_docker:
- runs-on: ${{ inputs.runner }}
- name: "ct_docker (${{ matrix.app }}-${{ matrix.suitegroup }})"
- strategy:
- fail-fast: false
- matrix:
- include: ${{ fromJson(inputs.ct-docker) }}
- defaults:
- run:
- shell: bash
- steps:
- - uses: AutoModality/action-clean@v1
- - uses: actions/download-artifact@v3
- 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 }}
- CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
- run: ./scripts/ct/run.sh --ci --app ${{ matrix.app }}
- - uses: actions/upload-artifact@v3
- with:
- name: coverdata
- path: _build/test/cover
- - uses: actions/upload-artifact@v3
- if: failure()
- with:
- name: logs-${{ matrix.profile }}-${{ matrix.prefix }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
- path: _build/test/logs
- ct:
- runs-on: ${{ inputs.runner }}
- name: "ct (${{ matrix.app }}-${{ matrix.suitegroup }})"
- 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: AutoModality/action-clean@v1
- - uses: actions/download-artifact@v3
- 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 }}
- CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
- run: |
- make "${{ matrix.app }}-ct"
- - uses: actions/upload-artifact@v3
- with:
- name: coverdata
- path: _build/test/cover
- if-no-files-found: warn # do not fail if no coverdata found
- - uses: actions/upload-artifact@v3
- if: failure()
- with:
- name: logs-${{ matrix.profile }}-${{ matrix.prefix }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
- path: _build/test/logs
- tests_passed:
- needs:
- - eunit_and_proper
- - ct
- - ct_docker
- runs-on: ${{ inputs.runner }}
- strategy:
- fail-fast: false
- steps:
- - run: echo "All tests passed"
- make_cover:
- needs:
- - eunit_and_proper
- - ct
- - ct_docker
- runs-on: ${{ inputs.runner }}
- container: ${{ inputs.builder }}
- strategy:
- fail-fast: false
- matrix:
- profile:
- - emqx-enterprise
- steps:
- - uses: AutoModality/action-clean@v1
- - uses: actions/download-artifact@v3
- 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@v3
- name: download coverdata
- with:
- name: coverdata
- path: _build/test/cover
- - 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: ${{ inputs.runner }}
- 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
|