249 lines
8.5 KiB
YAML
249 lines
8.5 KiB
YAML
name: PR Entrypoint
|
|
|
|
concurrency:
|
|
group: pr-entrypoint-${{ github.event_name }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
on:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
inputs:
|
|
ref:
|
|
required: false
|
|
|
|
env:
|
|
IS_CI: "yes"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
sanity-checks:
|
|
runs-on: ubuntu-22.04
|
|
container: "ghcr.io/emqx/emqx-builder/5.3-2:1.15.7-26.2.1-2-ubuntu22.04"
|
|
outputs:
|
|
ct-matrix: ${{ steps.matrix.outputs.ct-matrix }}
|
|
ct-host: ${{ steps.matrix.outputs.ct-host }}
|
|
ct-docker: ${{ steps.matrix.outputs.ct-docker }}
|
|
version-emqx: ${{ steps.matrix.outputs.version-emqx }}
|
|
version-emqx-enterprise: ${{ steps.matrix.outputs.version-emqx-enterprise }}
|
|
builder: "ghcr.io/emqx/emqx-builder/5.3-2:1.15.7-26.2.1-2-ubuntu22.04"
|
|
builder_vsn: "5.3-2"
|
|
otp_vsn: "26.2.1-2"
|
|
elixir_vsn: "1.15.7"
|
|
|
|
steps:
|
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
|
with:
|
|
ref: ${{ github.event.inputs.ref }}
|
|
fetch-depth: 0
|
|
- name: Work around https://github.com/actions/checkout/issues/766
|
|
run: |
|
|
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
|
- name: Run gitlint
|
|
env:
|
|
BEFORE_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
|
|
AFTER_REF: ${{ github.sha }}
|
|
run: |
|
|
pip install gitlint
|
|
gitlint --commits $BEFORE_REF..$AFTER_REF --config .github/workflows/.gitlint
|
|
- name: Run shellcheck
|
|
run: |
|
|
DEBIAN_FRONTEND=noninteractive apt-get update -qy && apt-get install -qy shellcheck
|
|
./scripts/shellcheck.sh
|
|
- name: Run shell tests
|
|
run: |
|
|
DEBIAN_FRONTEND=noninteractive apt-get update -qy && apt-get install -qy shelltestrunner
|
|
scripts/shelltest/run_tests.sh
|
|
- name: Check workflow files
|
|
env:
|
|
ACTIONLINT_VSN: 1.6.25
|
|
run: |
|
|
wget -q https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VSN}/actionlint_${ACTIONLINT_VSN}_linux_$(dpkg --print-architecture).tar.gz -O actionlint.tar.gz
|
|
tar zxf actionlint.tar.gz actionlint
|
|
# TODO: enable shellcheck when all the current issues are fixed
|
|
./actionlint -color \
|
|
-shellcheck= \
|
|
-ignore 'label ".+" is unknown' \
|
|
-ignore 'value "emqx-enterprise" in "exclude"' \
|
|
-ignore 'value "emqx-enterprise-elixir" in "exclude"'
|
|
- name: Check line-break at EOF
|
|
run: |
|
|
./scripts/check-nl-at-eof.sh
|
|
- name: Check apps version
|
|
run: |
|
|
./scripts/apps-version-check.sh
|
|
- name: Setup mix
|
|
env:
|
|
MIX_ENV: emqx-enterprise
|
|
PROFILE: emqx-enterprise
|
|
run: |
|
|
mix local.hex --force --if-missing && mix local.rebar --force --if-missing
|
|
- name: Check formatting
|
|
env:
|
|
MIX_ENV: emqx-enterprise
|
|
PROFILE: emqx-enterprise
|
|
run: |
|
|
./scripts/check-format.sh
|
|
- name: Run elvis check
|
|
run: |
|
|
./scripts/elvis-check.sh $GITHUB_BASE_REF
|
|
- name: Generate CT Matrix
|
|
id: matrix
|
|
run: |
|
|
APPS="$(./scripts/find-apps.sh --ci)"
|
|
MATRIX="$(echo "${APPS}" | jq -c '
|
|
[
|
|
(.[] | select(.profile == "emqx") | . + {
|
|
builder: "5.3-2",
|
|
otp: "26.2.1-2",
|
|
elixir: "1.15.7"
|
|
}),
|
|
(.[] | select(.profile == "emqx-enterprise") | . + {
|
|
builder: "5.3-2",
|
|
otp: ["26.2.1-2"][],
|
|
elixir: "1.15.7"
|
|
})
|
|
]
|
|
')"
|
|
echo "${MATRIX}" | jq
|
|
CT_MATRIX="$(echo "${MATRIX}" | jq -c 'map({profile, builder, otp, elixir}) | unique')"
|
|
CT_HOST="$(echo "${MATRIX}" | jq -c 'map(select(.runner == "host"))')"
|
|
CT_DOCKER="$(echo "${MATRIX}" | jq -c 'map(select(.runner == "docker"))')"
|
|
echo "ct-matrix=${CT_MATRIX}" | tee -a $GITHUB_OUTPUT
|
|
echo "ct-host=${CT_HOST}" | tee -a $GITHUB_OUTPUT
|
|
echo "ct-docker=${CT_DOCKER}" | tee -a $GITHUB_OUTPUT
|
|
echo "version-emqx=$(./pkg-vsn.sh emqx)" | tee -a $GITHUB_OUTPUT
|
|
echo "version-emqx-enterprise=$(./pkg-vsn.sh emqx-enterprise)" | tee -a $GITHUB_OUTPUT
|
|
|
|
compile:
|
|
runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral-xl","linux","x64"]') }}
|
|
container: ${{ needs.sanity-checks.outputs.builder }}
|
|
needs:
|
|
- sanity-checks
|
|
strategy:
|
|
matrix:
|
|
profile:
|
|
- emqx
|
|
- emqx-enterprise
|
|
|
|
steps:
|
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Work around https://github.com/actions/checkout/issues/766
|
|
run: |
|
|
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
|
- id: compile
|
|
env:
|
|
PROFILE: ${{ matrix.profile }}
|
|
ENABLE_COVER_COMPILE: 1
|
|
run: |
|
|
make ensure-rebar3
|
|
make ${PROFILE}-compile test-compile
|
|
echo "PROFILE=${PROFILE}" | tee -a .env
|
|
echo "PKG_VSN=$(./pkg-vsn.sh ${PROFILE})" | tee -a .env
|
|
zip -ryq -x@.github/workflows/.zipignore $PROFILE.zip .
|
|
- uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0
|
|
with:
|
|
name: ${{ matrix.profile }}
|
|
path: ${{ matrix.profile }}.zip
|
|
retention-days: 1
|
|
|
|
run_emqx_app_tests:
|
|
needs:
|
|
- sanity-checks
|
|
- compile
|
|
uses: ./.github/workflows/run_emqx_app_tests.yaml
|
|
with:
|
|
builder: ${{ needs.sanity-checks.outputs.builder }}
|
|
before_ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
|
|
after_ref: ${{ github.sha }}
|
|
|
|
run_test_cases:
|
|
needs:
|
|
- sanity-checks
|
|
- compile
|
|
uses: ./.github/workflows/run_test_cases.yaml
|
|
with:
|
|
builder: ${{ needs.sanity-checks.outputs.builder }}
|
|
ct-matrix: ${{ needs.sanity-checks.outputs.ct-matrix }}
|
|
ct-host: ${{ needs.sanity-checks.outputs.ct-host }}
|
|
ct-docker: ${{ needs.sanity-checks.outputs.ct-docker }}
|
|
|
|
static_checks:
|
|
needs:
|
|
- sanity-checks
|
|
- compile
|
|
uses: ./.github/workflows/static_checks.yaml
|
|
with:
|
|
builder: ${{ needs.sanity-checks.outputs.builder }}
|
|
ct-matrix: ${{ needs.sanity-checks.outputs.ct-matrix }}
|
|
|
|
build_slim_packages:
|
|
needs:
|
|
- sanity-checks
|
|
uses: ./.github/workflows/build_slim_packages.yaml
|
|
with:
|
|
builder: ${{ needs.sanity-checks.outputs.builder }}
|
|
builder_vsn: ${{ needs.sanity-checks.outputs.builder_vsn }}
|
|
otp_vsn: ${{ needs.sanity-checks.outputs.otp_vsn }}
|
|
elixir_vsn: ${{ needs.sanity-checks.outputs.elixir_vsn }}
|
|
|
|
build_docker_for_test:
|
|
needs:
|
|
- sanity-checks
|
|
uses: ./.github/workflows/build_docker_for_test.yaml
|
|
with:
|
|
otp_vsn: ${{ needs.sanity-checks.outputs.otp_vsn }}
|
|
elixir_vsn: ${{ needs.sanity-checks.outputs.elixir_vsn }}
|
|
version-emqx: ${{ needs.sanity-checks.outputs.version-emqx }}
|
|
version-emqx-enterprise: ${{ needs.sanity-checks.outputs.version-emqx-enterprise }}
|
|
|
|
spellcheck:
|
|
needs:
|
|
- sanity-checks
|
|
- build_slim_packages
|
|
uses: ./.github/workflows/spellcheck.yaml
|
|
|
|
run_conf_tests:
|
|
needs:
|
|
- sanity-checks
|
|
- compile
|
|
uses: ./.github/workflows/run_conf_tests.yaml
|
|
with:
|
|
builder: ${{ needs.sanity-checks.outputs.builder }}
|
|
|
|
check_deps_integrity:
|
|
needs:
|
|
- sanity-checks
|
|
uses: ./.github/workflows/check_deps_integrity.yaml
|
|
with:
|
|
builder: ${{ needs.sanity-checks.outputs.builder }}
|
|
|
|
run_jmeter_tests:
|
|
needs:
|
|
- sanity-checks
|
|
- build_docker_for_test
|
|
uses: ./.github/workflows/run_jmeter_tests.yaml
|
|
with:
|
|
version-emqx: ${{ needs.sanity-checks.outputs.version-emqx }}
|
|
|
|
run_docker_tests:
|
|
needs:
|
|
- sanity-checks
|
|
- build_docker_for_test
|
|
uses: ./.github/workflows/run_docker_tests.yaml
|
|
with:
|
|
version-emqx: ${{ needs.sanity-checks.outputs.version-emqx }}
|
|
version-emqx-enterprise: ${{ needs.sanity-checks.outputs.version-emqx-enterprise }}
|
|
|
|
run_helm_tests:
|
|
needs:
|
|
- sanity-checks
|
|
- build_docker_for_test
|
|
uses: ./.github/workflows/run_helm_tests.yaml
|
|
with:
|
|
version-emqx: ${{ needs.sanity-checks.outputs.version-emqx }}
|
|
version-emqx-enterprise: ${{ needs.sanity-checks.outputs.version-emqx-enterprise }}
|