From d431761a05bd84803b17ddc613f8e6fa33278922 Mon Sep 17 00:00:00 2001 From: kwu130 <38401766+kwu130@users.noreply.github.com> Date: Wed, 8 Oct 2025 20:25:25 +0800 Subject: [PATCH] feat(ci): add parallel execution for all problems using GNU Parallel --- .github/workflows/run-all-problems.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/run-all-problems.yml b/.github/workflows/run-all-problems.yml index 0291abf..6747d6e 100644 --- a/.github/workflows/run-all-problems.yml +++ b/.github/workflows/run-all-problems.yml @@ -20,7 +20,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y cmake build-essential + sudo apt-get install -y cmake build-essential parallel - name: Configure project run: cmake -S . -B build @@ -30,15 +30,16 @@ jobs: - name: Run all executables (stop on failure) run: | - set -e - echo "Find and run all problems..." - - find build -type f -perm /111 | while read exe; do - if [[ "$(basename "$exe")" =~ ^[0-9]+- ]]; then - echo "▶️ Run: $exe" - if ! "$exe"; then - echo "❌ Failed: $exe" - exit 1 - fi + echo "🔍 Find all problems..." + find build -type f -perm /111 | grep -E '/[0-9]+-' > exec_list.txt + echo "✅ Found $(wc -l < exec_list.txt) problems" + + echo "🚀 Run all problems..." + parallel -j $(nproc) --halt now,fail=1 ' + exe="{}" + echo "▶️ Run: $exe" + if ! "$exe"; then + echo "❌ failed: $exe" + exit 1 fi - done + ' :::: exec_list.txt