summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Angermann <moritz.angermann@gmail.com>2021-02-13 11:41:47 +0800
committerMoritz Angermann <moritz.angermann@gmail.com>2021-02-13 11:41:47 +0800
commita7d22795ed118abfe64f4fc55d96d8561007ce1e (patch)
treedfb2d11fdf14fcb99bfaa2973c13d0222238ecd8
parent6a01e28f4204ec17c587931311711fa76e0ea08d (diff)
downloadhaskell-wip/angerman/aarch64-darwin-ci.tar.gz
[ci] Add support for building on aarch64-darwinwip/angerman/aarch64-darwin-ci
This will fail for now. But allows us to add aarch64-darwin machines to CI.
-rw-r--r--.gitlab-ci.yml57
-rwxr-xr-x.gitlab/ci.sh29
-rw-r--r--.gitlab/shell.nix52
3 files changed, 126 insertions, 12 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0b6dcf3c26..e3c89f5d55 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -417,6 +417,63 @@ validate-x86_64-darwin:
- cabal-cache
- toolchain
+validate-aarch64-darwin:
+ extends: .validate
+ stage: full-build
+ tags:
+ - aarch64-darwin
+
+ # for now make this non mandatory to pass.
+ allow_failure: true
+
+ variables:
+ TEST_TYPE: test
+ MAKE_ARGS: "-Werror"
+ GHC_VERSION: 8.10.3
+ CABAL_INSTALL_VERSION: 3.2.0.0
+ BUILD_FLAVOUR: "quick"
+ BIN_DIST_PREP_TAR_COMP: "ghc-arm64-apple-darwin.tar.xz"
+ # we run on M1's for now, getconf can't be built with nix yet,
+ # and we use a pure shell, so we can't/shouldn't use /usr/bin/getconf
+ # inside th shell.
+ CPUS: 8
+ LANG: "en_US.UTF-8"
+ # WARNING: this is overridden in the shell.nix, see shell.nix!
+ CONFIGURE_ARGS: "--with-intree-gmp"
+
+ # I wish we could just use the nix #! logic, but we can't --run and -i bash
+ # behave very differently. -i bash does not pass any nix related env vars
+ # the whole $stdenv/setup part seems to be missing.
+ script: |
+ set -Eeuo pipefail
+ function runInNixShell() {
+ nix-shell .gitlab/shell.nix \
+ -I nixpkgs=https://github.com/angerman/nixpkgs/archive/257cb120334.tar.gz \
+ --argstr system "aarch64-darwin" \
+ --pure \
+ --keep GHC_VERSION --keep CABAL_INSTALL_VERSION --keep BUILD_FLAVOUR \
+ --keep BIN_DIST_PREP_TAR_COMP --keep CPUS --keep PROJECT_DIR \
+ --keep CI_PROJECT_DIR --keep MAKE_ARGS \
+ --keep LANG --keep CONFIGURE_ARGS \
+ --run "$1"
+ }
+ # fix up config.sub in libraries for the time.
+ # aarch64-darwin is not supported in older config.sub's
+ find libraries -name config.sub -exec cp config.sub {} \;
+ runInNixShell ".gitlab/ci.sh setup"
+ runInNixShell ".gitlab/ci.sh configure"
+ runInNixShell ".gitlab/ci.sh build_make"
+ runInNixShell ".gitlab/ci.sh test_make"
+
+ artifacts:
+ reports:
+ junit: junit.xml
+ expire_in: 2 week
+ paths:
+ - $BIN_DIST_PREP_TAR_COMP
+ - junit.xml
+ - performance-metrics.tsv
+
# Disabled because of OS X CI capacity
.validate-x86_64-darwin-hadrian:
<<: *only-default
diff --git a/.gitlab/ci.sh b/.gitlab/ci.sh
index 46b3e81129..36e1ae67b7 100755
--- a/.gitlab/ci.sh
+++ b/.gitlab/ci.sh
@@ -2,8 +2,7 @@
# shellcheck disable=SC2230
# This is the primary driver of the GitLab CI infrastructure.
-
-set -e -o pipefail
+set -Eeuo pipefail
# Configuration:
hackage_index_state="@1579718451"
@@ -118,12 +117,18 @@ function show_tool() {
function set_toolchain_paths() {
needs_toolchain=1
- case "$(uname)" in
- Linux) needs_toolchain="" ;;
+ case "$(uname -m)-$(uname)" in
+ *-Linux) needs_toolchain="" ;;
*) ;;
esac
- if [[ -n "$needs_toolchain" ]]; then
+ if [[ -n "${IN_NIX_SHELL:-}" ]]; then
+ needs_toolchain=""
+ GHC="$(which ghc)"
+ CABAL="$(which cabal)"
+ HAPPY="$(which happy)"
+ ALEX="$(which alex)"
+ elif [[ -n "$needs_toolchain" ]]; then
# These are populated by setup_toolchain
GHC="$toolchain/bin/ghc$exe"
CABAL="$toolchain/bin/cabal$exe"
@@ -135,6 +140,7 @@ function set_toolchain_paths() {
HAPPY="$HOME/.cabal/bin/happy"
ALEX="$HOME/.cabal/bin/alex"
fi
+
export GHC
export CABAL
export HAPPY
@@ -299,7 +305,6 @@ BUILD_SPHINX_HTML=$BUILD_SPHINX_HTML
BUILD_SPHINX_PDF=$BUILD_SPHINX_PDF
BeConservative=YES
INTEGER_LIBRARY=$INTEGER_LIBRARY
-XZ_CMD=$XZ
BuildFlavour=$BUILD_FLAVOUR
ifneq "\$(BuildFlavour)" ""
@@ -308,7 +313,7 @@ endif
GhcLibHcOpts+=-haddock
EOF
- if [ -n "$HADDOCK_HYPERLINKED_SOURCES" ]; then
+ if [ -n "${HADDOCK_HYPERLINKED_SOURCES:-}" ]; then
echo "EXTRA_HADDOCK_OPTS += --hyperlinked-source --quickjump" >> mk/build.mk
fi
@@ -327,7 +332,7 @@ function configure() {
end_section "booting"
local target_args=""
- if [[ -n "$triple" ]]; then
+ if [[ -n "${triple:-}" ]]; then
target_args="--target=$triple"
fi
@@ -348,7 +353,7 @@ function build_make() {
if [[ -z "$BIN_DIST_PREP_TAR_COMP" ]]; then
fail "BIN_DIST_PREP_TAR_COMP is not set"
fi
- if [[ -n "$VERBOSE" ]]; then
+ if [[ -n "${VERBOSE:-}" ]]; then
MAKE_ARGS="$MAKE_ARGS V=1"
else
MAKE_ARGS="$MAKE_ARGS V=0"
@@ -373,7 +378,7 @@ function push_perf_notes() {
function test_make() {
run "$MAKE" test_bindist TEST_PREP=YES
- run "$MAKE" V=0 test \
+ run "$MAKE" V=0 VERBOSE=1 test \
THREADS="$cores" \
JUNIT_FILE=../../junit.xml
}
@@ -407,11 +412,11 @@ function clean() {
}
function run_hadrian() {
- if [ -n "$VERBOSE" ]; then HADRIAN_ARGS="$HADRIAN_ARGS -V"; fi
+ if [ -n "${VERBOSE:-}" ]; then HADRIAN_ARGS="${HADRIAN_ARGS:-} -V"; fi
run hadrian/build.cabal.sh \
--flavour="$FLAVOUR" \
-j"$cores" \
- $HADRIAN_ARGS \
+ ${HADRIAN_ARGS:-} \
$@
}
diff --git a/.gitlab/shell.nix b/.gitlab/shell.nix
new file mode 100644
index 0000000000..191916671f
--- /dev/null
+++ b/.gitlab/shell.nix
@@ -0,0 +1,52 @@
+{ system ? "aarch64-darwin"
+#, nixpkgs ? fetchTarball https://github.com/angerman/nixpkgs/archive/257cb120334.tar.gz #apple-silicon.tar.gz
+, pkgs ? import <nixpkgs> { inherit system; }
+, compiler ? if system == "aarch64-darwin" then "ghc8103Binary" else "ghc8103"
+}: pkgs.mkShell {
+ # this prevents nix from trying to write the env-vars file.
+ # we can't really, as NIX_BUILD_TOP/env-vars is not set.
+ noDumpEnvVars=1;
+
+ # we need to inject ncurses into --with-curses-libraries.
+ # the real fix is to teach terminfo to use libcurses on macOS.
+ CONFIGURE_ARGS = "--with-intree-gmp --with-curses-libraries=${pkgs.ncurses.out}/lib";
+
+ buildInputs = with pkgs; [
+ haskell.compiler.${compiler}
+ haskell.packages.${compiler}.cabal-install
+ haskell.packages.${compiler}.alex
+ haskell.packages.${compiler}.happy_1_19_12
+
+ clang_11
+ llvm_11
+
+ automake
+ autoconf
+ m4
+
+ gmp
+ ncurses
+ libiconv
+ zlib.out
+ zlib.dev
+ glibcLocales
+ # locale doesn't build yet :-/
+ # locale
+
+ git
+
+ python3
+ # python3Full
+ # python3Packages.sphinx
+ perl
+
+ which
+ wget
+ file
+
+ xz
+ xlibs.lndir
+
+ cacert
+ ];
+}