| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- 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: ${{ inputs.builder }}
- env:
- PROFILE: ${{ matrix.profile }}
- ENABLE_COVER_COMPILE: 1
- CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}
- steps:
- - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
- 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
- - run: make eunit
- # produces proper.coverdata
- - run: make proper
- - run: make cover
- - name: send to coveralls
- if: github.repository == 'emqx/emqx'
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: make coveralls
- - run: cat rebar3.crashdump || true
- if: failure()
- 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
- env:
- PROFILE: ${{ matrix.profile }}
- steps:
- - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
- with:
- name: ${{ matrix.profile }}
- - name: extract artifact
- run: |
- unzip -o -q ${{ matrix.profile }}.zip
- # produces $PROFILE-<app-name>-<otp-vsn>-sg<suitegroup>.coverdata
- - name: run common tests
- env:
- DOCKER_CT_RUNNER_IMAGE: ${{ inputs.builder }}
- 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"
- SUITEGROUP: ${{ matrix.suitegroup }}
- ENABLE_COVER_COMPILE: 1
- CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-sg${{ matrix.suitegroup }}
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: ./scripts/ct/run.sh --ci --app ${{ matrix.app }} --keep-up
- - name: make cover
- run: |
- docker exec -e PROFILE="$PROFILE" -t erlang make cover
- - name: send to coveralls
- if: github.repository == 'emqx/emqx'
- run: |
- ls _build/test/cover/*.coverdata || exit 0
- docker exec -e PROFILE="$PROFILE" -t erlang make coveralls
- - name: rebar3.crashdump
- if: failure()
- run: cat rebar3.crashdump || true
- - name: compress logs
- if: failure()
- run: tar -czf logs.tar.gz _build/test/logs
- - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
- if: failure()
- with:
- name: logs-${{ matrix.profile }}-${{ matrix.prefix }}-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: ${{ inputs.builder }}
- defaults:
- run:
- shell: bash
- env:
- PROFILE: ${{ matrix.profile }}
- SUITEGROUP: ${{ matrix.suitegroup }}
- ENABLE_COVER_COMPILE: 1
- CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-sg${{ matrix.suitegroup }}
- steps:
- - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
- 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
- run: make "${{ matrix.app }}-ct"
- - run: make cover
- - name: send to coveralls
- if: github.repository == 'emqx/emqx'
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
- ls _build/test/cover/*.coverdata || exit 0
- make coveralls
- - run: cat rebar3.crashdump || true
- if: failure()
- - name: compress logs
- if: failure()
- run: tar -czf logs.tar.gz _build/test/logs
- - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
- if: failure()
- with:
- name: logs-${{ matrix.profile }}-${{ matrix.prefix }}-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
- permissions:
- pull-requests: write
- steps:
- - name: Coveralls finished
- if: github.repository == 'emqx/emqx'
- uses: coverallsapp/github-action@643bc377ffa44ace6394b2b5d0d3950076de9f63 # v2.3.0
- with:
- parallel-finished: true
- git-branch: ${{ github.ref }}
- git-commit: ${{ github.sha }}
- - run: echo "All tests passed"
|