From 4744d3620f13d129a382822d95a3d1898c20d547 Mon Sep 17 00:00:00 2001 From: MichaelHatherly Date: Thu, 20 Jun 2024 13:59:45 +0100 Subject: [PATCH] Test environments --- .gitignore | 1 + test/PackageBundler.toml | 7 +++- .../1.10/Bundle@0.1.0/Project.toml | 6 ++++ .../1.10/Bundle@0.2.0/Project.toml | 6 ++++ .../1.9/Bundle@0.1.0/Project.toml | 6 ++++ .../1.9/Bundle@0.2.0/Project.toml | 6 ++++ test/runtests.jl | 33 +++++++++++++++++-- 7 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 test/environments/1.10/Bundle@0.1.0/Project.toml create mode 100644 test/environments/1.10/Bundle@0.2.0/Project.toml create mode 100644 test/environments/1.9/Bundle@0.1.0/Project.toml create mode 100644 test/environments/1.9/Bundle@0.2.0/Project.toml diff --git a/.gitignore b/.gitignore index d16353a..9d00c51 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /Manifest.toml /test/Manifest.toml /test/packages/**/Manifest.toml +/test/environments/**/Manifest.toml *.pem *.pub test/build diff --git a/test/PackageBundler.toml b/test/PackageBundler.toml index 6331ad9..ea7d8d7 100644 --- a/test/PackageBundler.toml +++ b/test/PackageBundler.toml @@ -1,6 +1,11 @@ name = "LocalCustomRegistry" uuid = "a0e467e0-8c5a-11e4-9d3f-823b93f75cbb" -environments = ["envs/CustomEnv"] +environments = [ + "environments/1.9/Bundle@0.1.0", + "environments/1.9/Bundle@0.2.0", + "environments/1.10/Bundle@0.1.0", + "environments/1.10/Bundle@0.2.0", +] outputs = [ "build/LocalCustomRegistry", "build/LocalCustomRegistry.tar.gz", diff --git a/test/environments/1.10/Bundle@0.1.0/Project.toml b/test/environments/1.10/Bundle@0.1.0/Project.toml new file mode 100644 index 0000000..fe41893 --- /dev/null +++ b/test/environments/1.10/Bundle@0.1.0/Project.toml @@ -0,0 +1,6 @@ +[deps] +Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b" +TestPackage = "8346427c-08d3-4941-a1ec-6285c85e2ad6" + +[compat] +TestPackage = "= 0.1.0" diff --git a/test/environments/1.10/Bundle@0.2.0/Project.toml b/test/environments/1.10/Bundle@0.2.0/Project.toml new file mode 100644 index 0000000..341cbe3 --- /dev/null +++ b/test/environments/1.10/Bundle@0.2.0/Project.toml @@ -0,0 +1,6 @@ +[deps] +Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b" +TestPackage = "8346427c-08d3-4941-a1ec-6285c85e2ad6" + +[compat] +TestPackage = "= 0.2.0" diff --git a/test/environments/1.9/Bundle@0.1.0/Project.toml b/test/environments/1.9/Bundle@0.1.0/Project.toml new file mode 100644 index 0000000..fe41893 --- /dev/null +++ b/test/environments/1.9/Bundle@0.1.0/Project.toml @@ -0,0 +1,6 @@ +[deps] +Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b" +TestPackage = "8346427c-08d3-4941-a1ec-6285c85e2ad6" + +[compat] +TestPackage = "= 0.1.0" diff --git a/test/environments/1.9/Bundle@0.2.0/Project.toml b/test/environments/1.9/Bundle@0.2.0/Project.toml new file mode 100644 index 0000000..341cbe3 --- /dev/null +++ b/test/environments/1.9/Bundle@0.2.0/Project.toml @@ -0,0 +1,6 @@ +[deps] +Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b" +TestPackage = "8346427c-08d3-4941-a1ec-6285c85e2ad6" + +[compat] +TestPackage = "= 0.2.0" diff --git a/test/runtests.jl b/test/runtests.jl index 4e3c757..3f218e3 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -155,10 +155,34 @@ end @test keys(versions) == Set(["0.1.0", "0.2.0"]) end + # Manifest files aren't committed to the repo for the environments + # listed in the `environments` directory. These are the environments + # that we will bundled. Before we begin bundling them we need to + # instantiate them. + environments_dir = joinpath(@__DIR__, "environments") + for each_version in readdir(environments_dir) + run(`juliaup add $each_version`) + for project in readdir(joinpath(environments_dir, each_version); join = true) + run( + addenv( + `julia +$each_version --startup-file=no --project=$project -e "import Pkg; Pkg.update()"`, + "JULIA_DEPOT_PATH" => DEPOT_PATH[1], + ), + ) + end + end + + cd(@__DIR__) do + key = PackageBundler.keypair() + @test isfile(key.private) + @test isfile(key.public) + + # PackageBundler.bundle() + end + mktempdir() do script_dir script = joinpath(script_dir, "script.jl") open(script, "w") do io - println(io, "pushfirst!(DEPOT_PATH, $(repr(DEPOT_PATH[1])))") println(io, "import Pkg") println(io, "Pkg.activate(; temp = true)") println(io, "Pkg.status()") @@ -166,7 +190,12 @@ end println(io, "import TestPackage") println(io, "println(TestPackage.greet())") end - run(`julia --startup-file=no $script`) + run( + addenv( + `julia --startup-file=no $script`, + "JULIA_DEPOT_PATH" => DEPOT_PATH[1], + ), + ) end end end