Skip to content

Commit

Permalink
Update for Julia 1.6.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Apr 15, 2021
1 parent d98c456 commit b376726
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 45 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.3'
- '1.4'
- '1.5'
- '1.6'
os:
- ubuntu-latest
arch:
Expand All @@ -25,7 +23,7 @@ jobs:
- 8cb458c6dcd8e067a3bd430b006efb0dfde56cf9 # directly from Git, never built
- master # directly from Git, likely built
env:
JULIA_DEBUG: NewPkgEval
JULIA_DEBUG: PkgEval
JULIA_VERSION: ${{ matrix.build_version }}
steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"

[compat]
BinaryBuilder = "0.2.1"
BinaryBuilder = "0.3"
DataFrames = "0.19, 0.20, 0.21"
Downloads = "1.0"
julia = "1.3"
julia = "1.6"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
8 changes: 8 additions & 0 deletions deps/Versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,11 @@ url = "https://julialang-s3.julialang.org/bin/linux/x64/1.5/julia-1.5.2-linux-x8
["1.5.3"]
sha = "f190c938dd6fed97021953240523c9db448ec0a6760b574afd4e9924ab5615f1"
url = "https://julialang-s3.julialang.org/bin/linux/x64/1.5/julia-1.5.3-linux-x86_64.tar.gz"

["1.5.4"]
sha = "80dec351d1a593e8ad152636971a48d0c81bfcfab92c87f3604663616f1e8bc5"
url = "https://julialang-s3.julialang.org/bin/linux/x64/1.5/julia-1.5.4-linux-x86_64.tar.gz"

["1.6.0"]
sha = "463b71dc70ca7094c0e0fd6d55d130051a7901e8dec5eb44d6002c57d1bd8585"
url = "https://julialang-s3.julialang.org/bin/linux/x64/1.6/julia-1.6.0-linux-x86_64.tar.gz"
6 changes: 5 additions & 1 deletion src/julia.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ function prepare_julia(the_ver::VersionNumber, dir::String=mktempdir())
Pkg.PlatformEngines.verify(file, data["sha"])
Pkg.PlatformEngines.unpack(file, dir)
end

# make sure the Julia installation is usable by the container user
Base.run(`chmod -R o=u $dir`)

return dir
end
error("Requested Julia version $the_ver not found")
Expand Down Expand Up @@ -383,7 +387,7 @@ function perform_julia_build(spec::String="master", repo_name::String="JuliaLang
# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = [
Linux(:x86_64, libc=:glibc)
Platform("x86_64", "linux")
]

# The products that we will ensure are always built
Expand Down
56 changes: 23 additions & 33 deletions src/run.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ function runner_sandboxed_julia(install::String, args=``; interactive=true, tty=
# mount data
julia_path = installed_julia_dir(install)
@assert isdir(julia_path)
registry_path = registry_dir()
@assert isdir(registry_path)
cmd = ```$cmd --mount type=bind,source=$julia_path,target=/opt/julia,readonly
--mount type=bind,source=$registry_path,target=/usr/local/share/julia/registries,readonly
--env JULIA_DEPOT_PATH="::/usr/local/share/julia"
--env JULIA_PKG_PRECOMPILE_AUTO=0
--env JULIA_PKG_SERVER
Expand Down Expand Up @@ -132,6 +129,10 @@ function run_sandboxed_test(install::String, pkg; log_limit = 2^20 #= 1 MB =#,
mkpath("/storage/artifacts")
symlink("/storage/artifacts", ".julia/artifacts")
# local cache of the registry checkout
mkpath("/cache/registries")
symlink("/cache/registries", ".julia/registries")
using Pkg
Pkg.UPDATED_REGISTRY_THIS_SESSION[] = true
Expand Down Expand Up @@ -376,6 +377,13 @@ function run(julia_versions::Vector{VersionNumber}, pkgs::Vector;
for julia in julia_versions
install = prepare_julia(julia)
cache = mktempdir()

# copy the registry (we can't mount it because permissions might be incompatible)
# XXX: actually have the target Julia process check-out the registry?
registry_path = registry_dir()
@assert isdir(registry_path)
cp(registry_path, joinpath(cache, "registries"))

julia_environments[julia] = (install, cache)
end

Expand Down Expand Up @@ -528,36 +536,18 @@ function run(julia_versions::Vector{VersionNumber}, pkgs::Vector;

# can we even test this package?
julia_supported = Dict{VersionNumber,Bool}()
if VERSION >= v"1.5"
ctx = Pkg.Types.Context()
pkg_version_info = Pkg.Operations.load_versions(ctx, job.pkg.path)
pkg_versions = sort!(collect(keys(pkg_version_info)))
pkg_compat =
Pkg.Operations.load_package_data(Pkg.Types.VersionSpec,
joinpath(job.pkg.path,
"Compat.toml"),
pkg_versions)
for (pkg_version, bounds) in pkg_compat
if haskey(bounds, "julia")
julia_supported[pkg_version] =
job.julia bounds["julia"]
end
end
else
pkg_version_info = Pkg.Operations.load_versions(job.pkg.path)
pkg_compat =
Pkg.Operations.load_package_data_raw(Pkg.Types.VersionSpec,
joinpath(job.pkg.path,
"Compat.toml"))
for (version_range, bounds) in pkg_compat
if haskey(bounds, "julia")
for pkg_version in keys(pkg_version_info)
if pkg_version in version_range
julia_supported[pkg_version] =
job.julia bounds["julia"]
end
end
end
ctx = Pkg.Types.Context()
pkg_version_info = Pkg.Operations.load_versions(ctx, job.pkg.path)
pkg_versions = sort!(collect(keys(pkg_version_info)))
pkg_compat =
Pkg.Operations.load_package_data(ctx, Pkg.Types.VersionSpec,
joinpath(job.pkg.path,
"Compat.toml"),
pkg_versions)
for (pkg_version, bounds) in pkg_compat
if haskey(bounds, "julia")
julia_supported[pkg_version] =
job.julia bounds["julia"]
end
end
if length(julia_supported) != length(pkg_version_info)
Expand Down
17 changes: 12 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,22 @@ const install = PkgEval.prepare_julia(julia)
@testset "sandbox" begin
PkgEval.prepare_runner()
mktemp() do path, io
PkgEval.run_sandboxed_julia(install, `-e 'print(1337)'`; stdout=io,
tty=false, interactive=false)
close(io)
@test read(path, String) == "1337"
try
PkgEval.run_sandboxed_julia(install, `-e 'print(1337)'`; stdout=io,
tty=false, interactive=false)
close(io)
@test read(path, String) == "1337"
catch
# if we failed to spawn a container, make sure to print the reason
flush(io)
@error read(path, String)
rethrow()
end
end

# print versioninfo so we can verify in CI logs that the correct version is used
PkgEval.run_sandboxed_julia(install, `-e 'using InteractiveUtils; versioninfo()'`;
tty=false, interactive=false)
tty=false, interactive=false)
end

const pkgnames = ["TimerOutputs", "Crayons", "Example", "Gtk"]
Expand Down

0 comments on commit b376726

Please sign in to comment.