diff --git a/Dockerfile b/Dockerfile index d6f17dd..53c080e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,7 @@ RUN : \ gcc \ git \ gnupg2 \ + gpg-agent \ libblas3 \ libc6 \ libedit2 \ @@ -21,6 +22,7 @@ RUN : \ libfile-homedir-perl \ libgcc1 \ libgdiplus \ + libgmp-dev \ libgssapi-krb5-2 \ libicu74 \ liblapack3 \ @@ -36,6 +38,7 @@ RUN : \ ruby-dev \ unzip \ xdg-user-dirs \ + xz-utils \ zlib1g \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* \ @@ -118,6 +121,24 @@ RUN : \ && rm /tmp/node.tar.gz \ && : +ARG HASKELL_GHC=9.14.1 +ARG HASKELL_CABAL=3.18.1.0 +ENV \ + BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=yes \ + BOOTSTRAP_HASKELL_GHC_VERSION=0 \ + BOOTSTRAP_HASKELL_INSTALL_NO_STACK=yes \ + BOOTSTRAP_HASKELL_MINIMAL=1 \ + BOOTSTRAP_HASKELL_NONINTERACTIVE=1 \ + CABAL_DIR=/tmp/cabal \ + GHCUP_INSTALL_BASE_PREFIX=/opt/haskell \ + PATH=/opt/haskell/.ghcup/bin:$PATH +RUN : \ + && echo 'lang: haskell' \ + && curl --proto '=https' --tlsv1.2 --silent --show-error --fail https://get-ghcup.haskell.org | sh \ + && ghcup install ghc "$HASKELL_GHC" --set \ + && ghcup install cabal "$HASKELL_CABAL" --set \ + && : + ARG RUST=1.89.0 ARG RUSTUP_SHA256=c8d03f559a2335693379e1d3eaee76622b2a6580807e63bcd61faea709b9f664 ARG RUSTUP_VERSION=1.28.0 diff --git a/bin/test b/bin/test index fd49ff5..ebe58ae 100755 --- a/bin/test +++ b/bin/test @@ -147,6 +147,27 @@ def test_can_run_go_hook(tag: str, pc: str, podman: bool) -> None: _build_and_run(tag, tmpdir, pc, podman=podman) +HASKELL_HOOK = '''\ +repos: +- repo: https://github.com/NixOS/nixfmt + rev: v1.5.0 + hooks: + - id: nixfmt +''' + + +def test_can_run_haskell_hook(tag: str, pc: str, podman: bool) -> None: + with tempfile.TemporaryDirectory() as tmpdir: + subprocess.check_call(('git', 'init', tmpdir)) + with open(os.path.join(tmpdir, '.pre-commit-config.yaml'), 'w') as f: + f.write(HASKELL_HOOK) + with open(os.path.join(tmpdir, 't.nix'), 'w') as f: + f.write('1\n') + subprocess.check_call(('git', '-C', tmpdir, 'add', '.')) + + _build_and_run(tag, tmpdir, pc, podman=podman) + + RUST_HOOK = '''\ repos: - repo: local @@ -454,6 +475,8 @@ def main() -> int: test_can_install_ffi_gem(full_tag) print(' can run go hooks '.center(79, '='), flush=True) test_can_run_go_hook(full_tag, pc, podman=args.podman) + print(' can run haskell hooks '.center(79, '='), flush=True) + test_can_run_haskell_hook(full_tag, pc, podman=args.podman) print(' can run rust hooks '.center(79, '='), flush=True) test_can_run_rust_hook(full_tag, pc, podman=args.podman) print(' can run swift hooks '.center(79, '='), flush=True)