Skip to content

Commit

Permalink
Merge cd34777 into 4403b4f
Browse files Browse the repository at this point in the history
  • Loading branch information
id committed May 8, 2024
2 parents 4403b4f + cd34777 commit 3545a3f
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 98 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/_pr_entrypoint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ on:
env:
IS_CI: "yes"

permissions:
contents: read

jobs:
sanity-checks:
runs-on: ubuntu-22.04
Expand All @@ -32,6 +29,9 @@ jobs:
otp_vsn: "26.2.1-2"
elixir_vsn: "1.15.7"

permissions:
contents: read

steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
Expand Down Expand Up @@ -127,6 +127,9 @@ jobs:
- emqx
- emqx-enterprise

permissions:
contents: read

steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/_push-entrypoint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ on:
- 'master'
- 'release-5[0-9]'
- 'ci/**'

permissions:
contents: read
workflow_dispatch:
inputs:
ref:
required: false

env:
IS_CI: 'yes'
Expand All @@ -36,6 +37,9 @@ jobs:
otp_vsn: '26.2.1-2'
elixir_vsn: '1.15.7'

permissions:
contents: read

steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
Expand Down Expand Up @@ -132,6 +136,9 @@ jobs:
- emqx
- emqx-enterprise

permissions:
contents: read

steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
Expand Down
170 changes: 78 additions & 92 deletions .github/workflows/run_test_cases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ on:
required: true
type: string

permissions:
contents: read

env:
IS_CI: "yes"

Expand All @@ -40,35 +37,39 @@ jobs:
shell: bash
container: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-ubuntu22.04"

env:
PROFILE: ${{ matrix.profile }}
ENABLE_COVER_COMPILE: 1
CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}

permissions:
contents: read

steps:
- uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
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
- run: make eunit

# produces proper.coverdata
- name: proper
- run: make proper

- run: make cover

- name: send to coveralls
if: github.repository == 'emqx/emqx'
env:
PROFILE: ${{ matrix.profile }}
ENABLE_COVER_COMPILE: 1
CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}
run: make proper
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make coveralls

- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: coverdata-${{ matrix.profile }}-${{ matrix.otp }}
path: _build/test/cover
retention-days: 7
- run: cat rebar3.crashdump
if: failure()

ct_docker:
runs-on: ${{ github.repository_owner == 'emqx' && fromJSON('["self-hosted","ephemeral","linux","x64"]') || 'ubuntu-22.04' }}
Expand All @@ -82,14 +83,19 @@ jobs:
run:
shell: bash

env:
PROFILE: ${{ matrix.profile }}

permissions:
contents: read

steps:
- uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
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
Expand All @@ -103,19 +109,30 @@ jobs:
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@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: coverdata-${{ matrix.profile }}-${{ matrix.prefix }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
path: _build/test/cover
retention-days: 7
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

- name: compress logs
if: failure()
run: tar -czf logs.tar.gz _build/test/logs

- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
if: failure()
with:
Expand All @@ -137,6 +154,15 @@ jobs:
run:
shell: bash

permissions:
contents: read

env:
PROFILE: ${{ matrix.profile }}
SUITEGROUP: ${{ matrix.suitegroup }}
ENABLE_COVER_COMPILE: 1
CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}

steps:
- uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
with:
Expand All @@ -148,22 +174,25 @@ jobs:
# 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:
PROFILE: ${{ matrix.profile }}
SUITEGROUP: ${{ matrix.suitegroup }}
ENABLE_COVER_COMPILE: 1
CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
make "${{ matrix.app }}-ct"
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: coverdata-${{ matrix.profile }}-${{ matrix.prefix }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
path: _build/test/cover
if-no-files-found: warn # do not fail if no coverdata found
retention-days: 7
ls _build/test/cover/*.coverdata || exit 0
make coveralls
- run: cat rebar3.crashdump
if: failure()

- name: compress logs
if: failure()
run: tar -czf logs.tar.gz _build/test/logs

- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
if: failure()
with:
Expand All @@ -180,61 +209,18 @@ jobs:
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@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
with:
name: ${{ matrix.profile }}
- name: extract artifact
run: |
unzip -o -q ${{ matrix.profile }}.zip
git config --global --add safe.directory "$GITHUB_WORKSPACE"
permissions:
pull-requests: write

- uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
name: download coverdata
steps:
- name: Coveralls finished
if: github.repository == 'emqx/emqx'
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 # v2.2.3
with:
pattern: coverdata-${{ matrix.profile }}-*
path: _build/test/cover
merge-multiple: true
parallel-finished: true
git-branch: ${{ github.ref }}
git-commit: ${{ github.sha }}

- 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
- run: echo "All tests passed"

0 comments on commit 3545a3f

Please sign in to comment.