diff --git a/ghc-lib/ci/jenkins/CI.hs b/ghc-lib/ci/jenkins/CI.hs deleted file mode 100644 index 15fbf66002..0000000000 --- a/ghc-lib/ci/jenkins/CI.hs +++ /dev/null @@ -1,107 +0,0 @@ --- Copyright (c) 2019 The DAML Authors. All rights reserved. --- SPDX-License-Identifier: Apache-2.0 - --- CI script to build the DA GHC fork and make a ghc-lib out of it - -import Control.Monad -import System.Directory -import System.Process.Extra -import System.IO.Extra -import System.Info.Extra -import System.Exit -import System.Time.Extra -import Data.List.Extra - -main :: IO () -main = do - - let cmd x = do - putStrLn $ "\n\n# Running: " ++ x - hFlush stdout - (t, _) <- duration $ system_ x - putStrLn $ "# Completed in " ++ showDuration t ++ ": " ++ x ++ "\n" - hFlush stdout - when isWindows $ - cmd "stack exec -- pacman -S autoconf automake-wrapper make patch python tar --noconfirm" - - let cmdInPythonVenv x = do - if isWindows - then cmd $ "py -3 -m venv venv && venv\\Scripts\\activate && " ++ x - else cmd $ "python3.6 -m venv venv && source venv/bin/activate && " ++ x - - withTempDir $ \tmpDir -> do - - withCurrentDirectory tmpDir $ do - putStrLn $ "[Info] Entered " ++ tmpDir - - cmd "git clone https://github.com/digital-asset/ghc-lib.git" - - withCurrentDirectory "ghc-lib" $ do - ghcLibDir <- getCurrentDirectory - putStrLn $ "[Info] Entered " ++ ghcLibDir - cmd "git clone https://gitlab.haskell.org/ghc/ghc.git" - - withCurrentDirectory "ghc" $ do - ghcDir <- getCurrentDirectory - putStrLn $ "[Info] Entered " ++ ghcDir - branch <- trim <$> systemOutput_ "git rev-parse --abbrev-ref HEAD" - - when (branch /= "master") $ do - _ <- putStrLn "[Error] Expected origin/master" - exitWith $ ExitFailure 1 - - cmd "git remote add upstream https://github.com/digital-asset/ghc.git" - cmd "git fetch upstream" - base0 <- systemOutput_ "git merge-base upstream/da-master origin/master" - base1 <- systemOutput_ "git merge-base upstream/da-unit-ids origin/master" - when (base0 /= base1) $ do - _ <- putStrLn "[Error] Expected common ancestor" - exitWith $ ExitFailure 1 - - cmd $ "git checkout " ++ base0 - cmd "git merge --no-edit upstream/da-master" - cmd "git submodule update --init --recursive" - - cmd "stack build --stack-yaml=hadrian/stack.yaml --only-dependencies --no-terminal --interleaved-output" - if isWindows - then cmdInPythonVenv "hadrian/build.stack.bat --configure --flavour=quickest -j" - else cmdInPythonVenv "hadrian/build.stack.sh --configure --flavour=quickest -j" - - cmd "stack exec --no-terminal -- _build/stage1/bin/ghc --version" - cmd "git merge --no-edit upstream/da-unit-ids" - putStrLn $ "[Info] Leaving " ++ ghcDir - - cmd "stack setup > /dev/null 2>&1" - cmd "stack build --no-terminal --interleaved-output" - cmdInPythonVenv "stack exec --no-terminal -- ghc-lib-gen ghc --ghc-lib-parser" - stackYaml <- readFile' "stack.yaml" - writeFile "stack.yaml" $ stackYaml ++ unlines ["- ghc"] - cmd "stack sdist ghc --tar-dir=." - - cmd "cd ghc && git clean -xf && git checkout ." - cmdInPythonVenv "stack exec --no-terminal -- ghc-lib-gen ghc --ghc-lib" - cmd "stack sdist ghc --tar-dir=." - - cmd "tar -xf ghc-lib-parser-0.1.0.tar.gz" - cmd "tar -xf ghc-lib-0.1.0.tar.gz" - cmd "mv ghc-lib-parser-0.1.0 ghc-lib-parser" - cmd "mv ghc-lib-0.1.0 ghc-lib" - removeFile "ghc/ghc-lib.cabal" - - writeFile "stack.yaml" $ - stackYaml ++ - unlines [ "- ghc-lib-parser" - , "- ghc-lib" - , "- examples/mini-hlint" - , "- examples/mini-compile" - ] - - -- Replace `ghc-prim` with `daml-prim`; this avoids an error importing `GHC.Prim` in MiniCompileTest.hs. - cmd "sed -i.bak s/\"ghc-prim\"/\"daml-prim\"/g examples/mini-compile/src/Main.hs" - - cmd "stack build --no-terminal --interleaved-output" - cmd "stack exec --no-terminal -- ghc-lib --version" - cmd "stack exec --no-terminal -- mini-hlint examples/mini-hlint/test/MiniHlintTest.hs" - cmd "stack exec --no-terminal -- mini-hlint examples/mini-hlint/test/MiniHlintTest_error_handling.hs" - cmd "stack exec --no-terminal -- mini-compile examples/mini-compile/test/MiniCompileTest.hs" - putStrLn $ "[Info] Leaving " ++ ghcLibDir diff --git a/ghc-lib/ci/jenkins/README.md b/ghc-lib/ci/jenkins/README.md deleted file mode 100644 index 8b95b9af9c..0000000000 --- a/ghc-lib/ci/jenkins/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# AMI to Build GHC on Jenkins Slave - -## Script to create new AMI -Use the shell script [create-jenkins-slave.sh](https://github.com/DACH-NY/da/compare/AMI-ghc-creation). Branch is not merged yet as not aware of future state of AMIs - -## Adding newly created AMI to Jenkins Slave -We need to add this template to available ones for Jenkins slave to pick up -in the file [here](da/pipeline/infrastructure/services/gcp_jenkins/casc/ec2.yml). Done in this [pull request]( -https://github.com/DACH-NY/da/pull/19767/files) plus follow up PRs - - -## History for Reference -The AMI used as slave is ami-0dc04b59dd27c88cb, based off of ami-0124b815041324e45. -It was originally created from the above mentioned script that used Centos 7 community AMI as source. When I compiled GHC on that slave, I noticed that it needed packages below. Installed them manually using yum install and then created a new AMI from instance using the UI on EC2. - yum install git - yum install https://centos7.iuscommunity.org/ius-release.rpm - yum install python36u - yum install ncurses-devel - yum install gcc-c++ - -Also, on jenkins slave ssh could not be used for the ghc and ghc-lib repos, -instead we used https and updated the .gitconfig and shell script accordingly - diff --git a/ghc-lib/ci/jenkins/run-ci.sh b/ghc-lib/ci/jenkins/run-ci.sh deleted file mode 100755 index 234699caad..0000000000 --- a/ghc-lib/ci/jenkins/run-ci.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -# Copyright (c) 2019 The DAML Authors. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -stack setup --resolver=lts-12.10 -stack runhaskell CI.hs --package=extra