forked from gentoo-utils/gentoo-utils
use gnu parallel to run pre-commit hook check commands in parallel
This commit is contained in:
24
check.sh
24
check.sh
@@ -1,28 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /etc/profile
|
||||
source /lib/gentoo/functions.sh
|
||||
|
||||
export PATH="${HOME}/.local/bin:${PATH}" CC=clang CXX=clang++
|
||||
|
||||
if command -v ldd; then
|
||||
export LDFLAGS=-fuse-ld=lld
|
||||
fi
|
||||
ldd=$(command -v ldd)
|
||||
|
||||
for file in $(find src -type f -name '*.rs'); do
|
||||
rustfmt --edition 2024 --check ${file} || exit $?
|
||||
done
|
||||
if [[ -n ${ldd} ]]; then
|
||||
export LDFLAGS=-fuse-ld=${ldd}
|
||||
fi
|
||||
|
||||
if [[ ! -d build ]]; then
|
||||
meson setup -Dfuzz=enabled -Dtests=enabled build || exit $?
|
||||
fi
|
||||
|
||||
meson compile -C build || exit $?
|
||||
|
||||
ninja clippy -C build || exit $?
|
||||
|
||||
for test in unittests; do
|
||||
meson test -v ${test} -C build || exit $?
|
||||
done
|
||||
|
||||
# hack to make sure we use the system meson, since meson format from git is broken
|
||||
/usr/bin/meson format --recursive --check-only || exit $?
|
||||
ebegin "running check commands"
|
||||
parallel --halt soon,fail=1 --keep-order -j$(nproc) < check_commands.txt
|
||||
eend $? || exit $?
|
||||
|
||||
4
check_commands.txt
Normal file
4
check_commands.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
/usr/bin/meson format --recursive --check-only
|
||||
rustfmt --edition 2024 --check $(find src -type f -name '*.rs')
|
||||
ninja clippy -C build
|
||||
meson test unittests -C build
|
||||
Reference in New Issue
Block a user