Skip to content

Drop support for Julia <1.6 (LTS) #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ jobs:
fail-fast: false
matrix:
version:
- '1.0'
- '1.6'
- '1'
- '1.6' # LTS / Oldest supported version
- '1' # Latest release
- 'nightly'
os:
- ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
EzXML = "1"
julia = "1"
julia = "1.6"

[extras]
ReferenceTests = "324d217c-45ce-50fc-942e-d289b448e8cf"
Expand Down
20 changes: 4 additions & 16 deletions src/TestReports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,17 @@ using Test

using Pkg: PackageSpec
using Pkg.Types: Context, ensure_resolved, is_project_uuid
using Pkg.Operations: manifest_info, manifest_resolve!, project_deps_resolve!,
project_rel_path, project_resolve!
using Pkg.Operations: gen_target_project, manifest_info, manifest_resolve!,
project_deps_resolve!, project_rel_path, project_resolve!, sandbox, source_path

using Test: AbstractTestSet, DefaultTestSet, Result, Pass, Fail, Error, Broken,
get_testset, get_testset_depth, scrub_backtrace

import Test: finish, record

# Version specific imports
@static if VERSION >= v"1.4.0"
using Pkg.Operations: gen_target_project
else
using Pkg.Operations: with_dependencies_loadable_at_toplevel
end
@static if VERSION >= v"1.2.0"
using Pkg.Operations: sandbox, source_path
@static if VERSION < v"1.7.0"
using Pkg.Operations: update_package_test!
end
else
using Pkg.Operations: find_installed
using Pkg.Types: SHA1
@static if VERSION < v"1.7.0"
using Pkg.Operations: update_package_test!
end

export ReportingTestSet, any_problems, report, recordproperty
Expand All @@ -45,7 +34,6 @@ const TESTREPORTS_UUID = let
Base.UUID(toml["uuid"])
end

include("v1_compat.jl")
include("./testsets.jl")
include("to_xml.jl")
include("compat_check.jl")
Expand Down
75 changes: 23 additions & 52 deletions src/compat_check.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,9 @@ function getdeps(manifest)
@static if VERSION >= v"1.6.2"
# Manifest is a struct
return manifest.deps
elseif VERSION >= v"1.1.0"
else
# Manifest is a dict of UUID to PackageEntry
return manifest
else
return manifest["deps"]
end
end

