CI: check formatting via rewritemeta
This commit is contained in:
parent
0dc89a8664
commit
cbf2de9caa
|
@ -8,7 +8,10 @@ before_script:
|
||||||
- export PATH="$PWD/fdroidserver:$PATH"
|
- export PATH="$PWD/fdroidserver:$PATH"
|
||||||
- touch config.py
|
- touch config.py
|
||||||
|
|
||||||
test:
|
lint:
|
||||||
script:
|
script:
|
||||||
- fdroid readmeta
|
|
||||||
- fdroid lint
|
- fdroid lint
|
||||||
|
|
||||||
|
format:
|
||||||
|
script:
|
||||||
|
- ./tools/verify-rewritemeta
|
||||||
|
|
31
tools/verify-rewritemeta.sh
Executable file
31
tools/verify-rewritemeta.sh
Executable file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Verify that rewritemeta has been run.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
err() {
|
||||||
|
echo "$@" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
has_changed_files() {
|
||||||
|
git update-index -q --refresh
|
||||||
|
git diff-index --quiet HEAD -- && return 1 || return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
list_changed_files() {
|
||||||
|
git diff-index --name-only HEAD -- || return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if has_changed_files; then
|
||||||
|
list_changed_files
|
||||||
|
err "Unstaged changes found; refusing to continue."
|
||||||
|
fi
|
||||||
|
|
||||||
|
fdroid rewritemeta
|
||||||
|
|
||||||
|
if has_changed_files; then
|
||||||
|
list_changed_files
|
||||||
|
err "Run rewritemeta to fix formatting on those files."
|
||||||
|
fi
|
Loading…
Reference in a new issue