Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Julia: support language_version
  • Loading branch information
ericphanson committed Jul 21, 2025
commit e7509272b31867c1461d983ddbc49b074ac25adf
7 changes: 6 additions & 1 deletion .github/workflows/languages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ jobs:
if: matrix.language == 'haskell'
- uses: r-lib/actions/setup-r@v2
if: matrix.os == 'ubuntu-latest' && matrix.language == 'r'

- uses: julia-actions/install-juliaup@v2
if: matrix.language == 'julia'
with:
channel: 'release'
- run: juliaup add 1.10.10
if: matrix.language == 'julia'
- name: install deps
run: python -mpip install -e . -r requirements-dev.txt
- name: run tests
Expand Down
7 changes: 6 additions & 1 deletion pre_commit/languages/julia.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,13 @@ def run_hook(
def get_env_patch(target_dir: str, version: str) -> PatchesT:
return (
('JULIA_LOAD_PATH', target_dir),
# May be set, remove it to not interfer with LOAD_PATH
# May be set, remove it to not interfere with LOAD_PATH
('JULIA_PROJECT', UNSET),
# Only set JULIAUP_CHANNEL if we don't want use the system's default
*(
(('JULIAUP_CHANNEL', version),)
if version not in ('system', 'default') else ()
),
)


Expand Down
16 changes: 16 additions & 0 deletions tests/languages/julia_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ def test_julia_hook(tmp_path):
assert run_language(tmp_path, julia, 'src/main.jl') == expected


def test_julia_hook_version(tmp_path):
code = """
using Example
function main()
println("Hello, Julia $(VERSION)!")
end
main()
"""
_make_hook(tmp_path, code)
expected = (0, b'Hello, Julia 1.10.10!\n')
assert run_language(
tmp_path, julia, 'src/main.jl',
version='1.10.10',
) == expected


def test_julia_hook_manifest(tmp_path):
code = """
using Example
Expand Down
Loading