diff options
| author | John Turner <jturner.usa@gmail.com> | 2025-11-28 17:16:33 +0000 |
|---|---|---|
| committer | John Turner <jturner.usa@gmail.com> | 2025-11-28 17:16:33 +0000 |
| commit | 7b600344251e79b1554b78ed8a972cac2aea4f3f (patch) | |
| tree | 7d3798e3aef71029c742e519f51b2c65e4b9b28a | |
| parent | 558e213ab496ccb7949dab36aeb60149d3137d99 (diff) | |
| download | gentoo-utils-7b600344251e79b1554b78ed8a972cac2aea4f3f.tar.gz | |
use gnu parallel to run pre-commit hook check commands in parallel
| -rwxr-xr-x | check.sh | 24 | ||||
| -rw-r--r-- | check_commands.txt | 4 |
2 files changed, 12 insertions, 16 deletions
@@ -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 $? diff --git a/check_commands.txt b/check_commands.txt new file mode 100644 index 0000000..f1c34fd --- /dev/null +++ b/check_commands.txt @@ -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 |
