Commit de95bf40 authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari

circleci: Detect core count

Test Plan: Try `./validate`, CircleCI build; make sure core count
detection works in both cases.

Reviewers: alpmestan

Reviewed By: alpmestan

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14470

Differential Revision: https://phabricator.haskell.org/D4897
parent 8c628ad9
...@@ -15,7 +15,9 @@ aliases: ...@@ -15,7 +15,9 @@ aliases:
name: submodules name: submodules
command: .circleci/fetch-submodules.sh command: .circleci/fetch-submodules.sh
- &buildenv - &buildenv
THREADS: 9 # ideally we would simply set THREADS here instead of re-detecting it every
# time we need it below. Unfortunately, there is no way to set an environment
# variable with the result of a shell script.
SKIP_PERF_TESTS: YES SKIP_PERF_TESTS: YES
VERBOSE: 2 VERBOSE: 2
- &boot - &boot
...@@ -50,19 +52,19 @@ aliases: ...@@ -50,19 +52,19 @@ aliases:
- &make - &make
run: run:
name: Build name: Build
command: "make -j$THREADS" command: "make -j`mk/detect-cpu-count.sh`"
- &build_hadrian - &build_hadrian
run: run:
name: Build GHC using Hadrian name: Build GHC using Hadrian
command: | command: |
cabal update cabal update
hadrian/build.sh -j$THREADS hadrian/build.sh -j`mk/detect-cpu-count.sh`
- &test - &test
run: run:
name: Test name: Test
command: | command: |
mkdir -p test-results mkdir -p test-results
make test SKIP_PERF_TESTS=YES JUNIT_FILE=../../test-results/junit.xml make test THREADS=`mk/detect-cpu-count.sh` SKIP_PERF_TESTS=YES JUNIT_FILE=../../test-results/junit.xml
- &store_test_results - &store_test_results
store_test_results: store_test_results:
path: test-results path: test-results
......
#!/bin/sh
detect_cpu_count () {
if [ "$CPUS" = "" ]; then
# Windows standard environment variable
CPUS="$NUMBER_OF_PROCESSORS"
fi
if [ "$CPUS" = "" ]; then
# Linux
CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null`
fi
if [ "$CPUS" = "" ]; then
# FreeBSD
CPUS=`getconf NPROCESSORS_ONLN 2>/dev/null`
fi
if [ "$CPUS" = "" ]; then
# nothing helped
CPUS="1"
fi
}
detect_cpu_count
echo "$CPUS"
...@@ -119,29 +119,7 @@ check_packages () { ...@@ -119,29 +119,7 @@ check_packages () {
fi fi
} }
detect_cpu_count () { CPUS=`mk/detect-cpu-count.sh`
if [ "$CPUS" = "" ]; then
# Windows standard environment variable
CPUS="$NUMBER_OF_PROCESSORS"
fi
if [ "$CPUS" = "" ]; then
# Linux
CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null`
fi
if [ "$CPUS" = "" ]; then
# FreeBSD
CPUS=`getconf NPROCESSORS_ONLN 2>/dev/null`
fi
if [ "$CPUS" = "" ]; then
# nothing helped
CPUS="1"
fi
}
detect_cpu_count
if ! [ -d testsuite ] if ! [ -d testsuite ]
then then
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment