Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,21 @@ RUN : \
&& rm /tmp/dart.zip \
&& :

ARG JULIA=1.12.6
ARG JULIA_SHA256=bbabf3bef19421a9dbd24a767d807606ab85e444323b5a1c73ffe293fa3d079a
ENV \
PATH=/opt/julia/bin:$PATH \
JULIA_DEPOT_PATH=/pc/julia_depot
RUN : \
&& echo 'lang: julia' \
&& julia_minor="${JULIA%.*}" \
&& curl --silent --location --output /tmp/julia.tgz "https://julialang-s3.julialang.org/bin/linux/x64/${julia_minor}/julia-${JULIA}-linux-x86_64.tar.gz" \
&& echo "${JULIA_SHA256} /tmp/julia.tgz" | sha256sum --check \
&& mkdir /opt/julia \
&& tar --strip-components=1 --directory /opt/julia -xf /tmp/julia.tgz \
&& rm /tmp/julia.tgz \
&& :

ENV \
PATH=/opt/r/bin/:$PATH \
RENV_CONFIG_CACHE_ENABLED=false \
Expand Down
6 changes: 6 additions & 0 deletions bin/_info
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ def main() -> int:
_call('go', 'version')
print()

print('## julia')
print()
with _console():
_call('julia', '--version')
print()

print('## lua')
print()
with _console():
Expand Down
36 changes: 36 additions & 0 deletions bin/test
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,40 @@ def test_can_run_dart_hook(tag: str, pc: str, podman: bool) -> None:
_build_and_run(tag, tmpdir, pc, podman=podman)


JULIA_HOOK = '''\
repos:
- repo: local
hooks:
- id: julia-format
name: julia-format
language: julia
entry: formatter.jl
additional_dependencies: [JuliaFormatter@2]
files: ^t\\.jl$
types: [julia]
'''

JULIA_FORMATTER = '''\
using JuliaFormatter

exit(all(path -> format_file(path; overwrite=false), ARGS) ? 0 : 1)
'''


def test_can_run_julia_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(JULIA_HOOK)
with open(os.path.join(tmpdir, 'formatter.jl'), 'w') as f:
f.write(JULIA_FORMATTER)
with open(os.path.join(tmpdir, 't.jl'), 'w') as f:
f.write('f(x) = 2x + 3\n')
subprocess.check_call(('git', '-C', tmpdir, 'add', '.'))

_build_and_run(tag, tmpdir, pc, podman=podman)


R_HOOK = '''\
repos:
- repo: local
Expand Down Expand Up @@ -430,6 +464,8 @@ def main() -> int:
test_can_run_conda_hook(full_tag, pc, podman=args.podman)
print(' can run dart tools '.center(79, '='), flush=True)
test_can_run_dart_hook(full_tag, pc, podman=args.podman)
print(' can run julia hooks '.center(79, '='), flush=True)
test_can_run_julia_hook(full_tag, pc, podman=args.podman)
print(' can run R hooks '.center(79, '='), flush=True)
test_can_run_r_hook(full_tag, pc, podman=args.podman)
print(' can run lua hooks '.center(79, '='), flush=True)
Expand Down
Loading