224 lines
6.5 KiB
YAML
224 lines
6.5 KiB
YAML
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:
|
|
eunit_and_proper:
|
|
strategy:
|
|
matrix:
|
|
otp:
|
|
- 24.2.1-1
|
|
elixir:
|
|
- 1.13.3
|
|
os:
|
|
- ubuntu20.04
|
|
arch:
|
|
- amd64
|
|
|
|
runs-on: ubuntu-20.04
|
|
container: "ghcr.io/emqx/emqx-builder/5.0-10:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Get deps git refs for cache
|
|
id: deps-refs
|
|
run: |
|
|
scripts/get-dep-refs.sh
|
|
make clean-all
|
|
- name: load quicer cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: source/_build/default/lib/quicer/
|
|
key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
|
|
|
|
# produces eunit.coverdata
|
|
- name: eunit
|
|
run: make eunit
|
|
|
|
# produces proper.coverdata
|
|
- name: proper
|
|
run: make proper
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: coverdata
|
|
path: _build/test/cover
|
|
|
|
find_apps:
|
|
runs-on: ubuntu-20.04
|
|
container: ghcr.io/emqx/emqx-builder/5.0-10:1.13.3-24.2.1-1-ubuntu20.04
|
|
outputs:
|
|
fast_ct_apps: ${{ steps.run_find_apps.outputs.fast_ct_apps }}
|
|
docker_ct_apps: ${{ steps.run_find_apps.outputs.docker_ct_apps }}
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: find apps
|
|
id: run_find_apps
|
|
run: |
|
|
fast_ct_apps="$(./scripts/find-apps.sh --ct fast --json)"
|
|
docker_ct_apps="$(./scripts/find-apps.sh --ct docker --json)"
|
|
echo "::set-output name=fast_ct_apps::$fast_ct_apps"
|
|
echo "::set-output name=docker_ct_apps::$docker_ct_apps"
|
|
|
|
ct_docker:
|
|
needs: find_apps
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
app_name: ${{ fromJson(needs.find_apps.outputs.docker_ct_apps) }}
|
|
otp_release:
|
|
- "erlang23"
|
|
- "erlang24"
|
|
|
|
runs-on: ubuntu-20.04
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: docker compose up
|
|
env:
|
|
MONGO_TAG: 5
|
|
MYSQL_TAG: 8
|
|
PGSQL_TAG: 13
|
|
REDIS_TAG: 6
|
|
run: |
|
|
docker-compose \
|
|
-f .ci/docker-compose-file/docker-compose-mongo-single-tcp.yaml \
|
|
-f .ci/docker-compose-file/docker-compose-mongo-single-tls.yaml \
|
|
-f .ci/docker-compose-file/docker-compose-mysql-tcp.yaml \
|
|
-f .ci/docker-compose-file/docker-compose-mysql-tls.yaml \
|
|
-f .ci/docker-compose-file/docker-compose-pgsql-tcp.yaml \
|
|
-f .ci/docker-compose-file/docker-compose-pgsql-tls.yaml \
|
|
-f .ci/docker-compose-file/docker-compose-redis-single-tcp.yaml \
|
|
-f .ci/docker-compose-file/docker-compose-redis-single-tls.yaml \
|
|
-f .ci/docker-compose-file/docker-compose.yaml \
|
|
up -d --build
|
|
|
|
# produces <app-name>.coverdata
|
|
- name: run common test
|
|
run: |
|
|
docker exec -i ${{ matrix.otp_release }} bash -c "make ${{ matrix.app_name }}-ct"
|
|
- uses: actions/upload-artifact@v1
|
|
if: matrix.otp_release == 'erlang24'
|
|
with:
|
|
name: coverdata
|
|
path: _build/test/cover
|
|
- uses: actions/upload-artifact@v1
|
|
if: failure()
|
|
with:
|
|
name: logs_${{ matrix.otp_release }}
|
|
path: _build/test/logs
|
|
|
|
ct:
|
|
needs: find_apps
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
app_name: ${{ fromJson(needs.find_apps.outputs.fast_ct_apps) }}
|
|
otp:
|
|
- 24.2.1-1
|
|
elixir:
|
|
- 1.13.3
|
|
os:
|
|
- ubuntu20.04
|
|
arch:
|
|
- amd64
|
|
runs-on: ubuntu-20.04
|
|
container: "ghcr.io/emqx/emqx-builder/5.0-10:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
# produces <app-name>.coverdata
|
|
- name: run common test
|
|
run: |
|
|
make ${{ matrix.app_name }}-ct
|
|
- uses: actions/upload-artifact@v1
|
|
if: matrix.otp == '24.2.1-1'
|
|
with:
|
|
name: coverdata
|
|
path: _build/test/cover
|
|
- uses: actions/upload-artifact@v1
|
|
if: failure()
|
|
with:
|
|
name: logs_${{ matrix.otp_release }}
|
|
path: _build/test/logs
|
|
|
|
make_cover:
|
|
needs:
|
|
- eunit_and_proper
|
|
- ct
|
|
- ct_docker
|
|
strategy:
|
|
matrix:
|
|
otp:
|
|
- 24.2.1-1
|
|
elixir:
|
|
- 1.13.3
|
|
os:
|
|
- ubuntu20.04
|
|
arch:
|
|
- amd64
|
|
|
|
runs-on: ubuntu-20.04
|
|
container: "ghcr.io/emqx/emqx-builder/5.0-10:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Get deps git refs for cache
|
|
id: deps-refs
|
|
run: |
|
|
scripts/get-dep-refs.sh
|
|
make clean-all
|
|
- name: load quicer cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: source/_build/default/lib/quicer/
|
|
key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
|
|
|
|
- uses: actions/download-artifact@v2
|
|
name: download coverdata
|
|
with:
|
|
name: coverdata
|
|
path: _build/test/cover
|
|
|
|
- name: make cover
|
|
run: make cover
|
|
|
|
- name: send to coveralls
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: make coveralls
|
|
|
|
# do this in a separate job
|
|
finish:
|
|
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
|