235 lines
7.0 KiB
YAML
235 lines
7.0 KiB
YAML
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
|
|
|
|
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@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 }}
|
|
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@v3
|
|
with:
|
|
name: coverdata
|
|
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@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 }}
|
|
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@v3
|
|
with:
|
|
name: coverdata
|
|
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@v3
|
|
if: failure()
|
|
with:
|
|
name: logs-${{ matrix.profile }}-${{ matrix.prefix }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
|
|
path: logs.tar.gz
|
|
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@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 }}
|
|
ENABLE_COVER_COMPILE: 1
|
|
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
|
|
retention-days: 7
|
|
- name: compress logs
|
|
if: failure()
|
|
run: tar -czf logs.tar.gz _build/test/logs
|
|
- uses: actions/upload-artifact@v3
|
|
if: failure()
|
|
with:
|
|
name: logs-${{ matrix.profile }}-${{ matrix.prefix }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
|
|
path: logs.tar.gz
|
|
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@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: 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
|