From 9fe56f1f01d53af462d98b2922835decbd386735 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Thu, 23 Mar 2023 11:23:18 +0000 Subject: [PATCH] Migrate release CI to github (#3406) * Migrate to github CI * Parallelize GHC builds * Avoid building local packages twice * Prepare for building 9.2.6 * Fix build on darwin M1 9.0.2 * Drop build of windows 9.2.6 due to https://gitlab.haskell.org/ghc/ghc/-/issues/22961 * Drop 9.0.2 for darwin M1 * Fix build on windows by disabling ghc-check pkg ABI check * Use git-archive to create src tarball in upload * Build releases for 9.2.7 * Build src archive in github action * Build on unknown-linux too * Try to build GHC-9.4.4 for unknown linux on Fedora33 * Make sure hls-wrapper binary comes from GHC-8.10.7 --------- Co-authored-by: wz1000 --- .cirrus.yml | 109 +++ .github/scripts/bindist.sh | 34 + .github/scripts/brew.sh | 27 + .github/scripts/build.sh | 61 ++ .github/scripts/cabal-cache.sh | 20 + .github/scripts/common.sh | 206 +++++ .github/scripts/env.sh | 36 + .github/scripts/tar.sh | 11 + .github/scripts/test.sh | 112 +++ .github/scripts/untar.sh | 7 + .github/workflows/release.yaml | 970 +++++++++++++++++++++++ .github/workflows/s3-cache.yaml | 43 + .gitignore | 1 + .gitlab-ci.yml | 606 -------------- .gitlab/ci.sh | 96 --- .gitlab/common.sh | 68 -- .gitlab/tar.sh | 32 - .gitlab/test.sh | 95 --- GNUmakefile | 77 +- scripts/release/download-gh-artifacts.sh | 33 + 20 files changed, 1729 insertions(+), 915 deletions(-) create mode 100644 .cirrus.yml create mode 100644 .github/scripts/bindist.sh create mode 100644 .github/scripts/brew.sh create mode 100644 .github/scripts/build.sh create mode 100755 .github/scripts/cabal-cache.sh create mode 100644 .github/scripts/common.sh create mode 100644 .github/scripts/env.sh create mode 100644 .github/scripts/tar.sh create mode 100644 .github/scripts/test.sh create mode 100644 .github/scripts/untar.sh create mode 100644 .github/workflows/release.yaml create mode 100644 .github/workflows/s3-cache.yaml delete mode 100644 .gitlab-ci.yml delete mode 100755 .gitlab/ci.sh delete mode 100644 .gitlab/common.sh delete mode 100755 .gitlab/tar.sh delete mode 100644 .gitlab/test.sh create mode 100644 scripts/release/download-gh-artifacts.sh diff --git a/.cirrus.yml b/.cirrus.yml new file mode 100644 index 000000000..02a2db2f0 --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,109 @@ +# release CI for FreeBSD +compute_engine_instance: + image_project: freebsd-org-cloud-dev + image: family/freebsd-13-1 + platform: freebsd + disk: 100 # Gb + +build_task: + timeout_in: 120m + only_if: $CIRRUS_TAG != '' + env: + AWS_ACCESS_KEY_ID: ENCRYPTED[dc5896620ebc12e98e6bbe96f72c5a2fe3785f439b7b2346797355f8d329a4bfd8ef6e58086bfc014be0d914424101cd] + AWS_SECRET_ACCESS_KEY: ENCRYPTED[6501cd594aca08c6c67cc679dd6f6d30db0cd44a81cceddebf32bb3d0a37f9af19cd71ddb7169d3f7b284a7829969f9e] + S3_HOST: ENCRYPTED[d3fef1b5850e85d80dd1684370b53183df2218f2d36509108a2703371afd9ebd3f9596ad4de52487c15ea29baed606b7] + TARBALL_EXT: "tar.xz" + ARCH: 64 + ARTIFACT: "x86_64-freebsd" + DISTRO: "na" + RUNNER_OS: "FreeBSD" + ADD_CABAL_ARGS: "--enable-split-sections" + GITHUB_WORKSPACE: ${CIRRUS_WORKING_DIR} + CABAL_CACHE_NONFATAL: "yes" + matrix: + - name: build-ghc-8.10.7 + env: + GHC_VERSION: 8.10.7 + - name: build-ghc-9.0.2 + env: + GHC_VERSION: 9.0.2 + - name: build-ghc-9.2.5 + env: + GHC_VERSION: 9.2.5 + - name: build-ghc-9.2.7 + env: + GHC_VERSION: 9.2.7 + install_script: pkg install -y hs-cabal-install git bash misc/compat10x misc/compat11x misc/compat12x gmake patchelf tree + script: + - tzsetup Etc/GMT + - adjkerntz -a + - bash .github/scripts/build.sh + - tar caf out.tar.xz out/ store/ + binaries_artifacts: + path: "out.tar.xz" + + +bindist_task: + name: bindist + depends_on: + - build-ghc-8.10.7 + - build-ghc-9.0.2 + - build-ghc-9.2.5 + - build-ghc-9.2.7 + timeout_in: 120m + only_if: $CIRRUS_TAG != '' + env: + TARBALL_EXT: "tar.xz" + ARCH: 64 + ARTIFACT: "x86_64-freebsd" + DISTRO: "na" + RUNNER_OS: "FreeBSD" + GITHUB_WORKSPACE: ${CIRRUS_WORKING_DIR} + install_script: pkg install -y hs-cabal-install git bash misc/compat10x misc/compat11x misc/compat12x gmake patchelf tree unzip + script: + - tzsetup Etc/GMT + - adjkerntz -a + + - curl -o binaries-8.10.7.tar.xz -L https://api.cirrus-ci.com/v1/artifact/build/${CIRRUS_BUILD_ID}/build-ghc-8.10.7/binaries/out.tar.xz + - tar xvf binaries-8.10.7.tar.xz + - rm -f binaries-8.10.7.tar.xz + + - curl -o binaries-9.0.2.tar.xz -L https://api.cirrus-ci.com/v1/artifact/build/${CIRRUS_BUILD_ID}/build-ghc-9.0.2/binaries/out.tar.xz + - tar xvf binaries-9.0.2.tar.xz + - rm -f binaries-9.0.2.tar.xz + + - curl -o binaries-9.2.5.tar.xz -L https://api.cirrus-ci.com/v1/artifact/build/${CIRRUS_BUILD_ID}/build-ghc-9.2.5/binaries/out.tar.xz + - tar xvf binaries-9.2.5.tar.xz + - rm -f binaries-9.2.5.tar.xz + + - curl -o binaries-9.2.7.tar.xz -L https://api.cirrus-ci.com/v1/artifact/build/${CIRRUS_BUILD_ID}/build-ghc-9.2.7/binaries/out.tar.xz + - tar xvf binaries-9.2.7.tar.xz + - rm -f binaries-9.2.7.tar.xz + + - bash .github/scripts/bindist.sh + bindist_artifacts: + path: "./out/*.tar.xz" + +test_task: + name: test + depends_on: + - bindist + timeout_in: 120m + only_if: $CIRRUS_TAG != '' + env: + TARBALL_EXT: "tar.xz" + ARCH: 64 + ARTIFACT: "x86_64-freebsd" + DISTRO: "na" + RUNNER_OS: "FreeBSD" + GITHUB_WORKSPACE: ${CIRRUS_WORKING_DIR} + install_script: pkg install -y hs-cabal-install git bash misc/compat10x misc/compat11x misc/compat12x gmake patchelf tree unzip + script: + - tzsetup Etc/GMT + - adjkerntz -a + + - curl -O -L https://api.cirrus-ci.com/v1/artifact/build/${CIRRUS_BUILD_ID}/bindist/bindist.zip + - unzip bindist.zip + + - bash .github/scripts/test.sh + diff --git a/.github/scripts/bindist.sh b/.github/scripts/bindist.sh new file mode 100644 index 000000000..1698cee3b --- /dev/null +++ b/.github/scripts/bindist.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -eux + +. .github/scripts/env.sh +. .github/scripts/common.sh + +# ensure ghcup +if ! command -v ghcup ; then + install_ghcup +fi + +# create tarball/zip +case "${TARBALL_EXT}" in + zip) + HLS_VERSION="$(grep '^version:' haskell-language-server.cabal | awk '{ print $2 }')" + ( + cd "$CI_PROJECT_DIR/out/${ARTIFACT}" + zip "$CI_PROJECT_DIR/out/haskell-language-server-${HLS_VERSION}-${ARTIFACT}.zip" haskell-language-server-* + ) + ;; + tar.xz) + # we need to control the order, so the hls wrapper binary is installed + # from the oldest version in the list + : "${GHCS:="$(cd "$CI_PROJECT_DIR/out/${ARTIFACT}" && rm -f ./*.json && for ghc in * ; do printf "%s\n" "$ghc" ; done | sort -r | tr '\n' ' ')"}" + emake --version + emake GHCUP=ghcup ARTIFACT="${ARTIFACT}" GHCS="${GHCS}" bindist + emake GHCUP=ghcup ARTIFACT="${ARTIFACT}" bindist-tar + emake GHCUP=ghcup GHCS="${GHCS}" clean-ghcs + ;; + *) + fail "Unknown TARBALL_EXT: ${TARBALL_EXT}" + ;; +esac diff --git a/.github/scripts/brew.sh b/.github/scripts/brew.sh new file mode 100644 index 000000000..0f889c629 --- /dev/null +++ b/.github/scripts/brew.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +set -eux + +. .github/scripts/env.sh + +if [ -e "$HOME/.brew" ] ; then + ( + cd "$HOME/.brew" + git fetch --depth 1 + git reset --hard origin/master + ) +else + git clone --depth=1 https://github.com/Homebrew/brew "$HOME/.brew" +fi +export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$PATH" + +mkdir -p $CI_PROJECT_DIR/.brew_cache +export HOMEBREW_CACHE=$CI_PROJECT_DIR/.brew_cache +mkdir -p $CI_PROJECT_DIR/.brew_logs +export HOMEBREW_LOGS=$CI_PROJECT_DIR/.brew_logs +mkdir -p /private/tmp/.brew_tmp +export HOMEBREW_TEMP=/private/tmp/.brew_tmp + +#brew update +brew install ${1+"$@"} + diff --git a/.github/scripts/build.sh b/.github/scripts/build.sh new file mode 100644 index 000000000..2a012e47f --- /dev/null +++ b/.github/scripts/build.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +set -eux + +. .github/scripts/env.sh +. .github/scripts/common.sh + +uname -a +uname -p +uname +pwd +env + +# ensure ghcup +if ! command -v ghcup ; then + install_ghcup +fi + +# ensure cabal-cache +download_cabal_cache "$HOME/.local/bin/cabal-cache" + + +# build +ecabal update +ghcup install ghc "${GHC_VERSION}" +ghcup set ghc "${GHC_VERSION}" +"ghc-${GHC_VERSION}" --info +"ghc" --info + +mkdir -p "$CI_PROJECT_DIR/out/${ARTIFACT}" +mkdir -p "$CI_PROJECT_DIR/out/plan.json" + +case "$(uname)" in + MSYS_*|MINGW*) + args=( -O2 -w "ghc-$GHC_VERSION" --project-file cabal.project --disable-profiling --disable-tests --enable-executable-stripping ${ADD_CABAL_ARGS}) + + # Shorten binary names + # due to MAX_PATH issues on windows + sed -i.bak -e 's/haskell-language-server/hls/g' \ + -e 's/haskell_language_server/hls/g' \ + haskell-language-server.cabal cabal.project + sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \ + src/**/*.hs exe/*.hs + + # shellcheck disable=SC2068 + build_with_cache ${args[@]} exe:hls exe:hls-wrapper + cp dist-newstyle/cache/plan.json "$CI_PROJECT_DIR/out/plan.json/${ARTIFACT}-ghc-${GHC_VERSION}-plan.json" + + # shellcheck disable=SC2068 + cp "$(cabal list-bin -v0 ${args[@]} exe:hls)" "$CI_PROJECT_DIR/out/${ARTIFACT}/haskell-language-server-${GHC_VERSION}${ext}" + # shellcheck disable=SC2068 + cp "$(cabal list-bin -v0 ${args[@]} exe:hls-wrapper)" "$CI_PROJECT_DIR/out/${ARTIFACT}/haskell-language-server-wrapper${ext}" + ;; + *) + sed -i.bak -e '/DELETE MARKER FOR CI/,/END DELETE/d' cabal.project # see comment in cabal.project + emake --version + emake GHCUP=ghcup CABAL_CACHE_BIN=cabal-cache.sh S3_HOST="${S3_HOST}" S3_KEY="${ARTIFACT}" GHC_VERSION="${GHC_VERSION}" hls-ghc + ;; +esac + + diff --git a/.github/scripts/cabal-cache.sh b/.github/scripts/cabal-cache.sh new file mode 100755 index 000000000..94b300113 --- /dev/null +++ b/.github/scripts/cabal-cache.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +case "$(uname -s)" in + MSYS_*|MINGW*) + ext=".exe" + ;; + *) + ext="" + ;; +esac + +if [ "${CABAL_CACHE_DISABLE}" = "yes" ] ; then + echo "cabal-cache disabled (CABAL_CACHE_DISABLE set)" +elif [ "${CABAL_CACHE_NONFATAL}" = "yes" ] ; then + time "cabal-cache${ext}" "$@" || echo "cabal-cache failed (CABAL_CACHE_NONFATAL set)" +else + time "cabal-cache${ext}" "$@" + exit $? +fi + diff --git a/.github/scripts/common.sh b/.github/scripts/common.sh new file mode 100644 index 000000000..7ebeb0486 --- /dev/null +++ b/.github/scripts/common.sh @@ -0,0 +1,206 @@ +#!/bin/bash + +. .github/scripts/env.sh + +# Colors +RED="0;31" +LT_BROWN="1;33" +LT_BLUE="1;34" + +ecabal() { + cabal "$@" +} + +nonfatal() { + "$@" || "$* failed" +} + +# sync the relevant parts of cabal artifacts that are part of +# the current plan.json from an S3 bucket +sync_from() { + if [ "${RUNNER_OS}" != "Windows" ] ; then + cabal_store_path="$(dirname "$(cabal help user-config | tail -n 1 | xargs)")/store" + fi + + cabal-cache.sh sync-from-archive \ + --host-name-override="${S3_HOST}" \ + --host-port-override=443 \ + --host-ssl-override=True \ + --region us-west-2 \ + $([ "${RUNNER_OS}" != "Windows" ] && echo --store-path="$cabal_store_path") \ + --archive-uri "s3://haskell-language-server/${ARTIFACT}" +} + +# sync the relevant parts of cabal artifacts that are part of +# the current plan.json to an S3 bucket +sync_to() { + if [ "${RUNNER_OS}" != "Windows" ] ; then + cabal_store_path="$(dirname "$(cabal help user-config | tail -n 1 | xargs)")/store" + fi + + cabal-cache.sh sync-to-archive \ + --host-name-override="${S3_HOST}" \ + --host-port-override=443 \ + --host-ssl-override=True \ + --region us-west-2 \ + $([ "${RUNNER_OS}" != "Windows" ] && echo --store-path="$cabal_store_path") \ + --archive-uri "s3://haskell-language-server/${ARTIFACT}" +} + +sha_sum() { + if [ "${RUNNER_OS}" = "FreeBSD" ] ; then + sha256 "$@" + else + sha256sum "$@" + fi +} + +git_describe() { + git config --global --get-all safe.directory | grep '^\*$' || git config --global --add safe.directory "*" + git describe --always +} + +download_cabal_cache() { + ( + set -e + dest="$HOME/.local/bin/cabal-cache" + url="" + exe="" + cd /tmp + case "${RUNNER_OS}" in + "Linux") + case "${ARCH}" in + "32") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/i386-linux-cabal-cache + ;; + "64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/x86_64-linux-cabal-cache + ;; + "ARM64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/aarch64-linux-cabal-cache + ;; + "ARM") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/armv7-linux-cabal-cache + ;; + esac + ;; + "FreeBSD") + url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/x86_64-portbld-freebsd-cabal-cache + ;; + "Windows") + exe=".exe" + url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/x86_64-mingw64-cabal-cache + ;; + "macOS") + case "${ARCH}" in + "ARM64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/aarch64-apple-darwin-cabal-cache + ;; + "64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/x86_64-apple-darwin-cabal-cache + ;; + esac + ;; + esac + + if [ -n "${url}" ] ; then + case "${url##*.}" in + "gz") + curl -L -o - "${url}" | gunzip > cabal-cache${exe} + ;; + *) + curl -o cabal-cache${exe} -L "${url}" + ;; + esac + sha_sum cabal-cache${exe} + mv "cabal-cache${exe}" "${dest}${exe}" + chmod +x "${dest}${exe}" + fi + + # install shell wrapper + cp "${CI_PROJECT_DIR}"/.github/scripts/cabal-cache.sh "$HOME"/.local/bin/ + chmod +x "$HOME"/.local/bin/cabal-cache.sh + ) +} + +build_with_cache() { + ecabal configure "$@" + ecabal build --dependencies-only "$@" --dry-run + nonfatal sync_from + ecabal build "$@" + nonfatal sync_to +} + +install_ghcup() { + find "$GHCUP_INSTALL_BASE_PREFIX" + mkdir -p "$GHCUP_BIN" + mkdir -p "$GHCUP_BIN"/../cache + + if [ "${RUNNER_OS}" = "FreeBSD" ] ; then + curl -o ghcup https://downloads.haskell.org/ghcup/tmp/x86_64-portbld-freebsd-ghcup-0.1.18.1 + chmod +x ghcup + mv ghcup "$HOME/.local/bin/ghcup" + else + curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_MINIMAL=1 sh + source "$(dirname "${GHCUP_BIN}")/env" + ghcup install cabal --set "${BOOTSTRAP_HASKELL_CABAL_VERSION}" + fi +} + +strip_binary() { + ( + set -e + local binary=$1 + case "$(uname -s)" in + "Darwin"|"darwin") + ;; + MSYS_*|MINGW*) + ;; + *) + strip -s "${binary}" + ;; + esac + ) +} + +# GitLab Pipelines log section delimiters +# https://gitlab.com/gitlab-org/gitlab-foss/issues/14664 +start_section() { + name="$1" + echo -e "section_start:$(date +%s):$name\015\033[0K" +} + +end_section() { + name="$1" + echo -e "section_end:$(date +%s):$name\015\033[0K" +} + +echo_color() { + local color="$1" + local msg="$2" + echo -e "\033[${color}m${msg}\033[0m" +} + +error() { echo_color "${RED}" "$1"; } +warn() { echo_color "${LT_BROWN}" "$1"; } +info() { echo_color "${LT_BLUE}" "$1"; } + +fail() { error "error: $1"; exit 1; } + +run() { + info "Running $*..." + "$@" || ( error "$* failed"; return 1; ) +} + +emake() { + if command -v gmake >/dev/null 2>&1 ; then + gmake "$@" + else + make "$@" + fi +} + +mktempdir() { + case "$(uname -s)" in + "Darwin"|"darwin") + mktemp -d -t hls_ci.XXXXXXX + ;; + *) + mktemp -d + ;; + esac +} diff --git a/.github/scripts/env.sh b/.github/scripts/env.sh new file mode 100644 index 000000000..701a22ed0 --- /dev/null +++ b/.github/scripts/env.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +mkdir -p "$HOME"/.local/bin + +if [ "${RUNNER_OS}" = "Windows" ] ; then + ext=".exe" +else + ext='' +fi + +export PATH="$HOME/.local/bin:$PATH" + +export BOOTSTRAP_HASKELL_NONINTERACTIVE=1 +export BOOTSTRAP_HASKELL_CABAL_VERSION="${CABAL_VER:-recommended}" +export BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=yes +export BOOTSTRAP_HASKELL_INSTALL_NO_STACK=yes + +if [ "${RUNNER_OS}" = "Windows" ] ; then + # on windows use pwd to get unix style path + CI_PROJECT_DIR="$(pwd)" + export CI_PROJECT_DIR + export GHCUP_INSTALL_BASE_PREFIX="/c" + export GHCUP_BIN="$GHCUP_INSTALL_BASE_PREFIX/ghcup/bin" + export PATH="$GHCUP_BIN:$PATH" + export CABAL_DIR="C:\\Users\\runneradmin\\AppData\\Roaming\\cabal" +else + export CI_PROJECT_DIR="${GITHUB_WORKSPACE}" + export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR" + export GHCUP_BIN="$GHCUP_INSTALL_BASE_PREFIX/.ghcup/bin" + export PATH="$GHCUP_BIN:$PATH" + export CABAL_DIR="$CI_PROJECT_DIR/cabal" + export CABAL_CACHE="$CI_PROJECT_DIR/cabal-cache" +fi + +export DEBIAN_FRONTEND=noninteractive +export TZ=Asia/Singapore diff --git a/.github/scripts/tar.sh b/.github/scripts/tar.sh new file mode 100644 index 000000000..e00522f01 --- /dev/null +++ b/.github/scripts/tar.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -eux + +. .github/scripts/env.sh + +ls -lah +ls -lah out/ +ls -lah store/ + +tar cvf "out-${ARTIFACT}-${GHC_VERSION}.tar" out/ store/ diff --git a/.github/scripts/test.sh b/.github/scripts/test.sh new file mode 100644 index 000000000..64fce04aa --- /dev/null +++ b/.github/scripts/test.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Test installing HLS bindist and then run +# every HLS-GHC version on a test module. + +set -eux + +. .github/scripts/env.sh +. .github/scripts/common.sh + +test_package="bytestring-0.11.1.0" +test_module="Data/ByteString.hs" + +create_cradle() { + echo "cradle:" > hie.yaml + echo " cabal:" >> hie.yaml +} + +enter_test_package() { + local tmp_dir + tmp_dir=$(mktempdir) + cd "$tmp_dir" + cabal unpack "${test_package}" + cd "${test_package}" +} + +# For all HLS GHC versions and the wrapper, run 'typecheck' +# over the $test_module +test_all_hls() { + local bin + local bin_noexe + local bindir + local hls + bindir=$1 + + for hls in "${bindir}/"haskell-language-server-* ; do + bin=${hls##*/} + bin_noexe=${bin/.exe/} + if ! [[ "${bin_noexe}" =~ "haskell-language-server-wrapper" ]] && ! [[ "${bin_noexe}" =~ "~" ]] ; then + if ghcup install ghc --set "${bin_noexe/haskell-language-server-/}" ; then + "${hls}" typecheck "${test_module}" || fail "failed to typecheck with HLS for GHC ${bin_noexe/haskell-language-server-/}" + else + fail "GHCup failed to install GHC ${bin_noexe/haskell-language-server-/}" + fi + fi + done + "$bindir/haskell-language-server-wrapper${ext}" typecheck "${test_module}" || fail "failed to typecheck with HLS wrapper" +} + +uname -a +uname -p +uname +env + +# ensure ghcup +if ! command -v ghcup ; then + install_ghcup +fi + +ecabal update + +# unpack +TARBALL_PREFIX="haskell-language-server" +mkdir -p "${GHCUP_BIN}" + +case "${TARBALL_EXT}" in + zip) + cp "$CI_PROJECT_DIR/out/${TARBALL_PREFIX}"-*-"${ARTIFACT}.zip" . + unzip ./*.zip + rm ./*.zip + mv haskell-language-server-* "${GHCUP_BIN}/" + + enter_test_package + create_cradle + test_all_hls "$GHCUP_BIN" + + ;; + tar.xz) + hls_bin=$(ls "$CI_PROJECT_DIR/out/${TARBALL_PREFIX}"-*-"${ARTIFACT}.tar.xz") + hls_ver_=${hls_bin#*haskell-language-server-} + hls_ver=${hls_ver_%-"${ARTIFACT}"*} + ghcup install hls -u "file://${hls_bin}" "${hls_ver}" --force + + # cleanup from previous dirty runs + rm -rf "$HOME"/.local/lib/haskell-language-server-* || true + + # print rpaths and libdirs + case "$(uname -s)" in + "Darwin"|"darwin") + otool -l "$(ghcup whereis basedir)/hls/${hls_ver}/lib/haskell-language-server-${hls_ver}/bin/"haskell-language-server-* + ;; + "FreeBSD") + readelf -Ws "$(ghcup whereis basedir)/hls/${hls_ver}/lib/haskell-language-server-${hls_ver}/bin/"haskell-language-server-* + ;; + *) + objdump -x "$(ghcup whereis basedir)/hls/${hls_ver}/lib/haskell-language-server-${hls_ver}/bin/"haskell-language-server-* + ;; + esac + tree "$(ghcup whereis basedir)/hls/${hls_ver}/lib/haskell-language-server-${hls_ver}/bin/" + tree "$GHCUP_BIN" + + enter_test_package + create_cradle + test_all_hls "$(ghcup whereis bindir)" + + ;; + *) + fail "Unknown TARBALL_EXT: ${TARBALL_EXT}" + ;; +esac + + diff --git a/.github/scripts/untar.sh b/.github/scripts/untar.sh new file mode 100644 index 000000000..580c69a5e --- /dev/null +++ b/.github/scripts/untar.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -eux + +for bindist in out-*.tar ; do + tar xf "${bindist}" +done diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 000000000..6f17c6b7d --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,970 @@ +name: Build and release + +on: + push: + tags: + - '*' + schedule: + - cron: '0 2 * * *' +env: + CABAL_CACHE_DISABLE: ${{ vars.CABAL_CACHE_DISABLE }} + CABAL_CACHE_NONFATAL: ${{ vars.CABAL_CACHE_NONFATAL }} + +jobs: + build-linux: + name: Build linux binaries + runs-on: ubuntu-latest + env: + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + S3_HOST: ${{ secrets.S3_HOST }} + TARBALL_EXT: tar.xz + ARCH: 64 + DEBIAN_FRONTEND: noninteractive + TZ: Asia/Singapore + strategy: + fail-fast: false + matrix: + ghc: ["9.4.4", "9.2.7", "9.2.5", "9.0.2", "8.10.7"] + platform: [ { image: "debian:9" + , installCmd: "apt-get update && apt-get install -y" + , toolRequirements: "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" + , DISTRO: "Debian" + , ARTIFACT: "x86_64-linux-deb9" + , ADD_CABAL_ARGS: "--enable-split-sections" + }, + { image: "debian:10" + , installCmd: "apt-get update && apt-get install -y" + , toolRequirements: "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" + , DISTRO: "Debian" + , ARTIFACT: "x86_64-linux-deb10" + , ADD_CABAL_ARGS: "--enable-split-sections" + }, + { image: "debian:11" + , installCmd: "apt-get update && apt-get install -y" + , toolRequirements: "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" + , DISTRO: "Debian" + , ARTIFACT: "x86_64-linux-deb11" + , ADD_CABAL_ARGS: "--enable-split-sections" + }, + { image: "ubuntu:18.04" + , installCmd: "apt-get update && apt-get install -y" + , toolRequirements: "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" + , DISTRO: "Ubuntu" + , ARTIFACT: "x86_64-linux-ubuntu18.04" + , ADD_CABAL_ARGS: "--enable-split-sections" + }, + { image: "ubuntu:20.04" + , installCmd: "apt-get update && apt-get install -y" + , toolRequirements: "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" + , DISTRO: "Ubuntu" + , ARTIFACT: "x86_64-linux-ubuntu20.04" + , ADD_CABAL_ARGS: "--enable-split-sections" + }, + { image: "ubuntu:22.04" + , installCmd: "apt-get update && apt-get install -y" + , toolRequirements: "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" + , DISTRO: "Ubuntu" + , ARTIFACT: "x86_64-linux-ubuntu22.04" + , ADD_CABAL_ARGS: "--enable-split-sections" + }, + { image: "linuxmintd/mint19.3-amd64" + , installCmd: "apt-get update && apt-get install -y" + , toolRequirements: "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" + , DISTRO: "Mint" + , ARTIFACT: "x86_64-linux-mint19.3" + , ADD_CABAL_ARGS: "--enable-split-sections" + }, + { image: "linuxmintd/mint20.2-amd64" + , installCmd: "apt-get update && apt-get install -y" + , toolRequirements: "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" + , DISTRO: "Mint" + , ARTIFACT: "x86_64-linux-mint20.2" + , ADD_CABAL_ARGS: "--enable-split-sections" + }, + { image: "fedora:27" + , installCmd: "dnf install -y" + , toolRequirements: "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf" + , DISTRO: "Fedora" + , ARTIFACT: "x86_64-linux-fedora27" + , ADD_CABAL_ARGS: "--enable-split-sections" + }, + { image: "fedora:33" + , installCmd: "dnf install -y" + , toolRequirements: "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf" + , DISTRO: "Fedora" + , ARTIFACT: "x86_64-linux-fedora33" + , ADD_CABAL_ARGS: "--enable-split-sections" + }, + { image: "centos:7" + , installCmd: "yum -y install epel-release && yum install -y" + , toolRequirements: "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf" + , DISTRO: "CentOS" + , ARTIFACT: "x86_64-linux-centos7" + , ADD_CABAL_ARGS: "--enable-split-sections" + } + ] + # TODO: rm + # we need a different image for 9.4.4, because GHC bindists are busted + include: + - ghc: 8.10.7 + platform: { image: "rockylinux:8", installCmd: "yum -y install epel-release && yum install -y --allowerasing", toolRequirements: "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf", DISTRO: "Unknown", ARTIFACT: "x86_64-linux-unknown", ADD_CABAL_ARGS: "--enable-split-sections" } + - ghc: 9.0.2 + platform: { image: "rockylinux:8", installCmd: "yum -y install epel-release && yum install -y --allowerasing", toolRequirements: "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf", DISTRO: "Unknown", ARTIFACT: "x86_64-linux-unknown", ADD_CABAL_ARGS: "--enable-split-sections" } + - ghc: 9.2.5 + platform: { image: "rockylinux:8", installCmd: "yum -y install epel-release && yum install -y --allowerasing", toolRequirements: "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf", DISTRO: "Unknown", ARTIFACT: "x86_64-linux-unknown", ADD_CABAL_ARGS: "--enable-split-sections" } + - ghc: 9.2.7 + platform: { image: "rockylinux:8", installCmd: "yum -y install epel-release && yum install -y --allowerasing", toolRequirements: "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf", DISTRO: "Unknown", ARTIFACT: "x86_64-linux-unknown", ADD_CABAL_ARGS: "--enable-split-sections" } + - ghc: 9.4.4 + platform: { image: "fedora:33", installCmd: "dnf install -y", toolRequirements: "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf tree", DISTRO: "Unknown", ARTIFACT: "x86_64-linux-unknown", ADD_CABAL_ARGS: "--enable-split-sections" } + container: + image: ${{ matrix.platform.image }} + steps: + - name: Install requirements + shell: sh + run: | + ${{ matrix.platform.installCmd }} curl bash git ${{ matrix.platform.toolRequirements }} + + - if: matrix.platform.DISTRO == 'Unknown' + run: | + echo "NAME=Linux" > /etc/os-release + echo "ID=linux" >> /etc/os-release + echo "PRETTY_NAME=Linux" >> /etc/os-release + + - uses: actions/checkout@v3 + + - name: Run build + run: | + bash .github/scripts/build.sh + tar cf out-${ARTIFACT}-${GHC_VERSION}.tar out/ store/ + + env: + ARTIFACT: ${{ matrix.platform.ARTIFACT }} + DISTRO: ${{ matrix.platform.DISTRO }} + ADD_CABAL_ARGS: ${{ matrix.platform.ADD_CABAL_ARGS }} + GHC_VERSION: ${{ matrix.ghc }} + + - if: always() + name: Upload artifact + uses: actions/upload-artifact@v3 + with: + if-no-files-found: error + retention-days: 2 + name: artifacts-${{ matrix.platform.ARTIFACT }} + path: | + ./out-${{ matrix.platform.ARTIFACT }}-${{ matrix.ghc }}.tar + + build-arm: + name: Build ARM binary + runs-on: [self-hosted, Linux, ARM64, beefy] + env: + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + S3_HOST: ${{ secrets.S3_HOST }} + TARBALL_EXT: tar.xz + ADD_CABAL_ARGS: "" + DEBIAN_FRONTEND: noninteractive + TZ: Asia/Singapore + ARTIFACT: "aarch64-linux-ubuntu20" + ARCH: ARM64 + DISTRO: Ubuntu + strategy: + fail-fast: true + matrix: + ghc: ["9.4.4", "9.2.7", "9.2.5", "9.0.2", "8.10.7"] + steps: + - uses: docker://arm64v8/ubuntu:focal + name: Cleanup (aarch64 linux) + with: + args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +" + + - name: git config + run: | + git config --global --get-all safe.directory | grep '^\*$' || git config --global --add safe.directory "*" + shell: bash + + - name: Checkout code + uses: actions/checkout@v3 + + - uses: docker://hasufell/arm64v8-ubuntu-haskell:focal + name: Run build (aarch64 linux) + with: + args: bash .github/scripts/build.sh + env: + GHC_VERSION: ${{ matrix.ghc }} + + - uses: docker://hasufell/arm64v8-ubuntu-haskell:focal + name: Run build (aarch64 linux) + with: + args: bash .github/scripts/tar.sh + env: + GHC_VERSION: ${{ matrix.ghc }} + + - if: always() + name: Upload artifact + uses: actions/upload-artifact@v3 + with: + if-no-files-found: error + retention-days: 2 + name: artifacts-arm + path: | + ./out-${{ env.ARTIFACT }}-${{ matrix.ghc }}.tar + + build-mac-x86_64: + name: Build binary (Mac x86_64) + runs-on: macOS-10.15 + env: + MACOSX_DEPLOYMENT_TARGET: 10.13 + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + S3_HOST: ${{ secrets.S3_HOST }} + ADD_CABAL_ARGS: "" + ARTIFACT: "x86_64-apple-darwin" + ARCH: 64 + TARBALL_EXT: tar.xz + DISTRO: na + strategy: + fail-fast: false + matrix: + ghc: ["9.4.4", "9.2.7", "9.2.5", "9.0.2", "8.10.7"] + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run build + run: | + brew install coreutils tree + bash .github/scripts/build.sh + tar cf out-${ARTIFACT}-${GHC_VERSION}.tar out/ store/ + env: + GHC_VERSION: ${{ matrix.ghc }} + + - if: always() + name: Upload artifact + uses: actions/upload-artifact@v3 + with: + if-no-files-found: error + retention-days: 2 + name: artifacts-mac-x86_64 + path: | + ./out-${{ env.ARTIFACT }}-${{ matrix.ghc }}.tar + + build-mac-aarch64: + name: Build binary (Mac aarch64) + runs-on: [self-hosted, macOS, ARM64] + env: + MACOSX_DEPLOYMENT_TARGET: 10.13 + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + S3_HOST: ${{ secrets.S3_HOST }} + ADD_CABAL_ARGS: "" + ARTIFACT: "aarch64-apple-darwin" + ARCH: ARM64 + TARBALL_EXT: tar.xz + DISTRO: na + HOMEBREW_CHANGE_ARCH_TO_ARM: 1 + strategy: + fail-fast: false + matrix: + ghc: ["9.4.4", "9.2.7", "9.2.5", "8.10.7"] + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run build + run: | + bash .github/scripts/brew.sh git coreutils llvm@11 autoconf automake tree + export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$HOME/.brew/opt/llvm@11/bin:$PATH" + export CC="$HOME/.brew/opt/llvm@11/bin/clang" + export CXX="$HOME/.brew/opt/llvm@11/bin/clang++" + export LD=ld + export AR="$HOME/.brew/opt/llvm@11/bin/llvm-ar" + export RANLIB="$HOME/.brew/opt/llvm@11/bin/llvm-ranlib" + bash .github/scripts/build.sh + tar cf out-${ARTIFACT}-${GHC_VERSION}.tar out/ store/ + env: + GHC_VERSION: ${{ matrix.ghc }} + + - if: always() + name: Upload artifact + uses: actions/upload-artifact@v3 + with: + if-no-files-found: error + retention-days: 2 + name: artifacts-mac-aarch64 + path: | + ./out-${{ env.ARTIFACT }}-${{ matrix.ghc }}.tar + + build-win: + name: Build binary (Win) + runs-on: windows-latest + env: + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + S3_HOST: ${{ secrets.S3_HOST }} + ADD_CABAL_ARGS: "" + ARTIFACT: "x86_64-mingw64" + ARCH: 64 + TARBALL_EXT: "zip" + DISTRO: na + strategy: + fail-fast: false + matrix: + ghc: ["9.4.4", "9.2.7", "9.2.5", "9.0.2", "8.10.7"] + steps: + - name: install windows deps + shell: pwsh + run: | + C:\msys64\usr\bin\bash -lc "pacman --disable-download-timeout --noconfirm -Syuu" + C:\msys64\usr\bin\bash -lc "pacman --disable-download-timeout --noconfirm -Syuu" + C:\msys64\usr\bin\bash -lc "pacman --disable-download-timeout --noconfirm -S make mingw-w64-x86_64-clang curl autoconf mingw-w64-x86_64-pkgconf ca-certificates base-devel gettext autoconf make libtool automake python p7zip patch unzip zip git" + taskkill /F /FI "MODULES eq msys-2.0.dll" + + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run build (windows) + run: | + $env:CHERE_INVOKING = 1 + $env:MSYS2_PATH_TYPE = "inherit" + $ErrorActionPreference = "Stop" + C:\msys64\usr\bin\bash -lc "bash .github/scripts/build.sh" + shell: pwsh + env: + GHC_VERSION: ${{ matrix.ghc }} + + - if: always() + name: Upload artifact + uses: actions/upload-artifact@v3 + with: + if-no-files-found: error + retention-days: 2 + name: artifacts-win + path: | + ./out/* + + bindist-linux: + name: Tar linux bindists (linux) + runs-on: ubuntu-latest + needs: ["build-linux"] + env: + TARBALL_EXT: tar.xz + ARCH: 64 + DEBIAN_FRONTEND: noninteractive + TZ: Asia/Singapore + strategy: + fail-fast: false + matrix: + include: + - image: debian:9 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf tree + DISTRO: Debian + ARTIFACT: "x86_64-linux-deb9" + - image: debian:10 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf tree + DISTRO: Debian + ARTIFACT: "x86_64-linux-deb10" + - image: debian:11 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf tree + DISTRO: Debian + ARTIFACT: "x86_64-linux-deb11" + - image: ubuntu:18.04 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf tree + DISTRO: Ubuntu + ARTIFACT: "x86_64-linux-ubuntu18.04" + - image: ubuntu:20.04 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf tree + DISTRO: Ubuntu + ARTIFACT: "x86_64-linux-ubuntu20.04" + - image: ubuntu:22.04 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf tree + DISTRO: Ubuntu + ARTIFACT: "x86_64-linux-ubuntu22.04" + - image: fedora:27 + installCmd: dnf install -y + toolRequirements: autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf tree + DISTRO: Fedora + ARTIFACT: "x86_64-linux-fedora27" + - image: fedora:33 + installCmd: dnf install -y + toolRequirements: autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf tree + DISTRO: Fedora + ARTIFACT: "x86_64-linux-fedora33" + - image: centos:7 + installCmd: yum -y install epel-release && yum install -y + toolRequirements: autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf tree + DISTRO: CentOS + ARTIFACT: "x86_64-linux-centos7" + - image: linuxmintd/mint19.3-amd64 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf tree + DISTRO: Mint + ARTIFACT: "x86_64-linux-mint19.3" + - image: "fedora:33" + installCmd: "dnf install -y" + toolRequirements: "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf tree" + DISTRO: "Unknown" + ARTIFACT: "x86_64-linux-unknown" + - image: linuxmintd/mint20.2-amd64 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf tree + DISTRO: Mint + ARTIFACT: "x86_64-linux-mint20.2" + container: + image: ${{ matrix.image }} + steps: + - name: Install requirements + shell: sh + run: | + ${{ matrix.installCmd }} curl bash git ${{ matrix.toolRequirements }} + + - if: matrix.DISTRO == 'Unknown' + run: | + echo "NAME=Linux" > /etc/os-release + echo "ID=linux" >> /etc/os-release + echo "PRETTY_NAME=Linux" >> /etc/os-release + + - uses: actions/checkout@v3 + + - uses: actions/download-artifact@v3 + with: + name: artifacts-${{ matrix.ARTIFACT }} + path: ./ + + - name: Create bindist + run: | + set -eux + for bindist in out-*.tar ; do + tar -xf "${bindist}" + done + unset bindist + bash .github/scripts/bindist.sh + env: + ARTIFACT: ${{ matrix.ARTIFACT }} + + - name: Upload bindist + uses: actions/upload-artifact@v3 + with: + if-no-files-found: error + name: bindists-${{ matrix.ARTIFACT }} + path: | + ./out/*.tar.xz + ./out/plan.json/* + + - uses: geekyeggo/delete-artifact@v2 + with: + name: artifacts-${{ matrix.ARTIFACT }} + + bindist-arm: + name: Tar linux bindists (arm) + runs-on: [self-hosted, Linux, ARM64] + needs: ["build-arm"] + env: + TARBALL_EXT: tar.xz + ARCH: ARM64 + DEBIAN_FRONTEND: noninteractive + ARTIFACT: "aarch64-linux-ubuntu20" + TZ: Asia/Singapore + steps: + - uses: docker://arm64v8/ubuntu:focal + name: Cleanup (aarch64 linux) + with: + args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +" + + - name: git config + run: | + git config --global --get-all safe.directory | grep '^\*$' || git config --global --add safe.directory "*" + shell: bash + + - uses: actions/checkout@v3 + + - uses: actions/download-artifact@v3 + with: + name: artifacts-arm + path: ./ + + - uses: docker://hasufell/arm64v8-ubuntu-haskell:focal + name: Unpack + with: + args: bash .github/scripts/untar.sh + + - uses: docker://hasufell/arm64v8-ubuntu-haskell:focal + name: Create bindist (aarch64 linux) + with: + args: bash .github/scripts/bindist.sh + + - name: Upload bindist + uses: actions/upload-artifact@v3 + with: + if-no-files-found: error + name: bindists-arm + path: | + ./out/*.tar.xz + ./out/plan.json/* + + - uses: geekyeggo/delete-artifact@v2 + with: + name: artifacts-arm + + bindist-mac-x86_64: + name: Tar bindists (Mac x86_64) + runs-on: macOS-10.15 + needs: ["build-mac-x86_64"] + env: + TARBALL_EXT: tar.xz + ARCH: 64 + ARTIFACT: "x86_64-apple-darwin" + steps: + - uses: actions/checkout@v3 + + - uses: actions/download-artifact@v3 + with: + name: artifacts-mac-x86_64 + path: ./ + + - name: Create bindist + run: | + brew install coreutils tree + for bindist in out-*.tar ; do + tar xf "${bindist}" + done + unset bindist + bash .github/scripts/bindist.sh + + - name: Upload bindist + uses: actions/upload-artifact@v3 + with: + if-no-files-found: error + name: bindists-mac-x86_64 + path: | + ./out/*.tar.xz + ./out/plan.json/* + + - uses: geekyeggo/delete-artifact@v2 + with: + name: artifacts-mac-x86_64 + + bindist-mac-aarch64: + name: Tar bindists (Mac aarch64) + runs-on: [self-hosted, macOS, ARM64] + needs: ["build-mac-aarch64"] + env: + TARBALL_EXT: tar.xz + ARCH: ARM64 + ARTIFACT: "aarch64-apple-darwin" + steps: + - uses: actions/checkout@v3 + + - uses: actions/download-artifact@v3 + with: + name: artifacts-mac-aarch64 + path: ./ + + - name: Create bindist + run: | + bash .github/scripts/brew.sh git coreutils llvm@11 autoconf automake tree + export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$HOME/.brew/opt/llvm@11/bin:$PATH" + export CC="$HOME/.brew/opt/llvm@11/bin/clang" + export CXX="$HOME/.brew/opt/llvm@11/bin/clang++" + export LD=ld + export AR="$HOME/.brew/opt/llvm@11/bin/llvm-ar" + export RANLIB="$HOME/.brew/opt/llvm@11/bin/llvm-ranlib" + for bindist in out-*.tar ; do + tar xf "${bindist}" + done + unset bindist + bash .github/scripts/bindist.sh + + - name: Upload bindist + uses: actions/upload-artifact@v3 + with: + if-no-files-found: error + name: bindists-mac-aarch64 + path: | + ./out/*.tar.xz + ./out/plan.json/* + + - uses: geekyeggo/delete-artifact@v2 + with: + name: artifacts-mac-aarch64 + + bindist-win: + name: Tar bindists (Windows) + runs-on: windows-latest + needs: ["build-win"] + env: + TARBALL_EXT: zip + ARTIFACT: "x86_64-mingw64" + ARCH: 64 + steps: + - name: install windows deps + shell: pwsh + run: | + C:\msys64\usr\bin\bash -lc "pacman --disable-download-timeout --noconfirm -Syuu" + C:\msys64\usr\bin\bash -lc "pacman --disable-download-timeout --noconfirm -Syuu" + C:\msys64\usr\bin\bash -lc "pacman --disable-download-timeout --noconfirm -S unzip zip git" + taskkill /F /FI "MODULES eq msys-2.0.dll" + + - uses: actions/checkout@v3 + + - uses: actions/download-artifact@v3 + with: + name: artifacts-win + path: ./out + + - name: Create bindist + run: | + $env:CHERE_INVOKING = 1 + $env:MSYS2_PATH_TYPE = "inherit" + C:\msys64\usr\bin\bash -lc "bash .github/scripts/bindist.sh" + shell: pwsh + + - name: Upload bindist + uses: actions/upload-artifact@v3 + with: + if-no-files-found: error + name: bindists-win + path: | + ./out/*.zip + ./out/plan.json/* + + - uses: geekyeggo/delete-artifact@v2 + with: + name: artifacts-win + + test-linux: + name: Test linux binaries + runs-on: ubuntu-latest + needs: ["bindist-linux"] + env: + TARBALL_EXT: tar.xz + ARCH: 64 + DEBIAN_FRONTEND: noninteractive + TZ: Asia/Singapore + strategy: + fail-fast: false + matrix: + include: + - image: debian:9 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf tree + DISTRO: Debian + ARTIFACT: "x86_64-linux-deb9" + - image: debian:10 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf tree + DISTRO: Debian + ARTIFACT: "x86_64-linux-deb10" + - image: debian:11 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf tree + DISTRO: Debian + ARTIFACT: "x86_64-linux-deb11" + - image: ubuntu:18.04 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf tree + DISTRO: Ubuntu + ARTIFACT: "x86_64-linux-ubuntu18.04" + - image: ubuntu:20.04 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf tree + DISTRO: Ubuntu + ARTIFACT: "x86_64-linux-ubuntu20.04" + - image: ubuntu:22.04 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf tree + DISTRO: Ubuntu + ARTIFACT: "x86_64-linux-ubuntu22.04" + - image: fedora:27 + installCmd: dnf install -y + toolRequirements: autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf tree + DISTRO: Fedora + ARTIFACT: "x86_64-linux-fedora27" + - image: fedora:33 + installCmd: dnf install -y + toolRequirements: autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf tree + DISTRO: Fedora + ARTIFACT: "x86_64-linux-fedora33" + - image: centos:7 + installCmd: yum -y install epel-release && yum install -y + toolRequirements: autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf tree + DISTRO: CentOS + ARTIFACT: "x86_64-linux-centos7" + - image: linuxmintd/mint19.3-amd64 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf tree + DISTRO: Mint + ARTIFACT: "x86_64-linux-mint19.3" + - image: "fedora:33" + installCmd: dnf install -y + toolRequirements: autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf tree + DISTRO: "Unknown" + ARTIFACT: "x86_64-linux-unknown" + - image: linuxmintd/mint20.2-amd64 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf tree + DISTRO: Mint + ARTIFACT: "x86_64-linux-mint20.2" + container: + image: ${{ matrix.image }} + steps: + - name: Install requirements + shell: sh + run: | + ${{ matrix.installCmd }} curl bash git ${{ matrix.toolRequirements }} + + - if: matrix.DISTRO == 'Unknown' + run: | + echo "NAME=Linux" > /etc/os-release + echo "ID=linux" >> /etc/os-release + echo "PRETTY_NAME=Linux" >> /etc/os-release + + - uses: actions/checkout@v3 + + - uses: actions/download-artifact@v3 + with: + name: bindists-${{ matrix.ARTIFACT }} + path: ./out + + - name: Run test + run: bash .github/scripts/test.sh + env: + ARTIFACT: ${{ matrix.ARTIFACT }} + DISTRO: ${{ matrix.DISTRO }} + + test-arm: + name: Test ARM binary + runs-on: [self-hosted, Linux, ARM64] + needs: ["bindist-arm"] + env: + TARBALL_EXT: tar.xz + DEBIAN_FRONTEND: noninteractive + TZ: Asia/Singapore + ARTIFACT: "aarch64-linux-ubuntu20" + ARCH: ARM64 + DISTRO: Ubuntu + steps: + - uses: docker://arm64v8/ubuntu:focal + name: Cleanup (aarch64 linux) + with: + args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +" + + - name: git config + run: | + git config --global --get-all safe.directory | grep '^\*$' || git config --global --add safe.directory "*" + shell: bash + + - name: Checkout code + uses: actions/checkout@v3 + + - uses: actions/download-artifact@v3 + with: + name: bindists-arm + path: ./out + + - uses: docker://hasufell/arm64v8-ubuntu-haskell:focal + name: Run test (aarch64 linux) + with: + args: bash .github/scripts/test.sh + + test-mac-x86_64: + name: Test binary (Mac x86_64) + runs-on: macOS-10.15 + needs: ["bindist-mac-x86_64"] + env: + MACOSX_DEPLOYMENT_TARGET: 10.13 + ARTIFACT: "x86_64-apple-darwin" + ARCH: 64 + TARBALL_EXT: tar.xz + DISTRO: na + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - uses: actions/download-artifact@v3 + with: + name: bindists-mac-x86_64 + path: ./out + + - name: Run test (mac) + run: | + brew install coreutils tree + bash .github/scripts/test.sh + + test-mac-aarch64: + name: Test binary (Mac aarch64) + runs-on: [self-hosted, macOS, ARM64] + needs: ["bindist-mac-aarch64"] + env: + MACOSX_DEPLOYMENT_TARGET: 10.13 + ARTIFACT: "aarch64-apple-darwin" + ARCH: ARM64 + TARBALL_EXT: tar.xz + DISTRO: n + HOMEBREW_CHANGE_ARCH_TO_ARM: 1 + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - uses: actions/download-artifact@v3 + with: + name: bindists-mac-aarch64 + path: ./out + + - name: Run test (mac) + run: | + bash .github/scripts/brew.sh git coreutils llvm@11 autoconf automake tree + export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$HOME/.brew/opt/llvm@11/bin:$PATH" + export CC="$HOME/.brew/opt/llvm@11/bin/clang" + export CXX="$HOME/.brew/opt/llvm@11/bin/clang++" + export LD=ld + export AR="$HOME/.brew/opt/llvm@11/bin/llvm-ar" + export RANLIB="$HOME/.brew/opt/llvm@11/bin/llvm-ranlib" + bash .github/scripts/test.sh + + test-win: + name: Test binary (Win) + runs-on: windows-latest + needs: ["bindist-win"] + env: + ARTIFACT: "x86_64-mingw64" + ARCH: 64 + TARBALL_EXT: zip + DISTRO: na + strategy: + fail-fast: false + steps: + - name: install windows deps + shell: pwsh + run: | + C:\msys64\usr\bin\bash -lc "pacman --disable-download-timeout --noconfirm -Syuu" + C:\msys64\usr\bin\bash -lc "pacman --disable-download-timeout --noconfirm -Syuu" + C:\msys64\usr\bin\bash -lc "pacman --disable-download-timeout --noconfirm -S make mingw-w64-x86_64-clang curl autoconf mingw-w64-x86_64-pkgconf ca-certificates base-devel gettext autoconf make libtool automake python p7zip patch unzip zip git" + taskkill /F /FI "MODULES eq msys-2.0.dll" + + - name: Checkout code + uses: actions/checkout@v3 + + - uses: actions/download-artifact@v3 + with: + name: bindists-win + path: ./out + + - name: Run test (windows) + run: | + $env:CHERE_INVOKING = 1 + $env:MSYS2_PATH_TYPE = "inherit" + C:\msys64\usr\bin\bash -lc "bash .github/scripts/test.sh" + shell: pwsh + + release: + name: release + needs: ["test-linux", "test-mac-x86_64", "test-mac-aarch64", "test-win", "test-arm"] + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - uses: actions/download-artifact@v3 + with: + path: ./out + name: bindists-x86_64-linux-deb9 + - uses: actions/download-artifact@v3 + with: + path: ./out + name: bindists-x86_64-linux-deb10 + - uses: actions/download-artifact@v3 + with: + path: ./out + name: bindists-x86_64-linux-deb11 + - uses: actions/download-artifact@v3 + with: + path: ./out + name: bindists-x86_64-linux-ubuntu18.04 + - uses: actions/download-artifact@v3 + with: + path: ./out + name: bindists-x86_64-linux-ubuntu20.04 + - uses: actions/download-artifact@v3 + with: + path: ./out + name: bindists-x86_64-linux-ubuntu22.04 + - uses: actions/download-artifact@v3 + with: + path: ./out + name: bindists-x86_64-linux-fedora27 + - uses: actions/download-artifact@v3 + with: + path: ./out + name: bindists-x86_64-linux-fedora33 + - uses: actions/download-artifact@v3 + with: + path: ./out + name: bindists-x86_64-linux-centos7 + - uses: actions/download-artifact@v3 + with: + path: ./out + name: bindists-x86_64-linux-unknown + - uses: actions/download-artifact@v3 + with: + path: ./out + name: bindists-x86_64-linux-mint19.3 + - uses: actions/download-artifact@v3 + with: + path: ./out + name: bindists-x86_64-linux-mint20.2 + + - uses: actions/download-artifact@v3 + with: + name: bindists-arm + path: ./out + + - uses: actions/download-artifact@v3 + with: + name: bindists-mac-x86_64 + path: ./out + + - uses: actions/download-artifact@v3 + with: + name: bindists-mac-aarch64 + path: ./out + + - uses: actions/download-artifact@v3 + with: + name: bindists-win + path: ./out + + - name: Install requirements + run: | + sudo apt-get update && sudo apt-get install -y tar xz-utils + shell: bash + + - name: tar plan.json + run: | + cd out/plan.json + tar cf plan_json.tar * + mv plan_json.tar ../ + shell: bash + + - name: build source tarball + run: | + export RELEASE=$GITHUB_REF_NAME + git archive --format=tar.gz -o "out/haskell-language-server-${RELEASE}-src.tar.gz" --prefix="haskell-language-server-${RELEASE}/" HEAD + shell: bash + + - name: Release + uses: softprops/action-gh-release@v1 + with: + draft: true + files: | + ./out/*.zip + ./out/*.tar.xz + ./out/*.tar.gz + ./out/*.tar diff --git a/.github/workflows/s3-cache.yaml b/.github/workflows/s3-cache.yaml new file mode 100644 index 000000000..fa2e97dee --- /dev/null +++ b/.github/workflows/s3-cache.yaml @@ -0,0 +1,43 @@ +name: Cache eviction + +on: + workflow_dispatch: + inputs: + key: + description: Which cache to evict + required: true + default: '/' + type: choice + options: + - aarch64-apple-darwin + - aarch64-linux-ubuntu20 + - x86_64-apple-darwin + - x86_64-freebsd + - x86_64-linux-centos7 + - x86_64-linux-deb10 + - x86_64-linux-deb11 + - x86_64-linux-deb9 + - x86_64-linux-fedora27 + - x86_64-linux-fedora33 + - x86_64-linux-mint19.3 + - x86_64-linux-mint20.2 + - x86_64-linux-ubuntu18.04 + - x86_64-linux-ubuntu20.04 + - x86_64-linux-ubuntu22.04 + - / +jobs: + evict: + runs-on: ubuntu-latest + + steps: + - name: Remove from S3 + uses: vitorsgomes/s3-rm-action@master + with: + args: --recursive + env: + AWS_S3_ENDPOINT: https://${{ secrets.S3_HOST }} + AWS_S3_BUCKET: haskell-language-server + AWS_REGION: us-west-2 + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + PATH_TO_DELETE: ${{ github.event.inputs.key }} diff --git a/.gitignore b/.gitignore index 1cf8b239a..55f013b8d 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,4 @@ result-doc out/ store/ +gh-release-artifacts/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index b1404779a..000000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,606 +0,0 @@ -stages: - - build - - tar - - test - -# Used for ci setup in the gitlab mirror of the project: -# https://gitlab.haskell.org/haskell/haskell-language-server/-/pipelines -variables: - # Commit of ghc/ci-images repository from which to pull Docker images - DOCKER_REV: "9e4c540d9e4972a36291dfdf81f079f37d748890" - - CABAL_INSTALL_VERSION: 3.8.1.0 - -.matrix: &matrix - matrix: - - GHC_VERSION: 8.10.7 - CABAL_PROJECT: cabal.project - - GHC_VERSION: 9.0.2 - CABAL_PROJECT: cabal.project - - GHC_VERSION: 9.2.5 - CABAL_PROJECT: cabal.project - - GHC_VERSION: 9.4.3 - CABAL_PROJECT: cabal.project - - GHC_VERSION: 9.4.4 - CABAL_PROJECT: cabal.project - -workflow: - rules: - - if: $CI_COMMIT_TAG - when: always - - if: $CI_PIPELINE_SOURCE == "web" - when: always - - when: never - -.artifacts: - artifacts: - expire_in: 2 week - paths: - - out - -.artifacts:short: - artifacts: - expire_in: 1 day - paths: - - out - -.build: - extends: .artifacts:short - stage: build - parallel: *matrix - script: - - bash .gitlab/ci.sh - -.test: - stage: test - script: - - bash .gitlab/test.sh - -.aarch64-linux: - tags: - - aarch64-linux - image: "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb10:$DOCKER_REV" - -.armv7-linux: - tags: - - armv7-linux - image: "registry.gitlab.haskell.org/ghc/ci-images/armv7-linux-deb10:$DOCKER_REV" - -.x86_64-linux-deb10: - tags: - - x86_64-linux - image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV" - -.x86_64-linux-deb9: - tags: - - x86_64-linux - image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV" - -.x86_64-linux-ubuntu18.04: - tags: - - x86_64-linux - image: "ubuntu:18.04" - -.x86_64-linux-ubuntu20.04: - tags: - - x86_64-linux - image: "ubuntu:20.04" - -.x86_64-linux-centos7: - tags: - - x86_64-linux - image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-centos7:$DOCKER_REV" - -.x86_64-linux-fedora33: - tags: - - x86_64-linux - image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-fedora33:$DOCKER_REV" - -.x86_64-linux-alpine: - tags: - - x86_64-linux - image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-alpine3_12:$DOCKER_REV" - - -###################### -# aarch64 linux deb10 -###################### - -build-aarch64-linux-deb10: - extends: - - .build - - .aarch64-linux - before_script: - - sudo apt update - - sudo apt install -y patchelf tree - variables: - ADD_CABAL_ARGS: "" - -tar-aarch64-linux-deb10: - extends: - - .artifacts - - .aarch64-linux - stage: tar - needs: ["build-aarch64-linux-deb10"] - script: - - ./.gitlab/tar.sh - variables: - TARBALL_ARCHIVE_SUFFIX: aarch64-deb10-linux - TARBALL_EXT: tar.xz - -test-aarch64-linux-deb10: - extends: - - .test - - .aarch64-linux - needs: ["tar-aarch64-linux-deb10"] - before_script: - - sudo apt update - - sudo apt install -y tree - - -###################### -# armv7 linux deb10 -###################### - -build-armv7-linux-deb10: - extends: - - .build - - .armv7-linux - before_script: - - sudo apt update - - sudo apt install -y patchelf tree - variables: - ADD_CABAL_ARGS: "" - -tar-armv7-linux-deb10: - extends: - - .artifacts - - .armv7-linux - stage: tar - needs: ["build-armv7-linux-deb10"] - script: - - ./.gitlab/tar.sh - variables: - TARBALL_ARCHIVE_SUFFIX: armv7-deb10-linux - TARBALL_EXT: tar.xz - -test-armv7-linux-deb10: - extends: - - .test - - .armv7-linux - needs: ["tar-armv7-linux-deb10"] - before_script: - - sudo apt update - - sudo apt install -y tree - - -########################### -# x86_64 linux ubuntu18.04 -########################### - -build-x86_64-linux-ubuntu18.04: - extends: - - .build - - .x86_64-linux-ubuntu18.04 - before_script: - - apt update - - apt install -y build-essential curl libffi-dev libffi6 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5 zlib1g-dev patchelf tree - variables: - ADD_CABAL_ARGS: "--enable-split-sections" - -tar-x86_64-linux-ubuntu18.04: - extends: - - .artifacts - - .x86_64-linux-ubuntu18.04 - stage: tar - needs: ["build-x86_64-linux-ubuntu18.04"] - script: - - ./.gitlab/tar.sh - variables: - TARBALL_ARCHIVE_SUFFIX: x86_64-ubuntu18.04-linux - TARBALL_EXT: tar.xz - before_script: - - apt update - - apt install -y make tar xz-utils curl - -test-x86_64-linux-ubuntu18.04: - extends: - - .test - - .x86_64-linux-ubuntu18.04 - needs: ["tar-x86_64-linux-ubuntu18.04"] - before_script: - - apt update - - apt install -y tree patchelf make curl build-essential - - -########################### -# x86_64 linux ubuntu20.04 -########################### - -build-x86_64-linux-ubuntu20.04: - extends: - - .build - - .x86_64-linux-ubuntu20.04 - before_script: - - apt update - - apt install -y build-essential curl libffi-dev libffi7 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5 zlib1g-dev patchelf tree - variables: - ADD_CABAL_ARGS: "--enable-split-sections" - -tar-x86_64-linux-ubuntu20.04: - extends: - - .artifacts - - .x86_64-linux-ubuntu20.04 - stage: tar - needs: ["build-x86_64-linux-ubuntu20.04"] - script: - - ./.gitlab/tar.sh - variables: - TARBALL_ARCHIVE_SUFFIX: x86_64-ubuntu20.04-linux - TARBALL_EXT: tar.xz - before_script: - - apt update - - apt install -y make tar xz-utils curl - -test-x86_64-linux-ubuntu20.04: - extends: - - .test - - .x86_64-linux-ubuntu20.04 - needs: ["tar-x86_64-linux-ubuntu20.04"] - before_script: - - apt update - - apt install -y tree patchelf make curl build-essential - - -###################### -# x86_64 linux deb10 -###################### - -build-x86_64-linux-deb10: - extends: - - .build - - .x86_64-linux-deb10 - before_script: - - sudo apt update - - sudo apt install -y patchelf tree - variables: - ADD_CABAL_ARGS: "--enable-split-sections" - -tar-x86_64-linux-deb10: - extends: - - .artifacts - - .x86_64-linux-deb10 - stage: tar - needs: ["build-x86_64-linux-deb10"] - script: - - ./.gitlab/tar.sh - variables: - TARBALL_ARCHIVE_SUFFIX: x86_64-deb10-linux - TARBALL_EXT: tar.xz - -test-x86_64-linux-deb10: - extends: - - .test - - .x86_64-linux-deb10 - needs: ["tar-x86_64-linux-deb10"] - before_script: - - sudo apt update - - sudo apt install -y tree - -###################### -# x86_64 linux deb9 -###################### - -build-x86_64-linux-deb9: - extends: - - .build - - .x86_64-linux-deb9 - before_script: - - sudo apt update - - sudo apt install -y patchelf tree - variables: - ADD_CABAL_ARGS: "--enable-split-sections" - -tar-x86_64-linux-deb9: - extends: - - .artifacts - - .x86_64-linux-deb9 - stage: tar - needs: ["build-x86_64-linux-deb9"] - script: - - ./.gitlab/tar.sh - variables: - TARBALL_ARCHIVE_SUFFIX: x86_64-deb9-linux - TARBALL_EXT: tar.xz - -test-x86_64-linux-deb9: - extends: - - .test - - .x86_64-linux-deb9 - needs: ["tar-x86_64-linux-deb9"] - before_script: - - sudo apt update - - sudo apt install -y tree - -###################### -# x86_64 linux centos7 -###################### - -build-x86_64-linux-centos7: - extends: - - .build - - .x86_64-linux-centos7 - before_script: - - sudo yum install -y epel-release - - sudo yum install -y patchelf tree - variables: - ADD_CABAL_ARGS: "--enable-split-sections" - -tar-x86_64-linux-centos7: - extends: - - .artifacts - - .x86_64-linux-centos7 - stage: tar - needs: ["build-x86_64-linux-centos7"] - script: - - ./.gitlab/tar.sh - variables: - TARBALL_ARCHIVE_SUFFIX: x86_64-centos7-linux - TARBALL_EXT: tar.xz - -test-x86_64-linux-centos7: - extends: - - .test - - .x86_64-linux-centos7 - needs: ["tar-x86_64-linux-centos7"] - before_script: - - sudo yum install -y tree - -###################### -# x86_64 linux fedora33 -###################### - -build-x86_64-linux-fedora33: - extends: - - .build - - .x86_64-linux-fedora33 - before_script: - - sudo dnf install -y patchelf tree - variables: - ADD_CABAL_ARGS: "--enable-split-sections" - -tar-x86_64-linux-fedora33: - extends: - - .artifacts - - .x86_64-linux-fedora33 - stage: tar - needs: ["build-x86_64-linux-fedora33"] - script: - - ./.gitlab/tar.sh - variables: - TARBALL_ARCHIVE_SUFFIX: x86_64-fedora33-linux - TARBALL_EXT: tar.xz - -test-x86_64-linux-fedora33: - extends: - - .test - - .x86_64-linux-fedora33 - needs: ["tar-x86_64-linux-fedora33"] - before_script: - - sudo dnf install -y tree - - -###################### -# x86_64 linux alpine -###################### - -build-x86_64-linux-alpine: - extends: - - .build - - .x86_64-linux-alpine - before_script: - - sudo apk add --no-cache tar zlib zlib-dev zlib-static bzip2 bzip2-dev bzip2-static gmp gmp-dev xz xz-dev ncurses-static patchelf findutils tree - variables: - ADD_CABAL_ARGS: "--enable-split-sections --enable-executable-static" - -tar-x86_64-linux-alpine: - extends: - - .artifacts - - .x86_64-linux-alpine - stage: tar - needs: ["build-x86_64-linux-alpine"] - before_script: - - sudo apk add --no-cache tar zlib zlib-dev zlib-static bzip2 bzip2-dev bzip2-static gmp gmp-dev xz xz-dev ncurses-static - script: - - ./.gitlab/tar.sh - variables: - TARBALL_ARCHIVE_SUFFIX: x86_64-alpine3.12-linux - TARBALL_EXT: tar.xz - -test-x86_64-linux-alpine: - extends: - - .test - - .x86_64-linux-alpine - needs: ["tar-x86_64-linux-alpine"] - before_script: - - sudo apk add --no-cache tar zlib zlib-dev zlib-static bzip2 bzip2-dev bzip2-static gmp gmp-dev xz xz-dev ncurses-static tree - - -###################### -# x86_64 freebsd 12 -###################### - -build-x86_64-freebsd12: - extends: .build - before_script: - - sudo pkg update - - sudo pkg install --yes patchelf gmake tree binutils - tags: - - x86_64-freebsd12 - variables: - ADD_CABAL_ARGS: "--enable-split-sections -j1" - -tar-x86_64-freebsd12: - extends: .artifacts - stage: tar - needs: ["build-x86_64-freebsd12"] - tags: - - x86_64-freebsd12 - script: - - ./.gitlab/tar.sh - variables: - TARBALL_ARCHIVE_SUFFIX: x86_64-unknown-freebsd12 - TARBALL_EXT: tar.xz - -test-x86_64-freebsd12: - extends: .test - needs: ["tar-x86_64-freebsd12"] - tags: - - x86_64-freebsd12 - before_script: - - sudo pkg update - - sudo pkg install --yes patchelf gmake tree binutils - - -###################### -# x86_64 freebsd 13 -###################### - -build-x86_64-freebsd13: - extends: .build - tags: - - x86_64-freebsd13 - before_script: - - sudo pkg update - - sudo pkg install --yes compat12x-amd64 patchelf gmake tree binutils - - sudo ln -s libncurses.so.6 /usr/local/lib/libncurses.so.6.2 - variables: - ADD_CABAL_ARGS: "--enable-split-sections -j1" - -tar-x86_64-freebsd13: - extends: .artifacts - stage: tar - needs: ["build-x86_64-freebsd13"] - tags: - - x86_64-freebsd13 - script: - - ./.gitlab/tar.sh - variables: - TARBALL_ARCHIVE_SUFFIX: x86_64-unknown-freebsd13 - TARBALL_EXT: tar.xz - -test-x86_64-freebsd13: - extends: .test - needs: ["tar-x86_64-freebsd13"] - tags: - - x86_64-freebsd13 - before_script: - - sudo pkg update - - sudo pkg install --yes compat12x-amd64 gmake tree binutils - - sudo ln -s libncurses.so.6 /usr/local/lib/libncurses.so.6.2 - - -###################### -# x86_64 darwin -###################### - -build-x86_64-darwin: - extends: .build - tags: - - x86_64-darwin-m1 - variables: - ADD_CABAL_ARGS: "" - NIX_SYSTEM: x86_64-darwin - script: | - /bin/bash ./.gitlab/ci.sh - -tar-x86_64-darwin: - extends: .artifacts - stage: tar - needs: ["build-x86_64-darwin"] - tags: - - x86_64-darwin-m1 - script: | - /bin/bash ./.gitlab/tar.sh - variables: - TARBALL_ARCHIVE_SUFFIX: x86_64-apple-darwin - TARBALL_EXT: tar.xz - NIX_SYSTEM: x86_64-darwin - -test-x86_64-darwin: - extends: .test - needs: ["tar-x86_64-darwin"] - tags: - - x86_64-darwin-m1 - script: | - /bin/bash .gitlab/test.sh - variables: - NIX_SYSTEM: x86_64-darwin - - -###################### -# aarch64 darwin -###################### - -build-aarch64-darwin: - extends: .build - stage: build - tags: - - aarch64-darwin-m1 - script: | - arch -arm64 /bin/bash ./.gitlab/ci.sh - variables: - MACOSX_DEPLOYMENT_TARGET: "10.7" - ADD_CABAL_ARGS: "" - NIX_SYSTEM: aarch64-darwin - -tar-aarch64-darwin: - extends: .artifacts - stage: tar - needs: ["build-aarch64-darwin"] - tags: - - aarch64-darwin-m1 - script: - - arch -arm64 /bin/bash ./.gitlab/tar.sh - variables: - TARBALL_ARCHIVE_SUFFIX: aarch64-apple-darwin - TARBALL_EXT: tar.xz - NIX_SYSTEM: aarch64-darwin - -test-aarch64-darwin: - extends: .test - needs: ["tar-aarch64-darwin"] - tags: - - aarch64-darwin-m1 - script: | - arch -arm64 /bin/bash ./.gitlab/test.sh - variables: - NIX_SYSTEM: aarch64-darwin - - -###################### -# x86_64 windows -###################### - -build-x86_64-windows: - extends: .build - tags: - - new-x86_64-windows - script: - - $env:CHERE_INVOKING = "yes" - - bash '-lc' "ADD_CABAL_ARGS=$env:ADD_CABAL_ARGS GHC_VERSION=$env:GHC_VERSION CABAL_INSTALL_VERSION=$CABAL_INSTALL_VERSION .gitlab/ci.sh" - variables: - ADD_CABAL_ARGS: "" - -tar-x86_64-windows: - extends: .artifacts - stage: tar - needs: ["build-x86_64-windows"] - tags: - - new-x86_64-windows - script: - - $env:CHERE_INVOKING = "yes" - - bash '-lc' "TARBALL_ARCHIVE_SUFFIX=$env:TARBALL_ARCHIVE_SUFFIX TARBALL_EXT=$env:TARBALL_EXT .gitlab/tar.sh" - variables: - TARBALL_ARCHIVE_SUFFIX: x86_64-unknown-mingw32 - TARBALL_EXT: zip diff --git a/.gitlab/ci.sh b/.gitlab/ci.sh deleted file mode 100755 index 0d784e646..000000000 --- a/.gitlab/ci.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env bash - -set -Eeuxo pipefail - -source "$CI_PROJECT_DIR/.gitlab/common.sh" -source "$CI_PROJECT_DIR/.gitlab/setup.sh" - -export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR/toolchain" -export CABAL_DIR="$CI_PROJECT_DIR/cabal" -EXE_EXTENSION="" - -case "$(uname)" in - MSYS_*|MINGW*) - export CABAL_DIR="$(cygpath -w "$CABAL_DIR")" - GHCUP_BINDIR="${GHCUP_INSTALL_BASE_PREFIX}/ghcup/bin" - EXE_EXTENSION=".exe" - ;; - *) - GHCUP_BINDIR="${GHCUP_INSTALL_BASE_PREFIX}/.ghcup/bin" - ;; -esac - -mkdir -p "$CABAL_DIR" -mkdir -p "$GHCUP_BINDIR" -export PATH="$GHCUP_BINDIR:$PATH" - -export BOOTSTRAP_HASKELL_NONINTERACTIVE=1 -export BOOTSTRAP_HASKELL_GHC_VERSION="${GHC_VERSION:-recommended}" -export BOOTSTRAP_HASKELL_CABAL_VERSION="$CABAL_INSTALL_VERSION" -export BOOTSTRAP_HASKELL_VERBOSE=1 -export BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 -export BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=yes - -# for some reason the subshell doesn't pick up the arm64 environment on darwin -# and starts installing x86_64 GHC -case "$(uname -s)" in - "Darwin"|"darwin") - case "$(/usr/bin/arch)" in - aarch64|arm64|armv8l) - curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | arch -arm64 /bin/bash - export C_INCLUDE_PATH="`xcrun --show-sdk-path`/usr/include/ffi" - ;; - *) - curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh - ;; - esac - ;; - *) - curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh - ;; -esac - -case "$(uname)" in - MSYS_*|MINGW*) - # workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/21196 - # export PATH="${GHCUP_INSTALL_BASE_PREFIX}/ghcup/ghc/${GHC_VERSION}/mingw/bin:${GHCUP_INSTALL_BASE_PREFIX}/ghcup/ghc/${GHC_VERSION}/mingw/usr/bin:$PATH" - # ls ${GHCUP_INSTALL_BASE_PREFIX}/ghcup/ghc/${GHC_VERSION}/mingw/bin - # cp ${GHCUP_INSTALL_BASE_PREFIX}/ghcup/ghc/${GHC_VERSION}/mingw/bin/libgcc_s_seh-1.dll ${GHCUP_INSTALL_BASE_PREFIX}/ghcup/ghc/${GHC_VERSION}/bin - # cp ${GHCUP_INSTALL_BASE_PREFIX}/ghcup/ghc/${GHC_VERSION}/mingw/bin/libwinpthread-1.dll ${GHCUP_INSTALL_BASE_PREFIX}/ghcup/ghc/${GHC_VERSION}/bin - ghc --info - # Shorten binary names - sed -i.bak -e 's/haskell-language-server/hls/g' \ - -e 's/haskell_language_server/hls/g' \ - haskell-language-server.cabal $CABAL_PROJECT - sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \ - src/**/*.hs exe/*.hs - - args=( - -O2 - -w "ghc-$GHC_VERSION" - --project-file "$CABAL_PROJECT" - --disable-profiling - --disable-tests - --enable-executable-stripping - ${ADD_CABAL_ARGS} - ) - - run cabal v2-build ${args[@]} exe:hls exe:hls-wrapper - - mkdir "$CI_PROJECT_DIR/out" - - cp "$(cabal list-bin -v0 ${args[@]} exe:hls)" "$CI_PROJECT_DIR/out/haskell-language-server-${GHC_VERSION}"$EXE_EXTENSION - cp "$(cabal list-bin -v0 ${args[@]} exe:hls-wrapper)" "$CI_PROJECT_DIR/out/haskell-language-server-wrapper"$EXE_EXTENSION - ;; - *) - sed -i.bak -e '/DELETE MARKER FOR CI/,/END DELETE/d' cabal.project # see comment in cabal.project - emake --version - emake GHCUP=ghcup hls-ghc - emake GHCUP=ghcup bindist-ghc - rm -rf out/*.*.* - ;; -esac - -cp dist-newstyle/cache/plan.json "$CI_PROJECT_DIR/out/plan.json" - -cd "$CI_PROJECT_DIR/out/" diff --git a/.gitlab/common.sh b/.gitlab/common.sh deleted file mode 100644 index 957b4fdc3..000000000 --- a/.gitlab/common.sh +++ /dev/null @@ -1,68 +0,0 @@ -# Common bash utilities -# ---------------------- - -# Colors -BLACK="0;30" -GRAY="1;30" -RED="0;31" -LT_RED="1;31" -BROWN="0;33" -LT_BROWN="1;33" -GREEN="0;32" -LT_GREEN="1;32" -BLUE="0;34" -LT_BLUE="1;34" -PURPLE="0;35" -LT_PURPLE="1;35" -CYAN="0;36" -LT_CYAN="1;36" -WHITE="1;37" -LT_GRAY="0;37" - -# GitLab Pipelines log section delimiters -# https://gitlab.com/gitlab-org/gitlab-foss/issues/14664 -start_section() { - name="$1" - echo -e "section_start:$(date +%s):$name\015\033[0K" -} - -end_section() { - name="$1" - echo -e "section_end:$(date +%s):$name\015\033[0K" -} - -echo_color() { - local color="$1" - local msg="$2" - echo -e "\033[${color}m${msg}\033[0m" -} - -error() { echo_color "${RED}" "$1"; } -warn() { echo_color "${LT_BROWN}" "$1"; } -info() { echo_color "${LT_BLUE}" "$1"; } - -fail() { error "error: $1"; exit 1; } - -function run() { - info "Running $*..." - "$@" || ( error "$* failed"; return 1; ) -} - -emake() { - if command -v gmake >/dev/null 2>&1 ; then - gmake "$@" - else - make "$@" - fi -} - -mktempdir() { - case "$(uname -s)" in - "Darwin"|"darwin") - mktemp -d -t hls_ci.XXXXXXX - ;; - *) - mktemp -d - ;; - esac -} diff --git a/.gitlab/tar.sh b/.gitlab/tar.sh deleted file mode 100755 index 65ee94389..000000000 --- a/.gitlab/tar.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -set -Eeuxo pipefail - -source "$CI_PROJECT_DIR/.gitlab/common.sh" -source "$CI_PROJECT_DIR/.gitlab/setup.sh" - - -# create tarball/zip -case "${TARBALL_EXT}" in - zip) - TARBALL_PREFIX="haskell-language-server" - HLS_VERSION="$("$CI_PROJECT_DIR/out/haskell-language-server-8.10.7" --numeric-version)" - cd out/ - zip "${TARBALL_PREFIX}-${HLS_VERSION}-${TARBALL_ARCHIVE_SUFFIX}.zip" haskell-language-server-* - find . -type f ! -name '*.zip' -delete - ;; - tar.xz) - ls -la out/ - ls -la out/bindist/ - ls -la out/bindist/*/ - emake --version - emake bindist - emake bindist-tar - rm -rf out/bindist - ;; - *) - fail "Unknown TARBALL_EXT: ${TARBALL_EXT}" - ;; -esac - - diff --git a/.gitlab/test.sh b/.gitlab/test.sh deleted file mode 100644 index 3c866c498..000000000 --- a/.gitlab/test.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/env bash - -set -Eeuxo pipefail - -source "$CI_PROJECT_DIR/.gitlab/common.sh" -source "$CI_PROJECT_DIR/.gitlab/setup.sh" - -export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR/toolchain" -export CABAL_DIR="$CI_PROJECT_DIR/cabal" - -case "$(uname)" in - MSYS_*|MINGW*) - export CABAL_DIR="$(cygpath -w "$CABAL_DIR")" - GHCUP_BINDIR="${GHCUP_INSTALL_BASE_PREFIX}/ghcup/bin" - ;; - *) - GHCUP_BINDIR="${GHCUP_INSTALL_BASE_PREFIX}/.ghcup/bin" - ;; -esac - -mkdir -p "$CABAL_DIR" -mkdir -p "$GHCUP_BINDIR" -export PATH="$GHCUP_BINDIR:$PATH" - -export BOOTSTRAP_HASKELL_NONINTERACTIVE=1 -export BOOTSTRAP_HASKELL_GHC_VERSION="${GHC_VERSION:-recommended}" -export BOOTSTRAP_HASKELL_CABAL_VERSION="$CABAL_INSTALL_VERSION" -export BOOTSTRAP_HASKELL_VERBOSE=1 -export BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=yes - -# for some reason the subshell doesn't pick up the arm64 environment on darwin -# and starts installing x86_64 GHC -case "$(uname -s)" in - "Darwin"|"darwin") - case "$(/usr/bin/arch)" in - aarch64|arm64|armv8l) - curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | arch -arm64 /bin/bash - ;; - *) - curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh - ;; - esac - ;; - *) - curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh - ;; -esac - -# case "$(uname)" in -# MSYS_*|MINGW*) -# # workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/21196 -# export PATH="${GHCUP_INSTALL_BASE_PREFIX}/ghcup/ghc/${GHC_VERSION}/mingw/bin:${GHCUP_INSTALL_BASE_PREFIX}/ghcup/ghc/${GHC_VERSION}/mingw/usr/bin:$PATH" -# ls ${GHCUP_INSTALL_BASE_PREFIX}/ghcup/ghc/${GHC_VERSION}/mingw/bin -# cp ${GHCUP_INSTALL_BASE_PREFIX}/ghcup/ghc/${GHC_VERSION}/mingw/bin/libgcc_s_seh-1.dll ${GHCUP_INSTALL_BASE_PREFIX}/ghcup/ghc/${GHC_VERSION}/bin -# cp ${GHCUP_INSTALL_BASE_PREFIX}/ghcup/ghc/${GHC_VERSION}/mingw/bin/libwinpthread-1.dll ${GHCUP_INSTALL_BASE_PREFIX}/ghcup/ghc/${GHC_VERSION}/bin -# ghc --info -# ;; -# *) ;; -# esac - -# make sure out/ dir is gone, so build host rpaths don't -# kick in (TODO: we should probably remove those) -mv "$CI_PROJECT_DIR/out"/*.tar.xz . -rm -rf "$CI_PROJECT_DIR/out/" - -# cleanup from previous dirty runs -rm -rf "$HOME"/.local/lib/haskell-language-server-* || true - -# install -tar xf *.tar.xz -rm *.tar.xz -cd haskell-language-server-* -INSTALL_DIR=$(dirname "${GHCUP_BINDIR}") || exit 1 -[ -d "$INSTALL_DIR" ] || exit 1 -emake PREFIX="${INSTALL_DIR}" install - -# print rpaths and libdirs -case "$(uname -s)" in - "Darwin"|"darwin") - otool -l "$INSTALL_DIR"/lib/haskell-language-server-*/bin/haskell-language-server-* - ;; - *) - objdump -x "$INSTALL_DIR"/lib/haskell-language-server-*/bin/haskell-language-server-* - ;; -esac -tree "$INSTALL_DIR"/lib/haskell-language-server-* -tree "$INSTALL_DIR"/bin - -tmp_dir=$(mktempdir) -cd "$tmp_dir" -cabal unpack bytestring-0.11.1.0 -cd bytestring-0.11.1.0 -echo "cradle:" > hie.yaml -echo " cabal:" >> hie.yaml -haskell-language-server-wrapper typecheck Data/ByteString.hs diff --git a/GNUmakefile b/GNUmakefile index 3fc906f33..b6e192503 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -11,10 +11,10 @@ UNAME := $(shell uname) ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) GHC_VERSION ?= -TARBALL_ARCHIVE_SUFFIX ?= +ARTIFACT ?= unknown-platform HLS_VERSION := $(shell grep '^version:' haskell-language-server.cabal | awk '{ print $$2 }') -TARBALL ?= haskell-language-server-$(HLS_VERSION)-$(TARBALL_ARCHIVE_SUFFIX).tar.xz +TARBALL ?= haskell-language-server-$(HLS_VERSION)-$(ARTIFACT).tar.xz CHMOD := chmod CHMOD_X := $(CHMOD) 755 @@ -29,7 +29,6 @@ MKDIR_P := $(MKDIR) -p TAR := tar TAR_MK := $(TAR) caf CABAL := cabal -AWK := awk STRIP := strip ifeq ($(UNAME), Darwin) STRIP_S := strip @@ -39,9 +38,13 @@ endif RM := rm RM_RF := $(RM) -rf CD := cd +CP := cp # by default don't run ghcup -GHCUP ?= echo +GHCUP ?= echo +GHCUP_GC ?= $(GHCUP) gc + +CABAL_CACHE_BIN ?= echo ifeq ($(UNAME), Darwin) DLL := *.dylib @@ -51,13 +54,18 @@ endif INSTALL_NAME_TOOL := install_name_tool -STORE_DIR := store -BINDIST_BASE_DIR := out/bindist +STORE_DIR := store/$(ARTIFACT) +BINDIST_BASE_DIR := out/bindist/$(ARTIFACT) BINDIST_OUT_DIR := $(BINDIST_BASE_DIR)/haskell-language-server-$(HLS_VERSION) -CABAL_ARGS ?= --store-dir=$(ROOT_DIR)/$(STORE_DIR) -CABAL_INSTALL_ARGS ?= --disable-tests --disable-profiling -O2 --overwrite-policy=always --install-method=copy -CABAL_INSTALL := $(CABAL) $(CABAL_ARGS) v2-install +CABAL_BASE_ARGS ?= --store-dir=$(ROOT_DIR)/$(STORE_DIR) +CABAL_ARGS ?= --disable-tests --disable-profiling -O2 +CABAL_INSTALL_ARGS ?= --overwrite-policy=always --install-method=copy +CABAL_INSTALL := $(CABAL) $(CABAL_BASE_ARGS) v2-install +PROJECT_FILE := cabal.project + +S3_HOST ?= +S3_KEY ?= # set rpath relative to the current executable # TODO: on darwin, this doesn't overwrite rpath, but just adds to it, @@ -66,15 +74,42 @@ define set_rpath $(if $(filter Darwin,$(UNAME)), $(INSTALL_NAME_TOOL) -add_rpath "@executable_path/$(1)" "$(2)", $(PATCHELF) --force-rpath --set-rpath "\$$ORIGIN/$(1)" "$(2)") endef +define sync_from + $(CABAL_CACHE_BIN) sync-from-archive --host-name-override=$(S3_HOST) --host-port-override=443 --host-ssl-override=True --region us-west-2 --store-path="$(ROOT_DIR)/$(STORE_DIR)" --archive-uri "s3://haskell-language-server/$(S3_KEY)" +endef + +define sync_to + $(CABAL_CACHE_BIN) sync-to-archive --host-name-override=$(S3_HOST) --host-port-override=443 --host-ssl-override=True --region us-west-2 --store-path="$(ROOT_DIR)/$(STORE_DIR)" --archive-uri "s3://haskell-language-server/$(S3_KEY)" +endef + +hls: + @if test -z "$(GHCS)" ; then echo >&2 "GHCS is not set" ; false ; fi + for ghc in $(GHCS) ; do \ + $(GHCUP) install ghc `echo $$ghc` && \ + $(GHCUP_GC) -p -s -c -t && \ + $(MAKE) GHC_VERSION=`echo $$ghc` hls-ghc || exit 1 ; \ + done + hls-ghc: - $(MKDIR_P) out/ + $(MKDIR_P) out/$(ARTIFACT) + $(MKDIR_P) out/plan.json @if test -z "$(GHC_VERSION)" ; then echo >&2 "GHC_VERSION is not set" ; false ; fi - @if test -z "$(CABAL_PROJECT)" ; then echo >&2 "CABAL_PROJECT is not set" ; false ; fi - $(CABAL_INSTALL) --project-file="$(CABAL_PROJECT)" -w "ghc-$(GHC_VERSION)" $(CABAL_INSTALL_ARGS) --installdir="$(ROOT_DIR)/out/$(GHC_VERSION)" exe:haskell-language-server exe:haskell-language-server-wrapper - $(STRIP_S) "$(ROOT_DIR)/out/$(GHC_VERSION)/haskell-language-server" - $(STRIP_S) "$(ROOT_DIR)/out/$(GHC_VERSION)/haskell-language-server-wrapper" + $(CABAL) $(CABAL_BASE_ARGS) configure --project-file="$(PROJECT_FILE)" -w "ghc-$(GHC_VERSION)" $(CABAL_ARGS) exe:haskell-language-server exe:haskell-language-server-wrapper + $(CABAL) $(CABAL_BASE_ARGS) build --project-file="$(PROJECT_FILE)" -w "ghc-$(GHC_VERSION)" $(CABAL_ARGS) --dependencies-only --dry-run exe:haskell-language-server exe:haskell-language-server-wrapper + $(call sync_from) + $(CP) dist-newstyle/cache/plan.json "$(ROOT_DIR)/out/plan.json/$(ARTIFACT)-ghc-$(GHC_VERSION)-plan.json" + $(CABAL_INSTALL) --project-file="$(PROJECT_FILE)" -w "ghc-$(GHC_VERSION)" $(CABAL_ARGS) $(CABAL_INSTALL_ARGS) --installdir="$(ROOT_DIR)/out/$(ARTIFACT)/$(GHC_VERSION)" exe:haskell-language-server exe:haskell-language-server-wrapper + $(call sync_to) + $(STRIP_S) "$(ROOT_DIR)/out/$(ARTIFACT)/$(GHC_VERSION)/haskell-language-server" + $(STRIP_S) "$(ROOT_DIR)/out/$(ARTIFACT)/$(GHC_VERSION)/haskell-language-server-wrapper" bindist: + @if test -z "$(GHCS)" ; then echo >&2 "GHCS is not set" ; false ; fi + for ghc in $(GHCS) ; do \ + $(GHCUP) install ghc `echo $$ghc` && \ + $(GHCUP_GC) -p -s -c -t && \ + $(MAKE) GHC_VERSION=`echo $$ghc` bindist-ghc || exit 1 ; \ + done $(SED) -e "s/@@HLS_VERSION@@/$(HLS_VERSION)/" \ bindist/GNUmakefile.in > "$(BINDIST_OUT_DIR)/GNUmakefile" $(INSTALL_D) "$(BINDIST_OUT_DIR)/scripts/" @@ -88,7 +123,7 @@ bindist-ghc: $(MKDIR_P) "$(BINDIST_OUT_DIR)/bin" $(MKDIR_P) "$(BINDIST_OUT_DIR)/lib/$(GHC_VERSION)" $(INSTALL_D) "$(BINDIST_OUT_DIR)/bin/" - $(INSTALL_X) "out/$(GHC_VERSION)/haskell-language-server" "$(BINDIST_OUT_DIR)/bin/haskell-language-server-$(GHC_VERSION)" + $(INSTALL_X) "out/$(ARTIFACT)/$(GHC_VERSION)/haskell-language-server" "$(BINDIST_OUT_DIR)/bin/haskell-language-server-$(GHC_VERSION)" $(call set_rpath,../lib/$(GHC_VERSION),$(BINDIST_OUT_DIR)/bin/haskell-language-server-$(GHC_VERSION)) $(SED) \ -e "s/@@EXE_NAME@@/haskell-language-server-$(GHC_VERSION)/" \ @@ -98,7 +133,7 @@ bindist-ghc: bindist/wrapper.in > "$(BINDIST_OUT_DIR)/haskell-language-server-$(GHC_VERSION).in" $(CHMOD_X) "$(BINDIST_OUT_DIR)/haskell-language-server-$(GHC_VERSION).in" $(INSTALL_D) "$(BINDIST_OUT_DIR)/bin/" - $(INSTALL_X) "out/$(GHC_VERSION)/haskell-language-server-wrapper" "$(BINDIST_OUT_DIR)/bin/haskell-language-server-wrapper" + $(INSTALL_X) "out/$(ARTIFACT)/$(GHC_VERSION)/haskell-language-server-wrapper" "$(BINDIST_OUT_DIR)/bin/haskell-language-server-wrapper" $(INSTALL_D) "$(ROOT_DIR)/$(BINDIST_OUT_DIR)/lib/$(GHC_VERSION)" $(FIND) "$(STORE_DIR)/ghc-$(GHC_VERSION)" -type f -name "$(DLL)" -execdir $(INSTALL_X) "{}" "$(ROOT_DIR)/$(BINDIST_OUT_DIR)/lib/$(GHC_VERSION)/{}" \; $(FIND) "$(ROOT_DIR)/$(BINDIST_OUT_DIR)/lib/$(GHC_VERSION)" -type f -name '$(DLL)' -execdir $(call set_rpath,,{}) \; @@ -109,7 +144,13 @@ version: clean: $(RM_RF) out/* -clean-all: +clean-ghcs: + @if test -z "$(GHCS)" ; then echo >&2 "GHCS is not set" ; false ; fi + for ghc in $(GHCS) ; do \ + $(GHCUP) rm ghc `echo $$ghc` ; \ + done + +clean-all: clean-ghcs $(RM_RF) out/* $(STORE_DIR) -.PHONY: hls-ghc bindist bindist-ghc bindist-tar clean clean-all install-ghcs version +.PHONY: hls hls-ghc bindist bindist-ghc bindist-tar clean clean-all install-ghcs version diff --git a/scripts/release/download-gh-artifacts.sh b/scripts/release/download-gh-artifacts.sh new file mode 100644 index 000000000..b332464b1 --- /dev/null +++ b/scripts/release/download-gh-artifacts.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -eu +set -o pipefail + +RELEASE=$1 +SIGNER=$2 + +echo "RELEASE: $RELEASE" +echo "SIGNER: $SIGNER" + +for com in gh gpg curl sha256sum ; do + command -V ${com} >/dev/null 2>&1 +done + +[ ! -e "gh-release-artifacts/${RELEASE}" ] + +mkdir -p "gh-release-artifacts/${RELEASE}" + +cd "gh-release-artifacts/${RELEASE}" + +# github +gh release download "$RELEASE" + +# cirrus +curl --fail -L -o "haskell-language-server-${RELEASE}-x86_64-freebsd.tar.xz" \ + "https://api.cirrus-ci.com/v1/artifact/github/haskell/haskell-language-server/bindist/bindist/out/haskell-language-server-${RELEASE}-x86_64-freebsd.tar.xz?branch=${RELEASE}" + + +sha256sum haskell-language-server-* > SHA256SUMS +gpg --detach-sign -u "${SIGNER}" SHA256SUMS + +gh release upload "$RELEASE" "haskell-language-server-${RELEASE}-x86_64-freebsd.tar.xz" SHA256SUMS SHA256SUMS.sig