Skip to content

Commit 3cdfa7c

Browse files
authored
Merge pull request #2 from kwu130/kwu130-patch-1
feat(ci): add parallel execution for all problems using GNU Parallel
2 parents aa591c5 + d431761 commit 3cdfa7c

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

‎.github/workflows/run-all-problems.yml‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Install dependencies
2121
run: |
2222
sudo apt-get update
23-
sudo apt-get install -y cmake build-essential
23+
sudo apt-get install -y cmake build-essential parallel
2424
2525
- name: Configure project
2626
run: cmake -S . -B build
@@ -30,15 +30,16 @@ jobs:
3030

3131
- name: Run all executables (stop on failure)
3232
run: |
33-
set -e
34-
echo "Find and run all problems..."
35-
36-
find build -type f -perm /111 | while read exe; do
37-
if [[ "$(basename "$exe")" =~ ^[0-9]+- ]]; then
38-
echo "▶️ Run: $exe"
39-
if ! "$exe"; then
40-
echo "❌ Failed: $exe"
41-
exit 1
42-
fi
33+
echo "🔍 Find all problems..."
34+
find build -type f -perm /111 | grep -E '/[0-9]+-' > exec_list.txt
35+
echo "✅ Found $(wc -l < exec_list.txt) problems"
36+
37+
echo "🚀 Run all problems..."
38+
parallel -j $(nproc) --halt now,fail=1 '
39+
exe="{}"
40+
echo "▶️ Run: $exe"
41+
if ! "$exe"; then
42+
echo "❌ failed: $exe"
43+
exit 1
4344
fi
44-
done
45+
' :::: exec_list.txt

0 commit comments

Comments
 (0)