Add ci lint job

This commit is contained in:
Jason Rhinelander 2022-03-29 19:33:18 -03:00
parent 511ae36ac1
commit 306010094e
No known key found for this signature in database
GPG Key ID: C4992CE7A88D4262
2 changed files with 24 additions and 0 deletions

View File

@ -130,6 +130,24 @@ local static_check_and_upload = [
[
{
name: 'lint check',
kind: 'pipeline',
type: 'docker',
steps: [{
name: 'build',
image: docker_base + 'lint',
pull: 'always',
commands: [
'echo "Building on ${DRONE_STAGE_MACHINE}"',
apt_get_quiet + ' update',
apt_get_quiet + ' install -y eatmydata',
'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y git clang-format-11 jsonnet',
'./contrib/drone-format-verify.sh',
],
}],
},
// Various debian builds
debian_pipeline('Debian (amd64)', docker_base + 'debian-sid', lto=true),
debian_pipeline('Debian Debug (amd64)', docker_base + 'debian-sid', build_type='Debug'),

6
contrib/drone-format-verify.sh Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
test "x$IGNORE" != "x" && exit 0
repo=$(readlink -e $(dirname $0)/../)
clang-format-11 -i $(find $repo/{httpserver,crypto,storage,utils,unit_test,common} | grep -E '\.[hc](pp)?$' | grep -v 'Catch2')
jsonnetfmt -i $repo/.drone.jsonnet
git --no-pager diff --exit-code --color || (echo -ne '\n\n\e[31;1mLint check failed; please run ./contrib/format.sh\e[0m\n\n' ; exit 1)