Skip to content

Commit

Permalink
Merge branch 'hls-ci' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
hasufell committed Feb 21, 2023
2 parents d33b26a + d819571 commit 3e07ac0
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 14 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/bindists.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ defaults:
run:
shell: bash
on:
pull_request:
types: [opened]
issue_comment:
types: [created]
workflow_dispatch:
inputs:
tool:
Expand Down Expand Up @@ -45,10 +41,10 @@ jobs:
toolRequirements: build-essential curl libffi-dev libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5
- image: debian:10
installCmd: apt-get update && apt-get install -y
toolRequirements: build-essential curl libffi-dev libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5
toolRequirements: build-essential curl libffi-dev libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5 libnuma-dev
- image: debian:11
installCmd: apt-get update && apt-get install -y
toolRequirements: build-essential curl libffi-dev libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5
toolRequirements: build-essential curl libffi-dev libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5 libnuma-dev
- image: ubuntu:18.04
installCmd: apt-get update && apt-get install -y
toolRequirements: build-essential curl libffi-dev libffi6 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5
Expand All @@ -70,12 +66,18 @@ jobs:
- image: rockylinux:8
installCmd: dnf install -y
toolRequirements: which findutils gcc gcc-c++ gmp gmp-devel make ncurses ncurses-compat-libs xz perl
- image: rockylinux:9
installCmd: dnf install -y --allowerasing
toolRequirements: which findutils gcc gcc-c++ gmp gmp-devel make ncurses xz perl
- image: linuxmintd/mint19.3-amd64
installCmd: apt-get update && apt-get install -y
toolRequirements: build-essential curl libffi-dev libffi6 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5
- image: linuxmintd/mint20.2-amd64
installCmd: apt-get update && apt-get install -y
toolRequirements: build-essential curl libffi-dev libffi7 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5
- image: linuxmintd/mint21.1-amd64
installCmd: apt-get update && apt-get install -y
toolRequirements: build-essential curl libffi-dev libffi7 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5
container:
image: ${{ matrix.image }}
steps:
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

if [ "${RUNNER_OS}" = "Windows" ] ; then
ext=".exe"
else
ext=''
fi

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; }

mktempdir() {
case "$(uname -s)" in
"Darwin"|"darwin")
mktemp -d -t hls_ci.XXXXXXX
;;
*)
mktemp -d
;;
esac
}
65 changes: 57 additions & 8 deletions .github/workflows/install-bindist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@
set -x
set -eo pipefail

. .github/workflows/common.sh

export GHCUP_INSTALL_BASE_PREFIX=$RUNNER_TEMP/foobarbaz

curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh

source $GHCUP_INSTALL_BASE_PREFIX/.ghcup/env || source ~/.bashrc
source "$GHCUP_INSTALL_BASE_PREFIX"/.ghcup/env || source "$HOME/.bashrc"

ghcup --version
which ghcup | grep foobarbaz

# oh no
if [ "${TOOL}" = "hls" ] ; then
ghcup -v --url-source=file:$METADATA_FILE install ghc --set 9.2.4
fi

ghcup -v --url-source=file:$METADATA_FILE install $TOOL --set $VERSION

mkdir -p /tmp/install-bindist-ci
Expand All @@ -31,8 +28,60 @@ EOF

case $TOOL in
hls)
haskell-language-server-wrapper --version
haskell-language-server-wrapper typecheck main.hs
ghcup install cabal latest
ghcup install ghc --set recommended
cabal update

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}" =~ "~" ]] && ! [[ "${bin_noexe}" =~ ".shim" ]] ; 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
ghcup rm ghc "${bin_noexe/haskell-language-server-/}"
fi
done
"$bindir/haskell-language-server-wrapper${ext}" typecheck "${test_module}" || fail "failed to typecheck with HLS wrapper"
}

enter_test_package
create_cradle
case "$(uname -s)" in
MSYS_*|MINGW*)
test_all_hls "$(dirname "$(which ghcup)")"
;;
*)
test_all_hls "$(ghcup whereis bindir)"
;;
esac
;;
ghc)
ghc --version
Expand Down

0 comments on commit 3e07ac0

Please sign in to comment.