diff options
Diffstat (limited to '.gitlab')
-rwxr-xr-x | .gitlab/ci.sh | 69 | ||||
-rwxr-xr-x | .gitlab/gen_ci.hs | 31 | ||||
-rw-r--r-- | .gitlab/jobs.yaml | 121 |
3 files changed, 194 insertions, 27 deletions
diff --git a/.gitlab/ci.sh b/.gitlab/ci.sh index 217440bbaf..b840500aa4 100755 --- a/.gitlab/ci.sh +++ b/.gitlab/ci.sh @@ -65,6 +65,7 @@ Environment variables affecting both build systems: "decreases", or "all") HERMETIC Take measures to avoid looking at anything in \$HOME CONFIGURE_ARGS Arguments passed to configure script. + CONFIGURE_WRAPPER Wrapper for the configure script (e.g. Emscripten's emconfigure). ENABLE_NUMA Whether to enable numa support for the build (disabled by default) INSTALL_CONFIGURE_ARGS Arguments passed to the binary distribution configure script @@ -249,6 +250,11 @@ function setup() { cp -Rf "$CABAL_CACHE"/* "$CABAL_DIR" fi + case "${CONFIGURE_WRAPPER:-}" in + emconfigure) time_it "setup" setup_emscripten ;; + *) ;; + esac + case $toolchain_source in extracted) time_it "setup" setup_toolchain ;; *) ;; @@ -365,6 +371,14 @@ function setup_toolchain() { $cabal_install alex --constraint="alex>=$MIN_ALEX_VERSION" } +function setup_emscripten() { + git clone https://github.com/emscripten-core/emsdk.git + cd emsdk + ./emsdk install latest + ./emsdk activate latest + cd .. +} + function cleanup_submodules() { start_section "clean submodules" if [ -d .git ]; then @@ -402,6 +416,11 @@ EOF } function configure() { + case "${CONFIGURE_WRAPPER:-}" in + emconfigure) source emsdk/emsdk_env.sh ;; + *) ;; + esac + if [[ -z "${NO_BOOT:-}" ]]; then start_section "booting" run python3 boot @@ -421,7 +440,7 @@ function configure() { start_section "configuring" # See https://stackoverflow.com/questions/7577052 for a rationale for the # args[@] symbol-soup below. - run ./configure \ + run ${CONFIGURE_WRAPPER:-} ./configure \ --enable-tarballs-autodownload \ "${args[@]+"${args[@]}"}" \ GHC="$GHC" \ @@ -528,6 +547,11 @@ function make_install_destdir() { # install the binary distribution in directory $1 to $2. function install_bindist() { + case "${CONFIGURE_WRAPPER:-}" in + emconfigure) source emsdk/emsdk_env.sh ;; + *) ;; + esac + local bindist="$1" local instdir="$2" pushd "$bindist" @@ -545,7 +569,7 @@ function install_bindist() { args+=( "--target=$CROSS_TARGET" "--host=$CROSS_TARGET" ) fi - run ./configure \ + run ${CONFIGURE_WRAPPER:-} ./configure \ --prefix="$instdir" \ "${args[@]+"${args[@]}"}" make_install_destdir "$TOP"/destdir "$instdir" @@ -575,19 +599,17 @@ function test_hadrian() { fi - if [ -n "${CROSS_TARGET:-}" ]; then - if [ -n "${CROSS_EMULATOR:-}" ]; then - local instdir="$TOP/_build/install" - local test_compiler="$instdir/bin/${cross_prefix}ghc$exe" - install_bindist _build/bindist/ghc-*/ "$instdir" - echo 'main = putStrLn "hello world"' > expected - run "$test_compiler" -package ghc "$TOP/.gitlab/hello.hs" -o hello - $CROSS_EMULATOR ./hello > actual - run diff expected actual - else - info "Cannot test cross-compiled build without CROSS_EMULATOR being set." - return - fi + if [[ "${CROSS_EMULATOR:-}" == "NOT_SET" ]]; then + info "Cannot test cross-compiled build without CROSS_EMULATOR being set." + return + elif [ -n "${CROSS_TARGET:-}" ]; then + local instdir="$TOP/_build/install" + local test_compiler="$instdir/bin/${cross_prefix}ghc$exe" + install_bindist _build/bindist/ghc-*/ "$instdir" + echo 'main = putStrLn "hello world"' > expected + run "$test_compiler" -package ghc "$TOP/.gitlab/hello.hs" -o hello + ${CROSS_EMULATOR:-} ./hello > actual + run diff expected actual elif [[ -n "${REINSTALL_GHC:-}" ]]; then run_hadrian \ test \ @@ -598,10 +620,11 @@ function test_hadrian() { "runtest.opts+=${RUNTEST_ARGS:-}" || fail "hadrian cabal-install test" else local instdir="$TOP/_build/install" - local test_compiler="$instdir/bin/ghc$exe" + local test_compiler="$instdir/bin/${cross_prefix}ghc$exe" install_bindist _build/bindist/ghc-*/ "$instdir" - if [[ "${WINDOWS_HOST}" == "no" ]]; then + if [[ "${WINDOWS_HOST}" == "no" ]] && [ -z "${CROSS_TARGET:-}" ] + then run_hadrian \ test \ --test-root-dirs=testsuite/tests/stage1 \ @@ -610,10 +633,14 @@ function test_hadrian() { info "STAGE1_TEST=$?" fi - # Ensure the resulting compiler has the correct bignum-flavour - test_compiler_backend=$(${test_compiler} -e "GHC.Num.Backend.backendName") - if [ $test_compiler_backend != "\"$BIGNUM_BACKEND\"" ]; then - fail "Test compiler has a different BIGNUM_BACKEND ($test_compiler_backend) thean requested ($BIGNUM_BACKEND)" + # Ensure the resulting compiler has the correct bignum-flavour, + # except for cross-compilers as they may not support the interpreter + if [ -z "${CROSS_TARGET:-}" ] + then + test_compiler_backend=$(${test_compiler} -e "GHC.Num.Backend.backendName") + if [ $test_compiler_backend != "\"$BIGNUM_BACKEND\"" ]; then + fail "Test compiler has a different BIGNUM_BACKEND ($test_compiler_backend) thean requested ($BIGNUM_BACKEND)" + fi fi # If we are doing a release job, check the compiler can build a profiled executable diff --git a/.gitlab/gen_ci.hs b/.gitlab/gen_ci.hs index db338b88d4..bf2ad41025 100755 --- a/.gitlab/gen_ci.hs +++ b/.gitlab/gen_ci.hs @@ -109,6 +109,11 @@ bignumString :: BignumBackend -> String bignumString Gmp = "gmp" bignumString Native = "native" +data CrossEmulator + = NoEmulator + | NoEmulatorNeeded + | Emulator String + -- | A BuildConfig records all the options which can be modified to affect the -- bindists produced by the compiler. data BuildConfig @@ -120,7 +125,8 @@ data BuildConfig , withAssertions :: Bool , withNuma :: Bool , crossTarget :: Maybe String - , crossEmulator :: Maybe String + , crossEmulator :: CrossEmulator + , configureWrapper :: Maybe String , fullyStatic :: Bool , tablesNextToCode :: Bool , threadSanitiser :: Bool @@ -163,7 +169,8 @@ vanilla = BuildConfig , withAssertions = False , withNuma = False , crossTarget = Nothing - , crossEmulator = Nothing + , crossEmulator = NoEmulator + , configureWrapper = Nothing , fullyStatic = False , tablesNextToCode = True , threadSanitiser = False @@ -195,11 +202,13 @@ staticNativeInt :: BuildConfig staticNativeInt = static { bignumBackend = Native } crossConfig :: String -- ^ target triple - -> Maybe String -- ^ emulator for testing + -> CrossEmulator -- ^ emulator for testing + -> Maybe String -- ^ Configure wrapper -> BuildConfig -crossConfig triple emulator = +crossConfig triple emulator configure_wrapper = vanilla { crossTarget = Just triple , crossEmulator = emulator + , configureWrapper = configure_wrapper } llvm :: BuildConfig @@ -636,8 +645,14 @@ job arch opsys buildConfig = (jobName, Job {..}) , "BUILD_FLAVOUR" =: flavourString jobFlavour , "BIGNUM_BACKEND" =: bignumString (bignumBackend buildConfig) , "CONFIGURE_ARGS" =: configureArgsStr buildConfig + , maybe mempty ("CONFIGURE_WRAPPER" =:) (configureWrapper buildConfig) , maybe mempty ("CROSS_TARGET" =:) (crossTarget buildConfig) - , maybe mempty ("CROSS_EMULATOR" =:) (crossEmulator buildConfig) + , case crossEmulator buildConfig of + NoEmulator -> case crossTarget buildConfig of + Nothing -> mempty + Just _ -> "CROSS_EMULATOR" =: "NOT_SET" -- we need an emulator but it isn't set. Won't run the testsuite + Emulator s -> "CROSS_EMULATOR" =: s + NoEmulatorNeeded -> mempty , if withNuma buildConfig then "ENABLE_NUMA" =: "1" else mempty ] @@ -813,7 +828,11 @@ jobs = Map.fromList $ concatMap flattenJobGroup $ , standardBuilds I386 (Linux Debian9) , allowFailureGroup (standardBuildsWithConfig Amd64 (Linux Alpine) static) , disableValidate (allowFailureGroup (standardBuildsWithConfig Amd64 (Linux Alpine) staticNativeInt)) - , validateBuilds Amd64 (Linux Debian11) (crossConfig "aarch64-linux-gnu" (Just "qemu-aarch64 -L /usr/aarch64-linux-gnu")) + , validateBuilds Amd64 (Linux Debian11) (crossConfig "aarch64-linux-gnu" (Emulator "qemu-aarch64 -L /usr/aarch64-linux-gnu") Nothing) + , validateBuilds Amd64 (Linux Debian11) (crossConfig "js-unknown-ghcjs" NoEmulatorNeeded (Just "emconfigure") + ) + { bignumBackend = Native + } ] where diff --git a/.gitlab/jobs.yaml b/.gitlab/jobs.yaml index 07e91da267..fafb8c9357 100644 --- a/.gitlab/jobs.yaml +++ b/.gitlab/jobs.yaml @@ -1328,6 +1328,67 @@ "XZ_OPT": "-9" } }, + "nightly-x86_64-linux-deb11-int_native-cross_js-unknown-ghcjs-validate": { + "after_script": [ + ".gitlab/ci.sh save_cache", + ".gitlab/ci.sh clean", + "cat ci_timings" + ], + "allow_failure": false, + "artifacts": { + "expire_in": "8 weeks", + "paths": [ + "ghc-x86_64-linux-deb11-int_native-cross_js-unknown-ghcjs-validate.tar.xz", + "junit.xml" + ], + "reports": { + "junit": "junit.xml" + }, + "when": "always" + }, + "cache": { + "key": "x86_64-linux-deb11-$CACHE_REV", + "paths": [ + "cabal-cache", + "toolchain" + ] + }, + "dependencies": [], + "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV", + "needs": [ + { + "artifacts": false, + "job": "hadrian-ghc-in-ghci" + } + ], + "rules": [ + { + "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\")", + "when": "on_success" + } + ], + "script": [ + "sudo chown ghc:ghc -R .", + ".gitlab/ci.sh setup", + ".gitlab/ci.sh configure", + ".gitlab/ci.sh build_hadrian", + ".gitlab/ci.sh test_hadrian" + ], + "stage": "full-build", + "tags": [ + "x86_64-linux" + ], + "variables": { + "BIGNUM_BACKEND": "native", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_js-unknown-ghcjs-validate", + "BUILD_FLAVOUR": "validate", + "CONFIGURE_ARGS": "--with-intree-gmp", + "CONFIGURE_WRAPPER": "emconfigure", + "CROSS_TARGET": "js-unknown-ghcjs", + "TEST_ENV": "x86_64-linux-deb11-int_native-cross_js-unknown-ghcjs-validate", + "XZ_OPT": "-9" + } + }, "nightly-x86_64-linux-deb11-validate": { "after_script": [ ".gitlab/ci.sh save_cache", @@ -3810,6 +3871,66 @@ "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate" } }, + "x86_64-linux-deb11-int_native-cross_js-unknown-ghcjs-validate": { + "after_script": [ + ".gitlab/ci.sh save_cache", + ".gitlab/ci.sh clean", + "cat ci_timings" + ], + "allow_failure": false, + "artifacts": { + "expire_in": "2 weeks", + "paths": [ + "ghc-x86_64-linux-deb11-int_native-cross_js-unknown-ghcjs-validate.tar.xz", + "junit.xml" + ], + "reports": { + "junit": "junit.xml" + }, + "when": "always" + }, + "cache": { + "key": "x86_64-linux-deb11-$CACHE_REV", + "paths": [ + "cabal-cache", + "toolchain" + ] + }, + "dependencies": [], + "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV", + "needs": [ + { + "artifacts": false, + "job": "hadrian-ghc-in-ghci" + } + ], + "rules": [ + { + "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\")", + "when": "on_success" + } + ], + "script": [ + "sudo chown ghc:ghc -R .", + ".gitlab/ci.sh setup", + ".gitlab/ci.sh configure", + ".gitlab/ci.sh build_hadrian", + ".gitlab/ci.sh test_hadrian" + ], + "stage": "full-build", + "tags": [ + "x86_64-linux" + ], + "variables": { + "BIGNUM_BACKEND": "native", + "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_js-unknown-ghcjs-validate", + "BUILD_FLAVOUR": "validate", + "CONFIGURE_ARGS": "--with-intree-gmp", + "CONFIGURE_WRAPPER": "emconfigure", + "CROSS_TARGET": "js-unknown-ghcjs", + "TEST_ENV": "x86_64-linux-deb11-int_native-cross_js-unknown-ghcjs-validate" + } + }, "x86_64-linux-deb11-validate": { "after_script": [ ".gitlab/ci.sh save_cache", |