Skip to content

Commit 7a0ce19

Browse files
committed
Fixed Haskell tester installation using ghcup to install stack system-wide
1 parent ef29313 commit 7a0ce19

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ All notable changes to this project will be documented here.
55
- Fixed Haskell test results to only include the function name (#687)
66
- Improved robustness of tester installation scripts and Docker configuration (#688)
77
- Moved tidyverse installation steps from server Dockerfile into R tester requirements.system (#688)
8+
- Fixed Haskell tester installation using ghcup to install stack system-wide (#688)
89

910
## [v2.9.0]
1011
- Install stack with GHCup (#626)

server/autotest_server/testers/haskell/haskell_tester.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
from ..tester import Tester, Test, TestError
88
from ..specs import TestSpecs
99

10-
home = os.getenv("HOME")
11-
os.environ["PATH"] = f"{home}/.cabal/bin:{home}/.ghcup/bin:" + os.environ["PATH"]
12-
1310

1411
class HaskellTest(Test):
1512
def __init__(
Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
#!/usr/bin/env bash
22
set -euxo pipefail
33

4-
apt-get -y update
5-
4+
# Install a system-wide ghc, which can be used as a default version in the Haskell tester.
5+
# This should be synchronized with the LTS version and dependencies in setup.py
66
if ! dpkg -l ghc cabal-install &> /dev/null; then
7+
apt-get -y update
78
DEBIAN_FRONTEND=noninteractive apt-get install -y -o 'Dpkg::Options::=--force-confdef' -o 'Dpkg::Options::=--force-confold' ghc cabal-install
89
fi
910

10-
if [ ! -x "$HOME/.ghcup/bin/ghcup" ] && [ ! -x "/usr/local/bin/stack" ]; then
11-
BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
12-
$HOME/.ghcup/bin/ghcup install stack recommended
13-
if [ "$(id -u)" -eq 0 ]; then
14-
cp $HOME/.ghcup/bin/stack /usr/local/bin/
15-
fi
11+
if [ ! -x "/usr/local/bin/stack" ]; then
12+
# We use ghcup to install stack rather than relying on system packages. This enables newer versions of Stack to be installed.
13+
# Install ghcup dependencies: https://www.haskell.org/ghcup/install/#linux-ubuntu
14+
apt-get -y update
15+
DEBIAN_FRONTEND=noninteractive apt-get install -y -o 'Dpkg::Options::=--force-confdef' -o 'Dpkg::Options::=--force-confold' \
16+
build-essential \
17+
curl \
18+
libffi-dev \
19+
libffi8ubuntu1 \
20+
libgmp-dev \
21+
libgmp10 \
22+
libncurses-dev
23+
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_MINIMAL=1 sh
24+
$HOME/.ghcup/bin/ghcup install stack recommended --isolate /usr/local/bin
1625
fi

server/autotest_server/testers/haskell/setup.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
HASKELL_TEST_DEPS = ["tasty-discover", "tasty-quickcheck", "tasty-hunit"]
66
STACK_RESOLVER = "lts-21.21"
77

8-
home = os.getenv("HOME")
9-
os.environ["PATH"] = f"{home}/.cabal/bin:{home}/.ghcup/bin:" + os.environ["PATH"]
10-
118

129
def create_environment(_settings, _env_dir, default_env_dir):
1310
env_data = _settings.get("env_data", {})

0 commit comments

Comments
 (0)