diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 218ed58..6c67314 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,6 +17,10 @@ variables: tags: - x86_64-darwin +.freebsd: + tags: + - x86_64-freebsd + .test_ghcup_version: script: - ./.gitlab/script/ghcup_version.sh @@ -48,31 +52,67 @@ variables: - exit 0 +.test_ghcup_version:freebsd: + extends: + - .test_ghcup_version + - .freebsd + before_script: + - ./.gitlab/before_script/freebsd/install_deps.sh + variables: + OS: "FREEBSD" + after_script: + - BUILD_DIR=$CI_PROJECT_DIR + - echo "Cleaning $BUILD_DIR" + - cd $HOME + - rm -Rf "$BUILD_DIR"/* + - exit 0 -######## linux ######## + + +######## linux test ######## test:linux:recommended: extends: .test_ghcup_version:linux variables: - GHC_VERSION: "recommended" + GHC_VERSION: "8.6.5" + CABAL_VERSION: "3.2.0.0" test:linux:latest: extends: .test_ghcup_version:linux variables: - GHC_VERSION: "latest" + GHC_VERSION: "8.8.3" + CABAL_VERSION: "3.2.0.0" allow_failure: true -######## darwin ######## +######## darwin test ######## test:mac:recommended: extends: .test_ghcup_version:darwin variables: - GHC_VERSION: "recommended" + GHC_VERSION: "8.6.5" + CABAL_VERSION: "3.2.0.0" test:mac:latest: extends: .test_ghcup_version:darwin variables: - GHC_VERSION: "latest" + GHC_VERSION: "8.8.3" + CABAL_VERSION: "3.2.0.0" + allow_failure: true + + +######## freebsd test ######## + +test:freebsd:recommended: + extends: .test_ghcup_version:freebsd + variables: + GHC_VERSION: "8.6.5" + CABAL_VERSION: "3.2.0.0" + +test:freebsd:latest: + extends: .test_ghcup_version:freebsd + variables: + GHC_VERSION: "8.8.3" + CABAL_VERSION: "3.2.0.0" allow_failure: true diff --git a/.gitlab/before_script/darwin/install_deps.sh b/.gitlab/before_script/darwin/install_deps.sh index b6de4fa..3976867 100755 --- a/.gitlab/before_script/darwin/install_deps.sh +++ b/.gitlab/before_script/darwin/install_deps.sh @@ -4,11 +4,11 @@ set -eux . "$( cd "$(dirname "$0")" ; pwd -P )/../../ghcup_env" -curl -sSfL https://gitlab.haskell.org/haskell/ghcup/-/raw/master/ghcup > ./ghcup-legacy -chmod +x ghcup-legacy +curl -sSfL https://downloads.haskell.org/~ghcup/x86_64-apple-darwin-ghcup > ./ghcup-bin +chmod +x ghcup-bin -./ghcup-legacy install ${GHC_VERSION} -./ghcup-legacy set ${GHC_VERSION} -./ghcup-legacy install-cabal +./ghcup-bin install ${GHC_VERSION} +./ghcup-bin set ${GHC_VERSION} +./ghcup-bin install-cabal ${CABAL_VERSION} exit 0 diff --git a/.gitlab/before_script/freebsd/install_deps.sh b/.gitlab/before_script/freebsd/install_deps.sh new file mode 100755 index 0000000..e211583 --- /dev/null +++ b/.gitlab/before_script/freebsd/install_deps.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -eux + +# pkg install --force --yes --no-repo-update curl gcc gmp gmake ncurses perl5 libffi libiconv + +. "$( cd "$(dirname "$0")" ; pwd -P )/../../ghcup_env" + +curl -sSfL https://downloads.haskell.org/~ghcup/x86_64-portbld-freebsd-ghcup > ./ghcup-bin +chmod +x ghcup-bin + +mkdir -p "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin +# ./ghcup-bin install ${GHC_VERSION} +# ./ghcup-bin install-cabal ${CABAL_VERSION} +# ./ghcup-bin set ${GHC_VERSION} + +# install cabal-3.2.0.0 +curl -sSfL -o freebsd.tar.xz 'https://hasufell.de/f/48aa72dcfaff4c3ea452/?dl=1' +tar xf freebsd.tar.xz +cp cabal "${GHCUP_INSTALL_BASE_PREFIX}/.ghcup/bin/cabal" +chmod +x "${GHCUP_INSTALL_BASE_PREFIX}/.ghcup/bin/cabal" + +exit 0 diff --git a/.gitlab/before_script/linux/install_deps.sh b/.gitlab/before_script/linux/install_deps.sh index 25a8c91..3c52279 100755 --- a/.gitlab/before_script/linux/install_deps.sh +++ b/.gitlab/before_script/linux/install_deps.sh @@ -7,10 +7,10 @@ sudo apt-get install -y libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev li . "$( cd "$(dirname "$0")" ; pwd -P )/../../ghcup_env" -curl -sSfL https://gitlab.haskell.org/haskell/ghcup/-/raw/master/ghcup > ./ghcup-legacy -chmod +x ghcup-legacy +curl -sSfL https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup > ./ghcup-bin +chmod +x ghcup-bin -./ghcup-legacy install ${GHC_VERSION} -./ghcup-legacy set ${GHC_VERSION} -./ghcup-legacy install-cabal +./ghcup-bin install ${GHC_VERSION} +./ghcup-bin set ${GHC_VERSION} +./ghcup-bin install-cabal ${CABAL_VERSION} diff --git a/.gitlab/script/ghcup_version.sh b/.gitlab/script/ghcup_version.sh index 0f12c8d..07d8648 100755 --- a/.gitlab/script/ghcup_version.sh +++ b/.gitlab/script/ghcup_version.sh @@ -14,32 +14,44 @@ eghcup() { ghcup -v -c -s file://$(pwd)/ghcup-${JSON_VERSION}.json "$@" } -# build + +### build + ecabal update if [ "${OS}" = "DARWIN" ] ; then - ecabal build -fcurl + ecabal build -w ghc-${GHC_VERSION} -fcurl else - ecabal build + ecabal build -w ghc-${GHC_VERSION} fi cp "$(ecabal new-exec --enable-tests --verbose=0 --offline sh -- -c 'command -v ghcup')" . cp "$(ecabal new-exec --enable-tests --verbose=0 --offline sh -- -c 'command -v ghcup-gen')" . - -# testing - cp ./ghcup "$CI_PROJECT_DIR"/.local/bin/ghcup cp ./ghcup-gen "$CI_PROJECT_DIR"/.local/bin/ghcup-gen + +### cleanup + rm -rf "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup + +### manual cli based testing + + ghcup-gen check -f ghcup-${JSON_VERSION}.json eghcup --numeric-version +# TODO: rm once we have tarballs +if [ "${OS}" = "FREEBSD" ] ; then + GHC_VERSION=8.6.3 + CABAL_VERSION=2.4.1.0 +fi + eghcup install ${GHC_VERSION} eghcup set ${GHC_VERSION} -eghcup install-cabal +eghcup install-cabal ${CABAL_VERSION} cabal --version