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
|
#!/bin/bash
|
||||||
|
|
||||||
source /etc/profile
|
source /etc/profile
|
||||||
|
source /lib/gentoo/functions.sh
|
||||||
|
|
||||||
export PATH="${HOME}/.local/bin:${PATH}" CC=clang CXX=clang++
|
export PATH="${HOME}/.local/bin:${PATH}" CC=clang CXX=clang++
|
||||||
|
|
||||||
if command -v ldd; then
|
ldd=$(command -v ldd)
|
||||||
export LDFLAGS=-fuse-ld=lld
|
|
||||||
fi
|
|
||||||
|
|
||||||
for file in $(find src -type f -name '*.rs'); do
|
if [[ -n ${ldd} ]]; then
|
||||||
rustfmt --edition 2024 --check ${file} || exit $?
|
export LDFLAGS=-fuse-ld=${ldd}
|
||||||
done
|
fi
|
||||||
|
|
||||||
if [[ ! -d build ]]; then
|
if [[ ! -d build ]]; then
|
||||||
meson setup -Dfuzz=enabled -Dtests=enabled build || exit $?
|
meson setup -Dfuzz=enabled -Dtests=enabled build || exit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
meson compile -C build || exit $?
|
ebegin "running check commands"
|
||||||
|
parallel --halt soon,fail=1 --keep-order -j$(nproc) < check_commands.txt
|
||||||
ninja clippy -C build || exit $?
|
eend $? || 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 $?
|
|
||||||
|
|||||||
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