| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 |
- name: Run test case
- concurrency:
- group: test-${{ github.event_name }}-${{ github.ref }}
- cancel-in-progress: true
- on:
- push:
- branches:
- - '**'
- tags:
- - v*
- - e*
- pull_request:
- jobs:
- prepare:
- runs-on: aws-amd64
- # prepare source with any OTP version, no need for a matrix
- container: "ghcr.io/emqx/emqx-builder/5.0-18:1.13.4-24.3.4.2-1-ubuntu20.04"
- outputs:
- fast_ct_apps: ${{ steps.find_ct_apps.outputs.fast_ct_apps }}
- docker_ct_apps: ${{ steps.find_ct_apps.outputs.docker_ct_apps }}
- steps:
- - uses: AutoModality/action-clean@v1
- - uses: actions/checkout@v3
- with:
- path: source
- - name: Find CT Apps
- working-directory: source
- id: find_ct_apps
- run: |
- fast_ct_apps="$(./scripts/find-apps.sh --ci fast)"
- docker_ct_apps="$(./scripts/find-apps.sh --ci docker)"
- echo "fast: $fast_ct_apps"
- echo "docker: $docker_ct_apps"
- echo "::set-output name=fast_ct_apps::$fast_ct_apps"
- echo "::set-output name=docker_ct_apps::$docker_ct_apps"
- - name: get_all_deps
- working-directory: source
- env:
- PROFILE: emqx
- #DIAGNOSTIC: 1
- run: |
- make ensure-rebar3
- # fetch all deps and compile
- make emqx
- make test-compile
- cd ..
- zip -ryq source.zip source/* source/.[^.]*
- - uses: actions/upload-artifact@v3
- with:
- name: source-emqx
- path: source.zip
- prepare_ee:
- runs-on: aws-amd64
- # prepare source with any OTP version, no need for a matrix
- container: "ghcr.io/emqx/emqx-builder/5.0-18:1.13.4-24.3.4.2-1-ubuntu20.04"
- steps:
- - uses: AutoModality/action-clean@v1
- - uses: actions/checkout@v3
- with:
- path: source
- - name: get_all_deps
- working-directory: source
- env:
- PROFILE: emqx-enterprise
- #DIAGNOSTIC: 1
- run: |
- make ensure-rebar3
- # fetch all deps and compile
- make emqx-enterprise
- make test-compile
- cd ..
- zip -ryq source.zip source/* source/.[^.]*
- - uses: actions/upload-artifact@v3
- with:
- name: source-emqx-enterprise
- path: source.zip
- eunit_and_proper:
- needs:
- - prepare
- - prepare_ee
- runs-on: ${{ matrix.runs-on }}
- strategy:
- fail-fast: false
- matrix:
- profile:
- - emqx
- - emqx-enterprise
- runs-on:
- - aws-amd64
- - ubuntu-20.04
- use-self-hosted:
- - ${{ github.repository_owner == 'emqx' }}
- exclude:
- - runs-on: ubuntu-20.04
- use-self-hosted: true
- - runs-on: aws-amd64
- use-self-hosted: false
- defaults:
- run:
- shell: bash
- container: "ghcr.io/emqx/emqx-builder/5.0-18:1.13.4-24.3.4.2-1-ubuntu20.04"
- steps:
- - uses: AutoModality/action-clean@v1
- - uses: actions/download-artifact@v3
- with:
- name: source-${{ matrix.profile }}
- path: .
- - name: unzip source code
- env:
- PROFILE: ${{ matrix.profile }}
- run: unzip -o -q source.zip
- # produces eunit.coverdata
- - name: eunit
- env:
- PROFILE: ${{ matrix.profile }}
- working-directory: source
- run: make eunit
- # produces proper.coverdata
- - name: proper
- env:
- PROFILE: ${{ matrix.profile }}
- working-directory: source
- run: make proper
- - uses: actions/upload-artifact@v3
- with:
- name: coverdata
- path: source/_build/test/cover
- ct_docker:
- needs:
- - prepare
- - prepare_ee
- strategy:
- fail-fast: false
- matrix:
- app: ${{ fromJson(needs.prepare.outputs.docker_ct_apps) }}
- runs-on:
- - aws-amd64
- - ubuntu-20.04
- use-self-hosted:
- - ${{ github.repository_owner == 'emqx' }}
- exclude:
- - runs-on: ubuntu-20.04
- use-self-hosted: true
- - runs-on: aws-amd64
- use-self-hosted: false
- runs-on: ${{ matrix.runs-on }}
- defaults:
- run:
- shell: bash
- steps:
- - uses: AutoModality/action-clean@v1
- - uses: actions/download-artifact@v3
- with:
- name: source-${{ matrix.app[1] }}
- path: .
- - name: unzip source code
- run: unzip -q source.zip
- - name: run tests
- working-directory: source
- env:
- MONGO_TAG: 5
- MYSQL_TAG: 8
- PGSQL_TAG: 13
- REDIS_TAG: 6
- INFLUXDB_TAG: 2.5.0
- WHICH_APP: ${{ matrix.app[0] }}
- PROFILE: ${{ matrix.app[1] }}
- run: |
- echo $PROFILE
- rm _build/default/lib/rocksdb/_build/cmake/CMakeCache.txt
- ./scripts/ct/run.sh --app $WHICH_APP
- - uses: actions/upload-artifact@v3
- with:
- name: coverdata
- path: source/_build/test/cover
- - uses: actions/upload-artifact@v3
- if: failure()
- with:
- name: logs-${{ matrix.app[0] }}-${{ matrix.app[1] }}
- path: source/_build/test/logs
- ct:
- needs:
- - prepare
- - prepare_ee
- strategy:
- fail-fast: false
- matrix:
- app: ${{ fromJson(needs.prepare.outputs.fast_ct_apps) }}
- profile:
- - emqx
- - emqx-enterprise
- runs-on:
- - aws-amd64
- - ubuntu-20.04
- use-self-hosted:
- - ${{ github.repository_owner == 'emqx' }}
- exclude:
- - runs-on: ubuntu-20.04
- use-self-hosted: true
- - runs-on: aws-amd64
- use-self-hosted: false
- runs-on: ${{ matrix.runs-on }}
- container: "ghcr.io/emqx/emqx-builder/5.0-18:1.13.4-24.3.4.2-1-ubuntu20.04"
- defaults:
- run:
- shell: bash
- steps:
- - uses: AutoModality/action-clean@v1
- - uses: actions/download-artifact@v3
- with:
- name: source-${{ matrix.app[1] }}
- path: .
- - name: unzip source code
- run: unzip -q source.zip
- # produces $PROFILE-<app-name>.coverdata
- - name: run common test
- working-directory: source
- env:
- WHICH_APP: ${{ matrix.app[0] }}
- PROFILE: ${{ matrix.app[1] }}
- run: |
- make "${WHICH_APP}-ct"
- - uses: actions/upload-artifact@v3
- with:
- name: coverdata
- path: source/_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.app[0] }}-${{ matrix.app[1] }}
- path: source/_build/test/logs
- make_cover:
- needs:
- - eunit_and_proper
- - ct
- - ct_docker
- runs-on: ubuntu-20.04
- container: "ghcr.io/emqx/emqx-builder/5.0-18:1.13.4-24.3.4.2-1-ubuntu20.04"
- steps:
- - uses: AutoModality/action-clean@v1
- - uses: actions/download-artifact@v3
- with:
- name: source-emqx-enterprise
- path: .
- - name: unzip source code
- run: unzip -q source.zip
- - uses: actions/download-artifact@v3
- name: download coverdata
- with:
- name: coverdata
- path: source/_build/test/cover
- - name: make cover
- working-directory: source
- env:
- PROFILE: emqx-enterprise
- run: make cover
- - name: send to coveralls
- working-directory: source
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- PROFILE: emqx-enterprise
- run: make coveralls
- - name: get coveralls logs
- working-directory: source
- if: failure()
- run: cat rebar3.crashdump
- # do this in a separate job
- upload_coverdata:
- needs: make_cover
- runs-on: ubuntu-20.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
|