trivial: move all pre-commit checks into dedicated CI job

This one should launch faster than Fedora, and should fail all the jobs
way sooner.
This commit is contained in:
Mario Limonciello 2021-04-08 12:13:26 -05:00 committed by Richard Hughes
parent bb9390d45c
commit 0b80c872b3
2 changed files with 14 additions and 39 deletions

View File

@ -6,6 +6,20 @@ on:
branches: [ master ]
jobs:
pre-commit:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Refresh dependencies
run: sudo apt update
- name: Install dependencies
run: sudo apt install shellcheck -y
- name: Run pre-commit hooks
run: |
./contrib/setup
source venv/bin/activate
pre-commit run --all-files
abi:
runs-on: ubuntu-20.04
steps:

View File

@ -2,45 +2,6 @@
set -e
set -x
# check for g_return_val_if_fail sanity
if ! ./contrib/ci/check-null-false-returns.py; then
exit 1
fi
# check for CRLF DOS-style line endings
all=`find . -type f -not -path "./.git/*"`
for fn in $all; do
if grep -IU $'\x0D' $fn; then
echo "DOS line endings detected"
exit 1
fi
done
# these are deprecated in favor of INTERNAL flags
deprecated="FWUPD_DEVICE_FLAG_NO_AUTO_INSTANCE_IDS
FWUPD_DEVICE_FLAG_ONLY_SUPPORTED
FWUPD_DEVICE_FLAG_MD_SET_NAME
FWUPD_DEVICE_FLAG_MD_SET_VERFMT
FWUPD_DEVICE_FLAG_NO_GUID_MATCHING
FWUPD_DEVICE_FLAG_MD_SET_ICON"
for val in $deprecated; do
if grep -- $val plugins/*/*.c ; then
exit 1
fi
done
# check shell scripts
dnf install -y ShellCheck
if ! find . -name '*.sh' | xargs shellcheck --severity=error -e SC2068; then
exit 1
fi
# check python code
dnf install -y black
if ! black --check --fast .; then
exit 1
fi
#get any missing deps from the container
./contrib/ci/generate_dependencies.py | xargs dnf install -y