Skip to content

Commit

Permalink
ci: refactor julia tests, from 5 to 4 (~5 min saved)
Browse files Browse the repository at this point in the history
  • Loading branch information
consideRatio committed Oct 10, 2022
1 parent f1b1339 commit fa68da7
Show file tree
Hide file tree
Showing 21 changed files with 61 additions and 82 deletions.
10 changes: 10 additions & 0 deletions repo2docker/buildpacks/julia/julia_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ def julia_version(self):
compat = project_toml["compat"]["julia"]
except:
# Default version which needs to be manually updated with new major.minor releases
#
# NOTE: Updates to the default version should go hand in hand with
# updates to tests/julia/project/verify where is intent to
# test the version.
#
# FIXME: When compat = "1.6" is set below and passed to
# find_semver_match, we get 1.8.2 as of 2022-10-09. We should
# clarify the desired behavior and have a unit test of
# find_semver_match to validate it.
#
compat = "1.6"

match = find_semver_match(compat, self.all_julias)
Expand Down
4 changes: 0 additions & 4 deletions tests/julia/julia_version-1.0.2/README.rst

This file was deleted.

4 changes: 0 additions & 4 deletions tests/julia/julia_version-default/README.rst

This file was deleted.

22 changes: 0 additions & 22 deletions tests/julia/julialegacy_version-0.6.3/README.rst

This file was deleted.

5 changes: 0 additions & 5 deletions tests/julia/julialegacy_version-1.0/README.rst

This file was deleted.

17 changes: 0 additions & 17 deletions tests/julia/julialegacy_version-1.0/verify

This file was deleted.

File renamed without changes.
4 changes: 4 additions & 0 deletions tests/julia/project-1.0.2/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Julia - Project.toml
--------------------

Test a Project.toml file with a specified version for julia.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env julia
# Verify the version:

if VERSION != v"1.0.2"
println("Julia version should be 1.0.2")
exit(1)
end

Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions tests/julia/project/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Julia - Project.toml
--------------------

This tests a Project.toml file for julia, using the repo2docker default version
of julia as specified in ``julia_project.py``.
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#!/usr/bin/env julia
# Verify the version:
if VERSION < v"1.1.0"
exit(1)
end

# FIXME: The default version set by repo2docker is in practice the latest
# available, but from the julia_project.py file that doesn't seem
# intented.
#
# if ! (VERSION >= v"1.6" && VERSION < v"1.7")
# println("Default Julia version should be at 1.6.x")
# exit(1)
# end

try
# Test that the package was installed.
Expand Down
17 changes: 0 additions & 17 deletions tests/julia/pyplot-requirements/README.rst

This file was deleted.

1 change: 0 additions & 1 deletion tests/julia/pyplot-requirements/REQUIRE

This file was deleted.

8 changes: 8 additions & 0 deletions tests/julia/require-1-requirements/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Julia - REQUIRE, and a requirements.txt file
--------------------------------------------

This tests a REQUIRE file for julia, using the repo2docker default version of
julia as specified in ``julia_require.py``.

This tests the use of the legacy REQUIRE file together with the an
``requirements.txt`` file.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
julia 0.6.3
julia 1

# Julia packages:
Compat
PyCall
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/usr/bin/env julia
using PyCall
using PyPlot

if ! (VERSION >= v"1" && VERSION < v"2")
println("Julia version was: ", VERSION)
println("Julia version expected to be 1.x when pinned to 1 in a REQUIRE file")
exit(1)
end

# Make sure we are re-using the same conda python
if ! startswith(PyCall.libpython, ENV["NB_PYTHON_PREFIX"] * "/lib")
println("Not re-using conda python! Using " * PyCall.libpython * " instead")
Expand Down
9 changes: 9 additions & 0 deletions tests/julia/require/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Julia - REQUIRE, and use of old package manager
-----------------------------------------------

This tests a REQUIRE file for julia, using the repo2docker default version of
julia as specified in ``julia_require.py``. Note that this is default version is
0.6.4!

Starting with Julia v0.7 and up, the package manager has changed, so this tests
that the Julia version below that can be installed correctly as well.
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
julia 1.0

# Julia packages:
Compat
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#!/usr/bin/env julia
# Verify the version:
if VERSION != v"0.6.3"

if VERSION != v"0.6.4"
println("Julia version was: ", VERSION)
println("Default Julia version expected to be 0.6.4 when unspecified in a REQUIRE file")
exit(1)
end

try
# Test that the package was installed.
using Compat

# Verify that the environment variables are set correctly for julia <= 0.6
# Verify that the environment variables are set correctly for julia < 0.7
@assert "julia" readdir(Base.JULIA_HOME)
catch
exit(1)
Expand Down

0 comments on commit fa68da7

Please sign in to comment.