From bd2f235c33979d611acf6d78e2c48177c4eb4720 Mon Sep 17 00:00:00 2001 From: Donny Wong Date: Tue, 30 Apr 2024 15:27:30 -0400 Subject: [PATCH] haskell tester: make stack resolver a setting --- docker-compose.yml | 1 + server/autotest_server/settings.yml | 1 + server/autotest_server/testers/haskell/haskell_tester.py | 3 ++- server/autotest_server/testers/haskell/setup.py | 6 +++--- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 90b52b1c..351e49a6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,6 +19,7 @@ services: - SUPERVISOR_URL=127.0.0.1:9001 - AUTOTESTER_CONFIG=/app/.dockerfiles/docker-config.yml - STACK_ROOT=/home/docker/.autotesting/.stack + - STACK_RESOLVER=lts-16.17 depends_on: - postgres - redis diff --git a/server/autotest_server/settings.yml b/server/autotest_server/settings.yml index 0325289b..4d32c71f 100644 --- a/server/autotest_server/settings.yml +++ b/server/autotest_server/settings.yml @@ -1,6 +1,7 @@ workspace: !ENV ${WORKSPACE} redis_url: !ENV ${REDIS_URL} supervisor_url: !ENV ${SUPERVISOR_URL} +stack_resolver: !ENV ${STACK_RESOLVER} workers: - user: !ENV ${USER} queues: diff --git a/server/autotest_server/testers/haskell/haskell_tester.py b/server/autotest_server/testers/haskell/haskell_tester.py index 754e3c25..f22c0718 100644 --- a/server/autotest_server/testers/haskell/haskell_tester.py +++ b/server/autotest_server/testers/haskell/haskell_tester.py @@ -6,8 +6,9 @@ from ..tester import Tester, Test, TestError from ..specs import TestSpecs +from config import config -STACK_OPTIONS = ["--resolver=lts-16.17", "--system-ghc", "--allow-different-user"] +STACK_OPTIONS = [f"--resolver={config['stack_resolver']}", "--system-ghc", "--allow-different-user"] class HaskellTest(Test): diff --git a/server/autotest_server/testers/haskell/setup.py b/server/autotest_server/testers/haskell/setup.py index 43f8090c..77e4ab9d 100644 --- a/server/autotest_server/testers/haskell/setup.py +++ b/server/autotest_server/testers/haskell/setup.py @@ -1,13 +1,13 @@ import os import json import subprocess - +from ...config import config HASKELL_TEST_DEPS = ["tasty-discover", "tasty-quickcheck"] def create_environment(_settings, _env_dir, default_env_dir): - resolver = "lts-16.17" + resolver = config["stack_resolver"] cmd = ["stack", "build", "--resolver", resolver, "--system-ghc", *HASKELL_TEST_DEPS] subprocess.run(cmd, check=True) @@ -16,7 +16,7 @@ def create_environment(_settings, _env_dir, default_env_dir): def install(): subprocess.run(os.path.join(os.path.dirname(os.path.realpath(__file__)), "requirements.system"), check=True) - resolver = "lts-16.17" + resolver = config["stack_resolver"] cmd = ["stack", "build", "--resolver", resolver, "--system-ghc", *HASKELL_TEST_DEPS] subprocess.run(cmd, check=True) subprocess.run(