Expand Down Expand Up @@ -141,59 +139,32 @@ not a stdlib or Julia.
"""
function get_dep_entries end

@static if VERSION >= v"1.1"
function get_dep_entries()
# Get names
testreport_proj = Pkg.Types.EnvCache(joinpath(dirname(@__DIR__), "Project.toml")).project
dep_names_to_check = intersect(keys(testreport_proj.deps), keys(testreport_proj.compat)) # Ignores julia and stdlibs

# Get PackageEntries from activte Manifest.toml or build from TestReports Project.toml
deps_to_check = Pkg.Types.PackageEntry[]
active_env = Pkg.Types.EnvCache(Base.active_project())
for dep in dep_names_to_check
if haskey(getdeps(active_env.manifest), testreport_proj.deps[dep])
push!(deps_to_check, getdeps(active_env.manifest)[testreport_proj.deps[dep]])
else
@static if VERSION >= v"1.7.0"
version_number = VersionNumber(testreport_proj.compat[dep].str)
else
version_number = VersionNumber(testreport_proj.compat[dep])
end
pkg_entry = Pkg.Types.PackageEntry(
name=dep,
other=Dict("uuid" => testreport_proj.deps[dep]),
version=version_number
)
push!(deps_to_check, pkg_entry)
end
end
return deps_to_check
end
else
function get_dep_entries()
# Get names
testreport_proj = Pkg.Types.EnvCache(joinpath(dirname(@__DIR__), "Project.toml")).project
dep_names_to_check = intersect(keys(getdeps(testreport_proj)), keys(getcompat(testreport_proj))) # Ignores julia and stdlibs

# Get PackageEntries from activte Manifest.toml or build from TestReports Project.toml
deps_to_check = Dict[]
active_env = Pkg.Types.EnvCache(Base.active_project())
for dep in dep_names_to_check
if haskey(active_env.manifest, dep)
dep_to_check = active_env.manifest[dep][1] # why is this a vector?
dep_to_check["name"] = dep
push!(deps_to_check, dep_to_check)
function get_dep_entries()
# Get names
testreport_proj = Pkg.Types.EnvCache(joinpath(dirname(@__DIR__), "Project.toml")).project
dep_names_to_check = intersect(keys(testreport_proj.deps), keys(testreport_proj.compat)) # Ignores julia and stdlibs

# Get PackageEntries from activte Manifest.toml or build from TestReports Project.toml
deps_to_check = Pkg.Types.PackageEntry[]
active_env = Pkg.Types.EnvCache(Base.active_project())
for dep in dep_names_to_check
if haskey(getdeps(active_env.manifest), testreport_proj.deps[dep])
push!(deps_to_check, getdeps(active_env.manifest)[testreport_proj.deps[dep]])
else
@static if VERSION >= v"1.7.0"
version_number = VersionNumber(testreport_proj.compat[dep].str)
else
pkg_entry = Dict(
"name" => dep,
"uuid" => testreport_proj["deps"][dep],
"version" => VersionNumber(testreport_proj["compat"][dep])
)
push!(deps_to_check, pkg_entry)
version_number = VersionNumber(testreport_proj.compat[dep])
end
pkg_entry = Pkg.Types.PackageEntry(
name=dep,
other=Dict("uuid" => testreport_proj.deps[dep]),
version=version_number
)
push!(deps_to_check, pkg_entry)
end
return deps_to_check
end
return deps_to_check
end

"""
Expand Down
120 changes: 29 additions & 91 deletions src/runner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,6 @@ Returns `Cmd` which will run the runner code in a new Julia instance.
See also: [`gen_runner_code`](@ref)
"""
function gen_command(runner_code, julia_args, coverage)
@static if VERSION >= v"1.5.0"
threads_cmd = `--threads=$(Threads.nthreads())`
else
threads_cmd = ``
end

cmd = ```
$(Base.julia_cmd())
--code-coverage=$(coverage ? "user" : "none")
Expand All @@ -166,7 +160,7 @@ function gen_command(runner_code, julia_args, coverage)
--inline=$(Bool(Base.JLOptions().can_inline) ? "yes" : "no")
--startup-file=$(Base.JLOptions().startupfile == 1 ? "yes" : "no")
--track-allocation=$(("none", "user", "all")[Base.JLOptions().malloc_log + 1])
$threads_cmd
--threads=$(Threads.nthreads())
$(julia_args)
--eval $(runner_code)
```
Expand All @@ -185,10 +179,10 @@ is of type `Pkg.Types.Context`. For earlier versions, they are of type
`Pkg.Types.EnvCache`.
"""
function isinstalled!(ctx::Context, pkgspec::Pkg.Types.PackageSpec)
@static if v"1.4.0" <= VERSION < v"1.7.0"
var = ctx
else
@static if VERSION >= v"1.7.0"
var = ctx.env
else
var = ctx
end
@static if VERSION >= v"1.7.0"
manifest_var = ctx.env.manifest
Expand Down Expand Up @@ -234,7 +228,7 @@ function gettestfilepath(ctx::Context, pkgspec::Pkg.Types.PackageSpec)
end
end
pkgfilepath = source_path(ctx.env.project_file, pkgspec, ctx.julia_version)
elseif VERSION >= v"1.4.0"
else
if is_project_uuid(ctx, pkgspec.uuid)
pkgspec.path = dirname(ctx.env.project_file)
pkgspec.version = ctx.env.pkg.version
Expand All @@ -243,51 +237,6 @@ function gettestfilepath(ctx::Context, pkgspec::Pkg.Types.PackageSpec)
pkgspec.path = project_rel_path(ctx, source_path(ctx, pkgspec))
end
pkgfilepath = source_path(ctx, pkgspec)
elseif VERSION >= v"1.2.0"
pkgspec.special_action = Pkg.Types.PKGSPEC_TESTED
if is_project_uuid(ctx.env, pkgspec.uuid)
pkgspec.path = dirname(ctx.env.project_file)
pkgspec.version = ctx.env.pkg.version
else
update_package_test!(pkgspec, manifest_info(ctx.env, pkgspec.uuid))
pkgspec.path = joinpath(project_rel_path(ctx, source_path(pkgspec)))
end
pkgfilepath = project_rel_path(ctx, source_path(pkgspec))
elseif VERSION >= v"1.1.0"
pkgspec.special_action = Pkg.Types.PKGSPEC_TESTED
if is_project_uuid(ctx.env, pkgspec.uuid)
pkgspec.version = ctx.env.pkg.version
pkgfilepath = dirname(ctx.env.project_file)
else
entry = manifest_info(ctx.env, pkg.uuid)
if entry.repo.tree_sha !== nothing
pkgfilepath = find_installed(pkgspec.name, pkgspec.uuid, entry.repo.tree_sha)
elseif entry.path !== nothing
pkgfilepath = project_rel_path(ctx, entry.path)
elseif pkgspec.uuid in keys(ctx.stdlibs)
pkgfilepath = Pkg.Types.stdlib_path(pkgspec.name)
else
throw(PkgTestError("Could not find either `git-tree-sha1` or `path` for package $(pkgspec.name)"))
end
end
else
pkgspec.special_action = Pkg.Types.PKGSPEC_TESTED
if is_project_uuid(ctx.env, pkgspec.uuid)
pkgspec.version = ctx.env.pkg.version
pkgfilepath = dirname(ctx.env.project_file)
else
info = manifest_info(ctx.env, pkgspec.uuid)
if haskey(info, "git-tree-sha1")
pkgfilepath = find_installed(pkgspec.name, pkgspec.uuid, SHA1(info["git-tree-sha1"]))
elseif haskey(info, "path")
pkgfilepath = project_rel_path(ctx, info["path"])
elseif pkgspec.uuid in keys(ctx.stdlibs)
pkgfilepath = Pkg.Types.stdlib_path(pkgspec.name)
else
throw(PkgTestError("Could not find either `git-tree-sha1` or `path` for package $(pkgspec.name)"))
end
end
pkgspec.path = pkgfilepath
end
testfilepath = joinpath(pkgfilepath, "test", "runtests.jl")
return testfilepath
Expand Down Expand Up @@ -376,42 +325,31 @@ function test!(pkg::AbstractString,
cmd = gen_command(runner_code, julia_args, coverage)
test_folder_has_project_file = has_test_project_file(testfilepath)

if VERSION >= v"1.4.0" || (VERSION >= v"1.2.0" && test_folder_has_project_file)
# Operations.sandbox() has different arguments between versions
sandbox_args = (ctx,
pkgspec,
pkgspec.path,
joinpath(pkgspec.path, "test"))
if VERSION >= v"1.8.0"
test_project_override = test_folder_has_project_file ?
nothing :
gen_target_project(ctx, pkgspec, pkgspec.path::String, "test")
sandbox_args = (sandbox_args..., test_project_override)
elseif VERSION >= v"1.7.0"
test_project_override = test_folder_has_project_file ?
nothing :
gen_target_project(ctx.env, ctx.registries, pkgspec, pkgspec.path, "test")
sandbox_args = (sandbox_args..., test_project_override)
elseif VERSION >= v"1.4.0"
test_project_override = test_folder_has_project_file ?
nothing :
gen_target_project(ctx, pkgspec, pkgspec.path, "test")
sandbox_args = (sandbox_args..., test_project_override)
end

sandbox(sandbox_args...) do
flush(stdout)
runtests!(errs, pkg, cmd, logfilename)
end
# Operations.sandbox() has different arguments between versions
sandbox_args = (ctx,
pkgspec,
pkgspec.path,
joinpath(pkgspec.path, "test"))
if VERSION >= v"1.8.0"
test_project_override = test_folder_has_project_file ?
nothing :
gen_target_project(ctx, pkgspec, pkgspec.path::String, "test")
sandbox_args = (sandbox_args..., test_project_override)
elseif VERSION >= v"1.7.0"
test_project_override = test_folder_has_project_file ?
nothing :
gen_target_project(ctx.env, ctx.registries, pkgspec, pkgspec.path, "test")
sandbox_args = (sandbox_args..., test_project_override)
else
with_dependencies_loadable_at_toplevel(ctx, pkgspec; might_need_to_resolve=true) do localctx
Pkg.activate(localctx.env.project_file)
try
runtests!(errs, pkg, cmd, logfilename)
finally
Pkg.activate(ctx.env.project_file)
end
end
test_project_override = test_folder_has_project_file ?
nothing :
gen_target_project(ctx, pkgspec, pkgspec.path, "test")
sandbox_args = (sandbox_args..., test_project_override)
end

sandbox(sandbox_args...) do
flush(stdout)
runtests!(errs, pkg, cmd, logfilename)
end
end
end
Expand Down
9 changes: 0 additions & 9 deletions src/v1_compat.jl

This file was deleted.

14 changes: 6 additions & 8 deletions test/reportgeneration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,12 @@ end
]
foreach(test_package_expected_pass, test_pkgs)

# Test file project file tests, 1.2 and above
@static if VERSION >= v"1.2.0"
test_pkgs = [
"TestsWithProjectFile",
"TestsWithProjectFileWithTestDeps"
]
foreach(test_package_expected_pass, test_pkgs)
end
# Test file project file tests
test_pkgs = [
"TestsWithProjectFile",
"TestsWithProjectFileWithTestDeps"
]
foreach(test_package_expected_pass, test_pkgs)

# Test arguments
temp_pkg_dir() do tmp
Expand Down
Loading
Loading