ci: move sanity checks to the main workflow
This commit is contained in:
parent
8545cac33d
commit
4767b952dd
|
@ -1,65 +0,0 @@
|
||||||
name: 'Pull request sanity checks'
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: 'bash -Eeuo pipefail {0}'
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: composite
|
|
||||||
steps:
|
|
||||||
- name: Run gitlint
|
|
||||||
shell: bash
|
|
||||||
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
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get update -qy && apt-get install -qy shellcheck
|
|
||||||
./scripts/shellcheck.sh
|
|
||||||
- name: Run shell tests
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get update -qy && apt-get install -qy shelltestrunner
|
|
||||||
scripts/shelltest/run_tests.sh
|
|
||||||
- name: Check workflow files
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
ACTIONLINT_VSN: 1.6.25
|
|
||||||
run: |
|
|
||||||
wget https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VSN}/actionlint_${ACTIONLINT_VSN}_linux_amd64.tar.gz
|
|
||||||
tar zxf actionlint_${ACTIONLINT_VSN}_linux_amd64.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"'
|
|
||||||
- name: Check line-break at EOF
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
./scripts/check-nl-at-eof.sh
|
|
||||||
- name: Check apps version
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
./scripts/apps-version-check.sh
|
|
||||||
- name: Setup mix
|
|
||||||
env:
|
|
||||||
MIX_ENV: emqx-enterprise
|
|
||||||
PROFILE: emqx-enterprise
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
mix local.hex --force --if-missing && mix local.rebar --force --if-missing
|
|
||||||
- name: Check formatting
|
|
||||||
env:
|
|
||||||
MIX_ENV: emqx-enterprise
|
|
||||||
PROFILE: emqx-enterprise
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
./scripts/check-format.sh
|
|
||||||
- name: Run elvis check
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
./scripts/elvis-check.sh $GITHUB_BASE_REF
|
|
|
@ -38,8 +38,54 @@ jobs:
|
||||||
- name: Work around https://github.com/actions/checkout/issues/766
|
- name: Work around https://github.com/actions/checkout/issues/766
|
||||||
run: |
|
run: |
|
||||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||||
- uses: ./.github/actions/pr-sanity-checks
|
- name: Run gitlint
|
||||||
- name: Build matrix
|
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 https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VSN}/actionlint_${ACTIONLINT_VSN}_linux_amd64.tar.gz
|
||||||
|
tar zxf actionlint_${ACTIONLINT_VSN}_linux_amd64.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"'
|
||||||
|
- 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
|
id: matrix
|
||||||
run: |
|
run: |
|
||||||
APPS="$(./scripts/find-apps.sh --ci)"
|
APPS="$(./scripts/find-apps.sh --ci)"
|
||||||
|
|
|
@ -18,7 +18,7 @@ EMQX_BUILDER_ELIXIR=${EMQX_BUILDER_ELIXIR:-1.14.5}
|
||||||
EMQX_BUILDER_PLATFORM=${EMQX_BUILDER_PLATFORM:-ubuntu22.04}
|
EMQX_BUILDER_PLATFORM=${EMQX_BUILDER_PLATFORM:-ubuntu22.04}
|
||||||
EMQX_BUILDER=${EMQX_BUILDER:-ghcr.io/emqx/emqx-builder/${EMQX_BUILDER_VERSION}:${EMQX_BUILDER_ELIXIR}-${EMQX_BUILDER_OTP}-${EMQX_BUILDER_PLATFORM}}
|
EMQX_BUILDER=${EMQX_BUILDER:-ghcr.io/emqx/emqx-builder/${EMQX_BUILDER_VERSION}:${EMQX_BUILDER_ELIXIR}-${EMQX_BUILDER_OTP}-${EMQX_BUILDER_PLATFORM}}
|
||||||
|
|
||||||
commands=$(yq ".runs.steps[].run" .github/actions/pr-sanity-checks/action.yaml | grep -v null)
|
commands=$(yq ".jobs.sanity-checks.steps[].run" .github/workflows/_pr_entrypoint.yaml | grep -v null)
|
||||||
|
|
||||||
BEFORE_REF=${BEFORE_REF:-$(git rev-parse master)}
|
BEFORE_REF=${BEFORE_REF:-$(git rev-parse master)}
|
||||||
AFTER_REF=${AFTER_REF:-$(git rev-parse HEAD)}
|
AFTER_REF=${AFTER_REF:-$(git rev-parse HEAD)}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# shellcheck disable=SC2164
|
||||||
cd -P -- "$(dirname -- "$0")/.."
|
cd -P -- "$(dirname -- "$0")/.."
|
||||||
|
|
||||||
exit_code=0
|
exit_code=0
|
||||||
|
@ -8,6 +9,7 @@ for test in shelltest/*.test; do
|
||||||
echo "Running $test"
|
echo "Running $test"
|
||||||
/bin/sh "${test%.test}.setup"
|
/bin/sh "${test%.test}.setup"
|
||||||
shelltest -c --diff --all --precise -- "$test"
|
shelltest -c --diff --all --precise -- "$test"
|
||||||
|
# shellcheck disable=SC2181
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
exit_code=1
|
exit_code=1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue