emqx/.github/actions/pr-sanity-checks/action.yaml

75 lines
2.3 KiB
YAML

name: 'Pull request sanity checks'
defaults:
run:
shell: 'bash -Eeuo pipefail {0}'
runs:
using: composite
steps:
- name: Work around https://github.com/actions/checkout/issues/766
shell: bash
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- 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: |
echo "==> gitlint --commits $BEFORE_REF..$AFTER_REF"
pip install gitlint
gitlint --commits $BEFORE_REF..$AFTER_REF --config .github/workflows/.gitlint
echo "==> gitlint ok"
- name: Check line-break at EOF
shell: bash
run: |
echo "==> ./scripts/check-nl-at-eof.sh"
./scripts/check-nl-at-eof.sh
echo "==> ./scripts/check-nl-at-eof.sh ok"
- name: Run shellcheck
shell: bash
run: |
echo "==> ./scripts/shellcheck.sh"
apt-get update -y
apt-get install -y shellcheck
./scripts/shellcheck.sh
echo "==> ./scripts/shellcheck.sh ok"
- name: Check apps version
shell: bash
run: |
echo "==> ./scripts/apps-version-check.sh"
./scripts/apps-version-check.sh
echo "==> ./scripts/apps-version-check.sh ok"
- name: Check Erlang code formatting
shell: bash
run: |
echo "==> ./scripts/check-format.sh"
./scripts/check-format.sh
echo "==> check-format ok"
- name: Run elvis check
shell: bash
run: |
echo "==> ./scripts/elvis-check.sh $GITHUB_BASE_REF"
./scripts/elvis-check.sh $GITHUB_BASE_REF
echo "==> ./scripts/elvis-check.sh $GITHUB_BASE_REF ok"
- name: Setup mix
env:
MIX_ENV: emqx-enterprise
PROFILE: emqx-enterprise
shell: bash
run: |
echo "==> mix deps.get"
mix local.hex --force
mix local.rebar --force
echo "==> mix deps.get ok"
- name: Check Elixir code formatting
env:
MIX_ENV: emqx-enterprise
PROFILE: emqx-enterprise
shell: bash
run: |
echo "==> mix format --check-formatted"
mix format --check-formatted
echo "==> mix format ok"