Skip to content

Commit f59763e

Browse files
committed
Use multiple threads for running tests in CI
1 parent c28f209 commit f59763e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

.github/workflows/haskell-ci.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ jobs:
2424
- name: Checkout the repository
2525
uses: actions/checkout@v2
2626

27+
- name: Retrieve core count
28+
id: cpuinfo
29+
run: |
30+
if [[ "$OSTYPE" == "linux"* ]]; then
31+
cpu_count=`lscpu | grep "^CPU(s):" | grep -o "[0-9]*$"`
32+
elif [[ "$OSTYPE" == "darwin"* ]]; then
33+
cpu_count=`system_profiler SPHardwareDataType | grep "Cores" | grep -o "[0-9]*$"`
34+
else
35+
cpu_count=1
36+
fi
37+
echo "Detected ${cpu_count} (logical) cores."
38+
echo "::set-output name=cpu_count::$cpu_count"
39+
2740
- name: Setup Haskell Stack
2841
uses: actions/setup-haskell@v1
2942
with:
@@ -69,4 +82,4 @@ jobs:
6982
run: make build
7083

7184
- name: Run tests
72-
run: make tests
85+
run: make tests -j${{ steps.cpuinfo.outputs.cpu_count }}

0 commit comments

Comments
 (0)