Skip to content

Commit

Permalink
Test environments
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHatherly committed Jun 20, 2024
1 parent d9c4499 commit 4744d36
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/Manifest.toml
/test/Manifest.toml
/test/packages/**/Manifest.toml
/test/environments/**/Manifest.toml
*.pem
*.pub
test/build
Expand Down
7 changes: 6 additions & 1 deletion test/PackageBundler.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name = "LocalCustomRegistry"
uuid = "a0e467e0-8c5a-11e4-9d3f-823b93f75cbb"
environments = ["envs/CustomEnv"]
environments = [
"environments/1.9/[email protected]",
"environments/1.9/[email protected]",
"environments/1.10/[email protected]",
"environments/1.10/[email protected]",
]
outputs = [
"build/LocalCustomRegistry",
"build/LocalCustomRegistry.tar.gz",
Expand Down
6 changes: 6 additions & 0 deletions test/environments/1.10/[email protected]/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[deps]
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
TestPackage = "8346427c-08d3-4941-a1ec-6285c85e2ad6"

[compat]
TestPackage = "= 0.1.0"
6 changes: 6 additions & 0 deletions test/environments/1.10/[email protected]/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[deps]
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
TestPackage = "8346427c-08d3-4941-a1ec-6285c85e2ad6"

[compat]
TestPackage = "= 0.2.0"
6 changes: 6 additions & 0 deletions test/environments/1.9/[email protected]/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[deps]
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
TestPackage = "8346427c-08d3-4941-a1ec-6285c85e2ad6"

[compat]
TestPackage = "= 0.1.0"
6 changes: 6 additions & 0 deletions test/environments/1.9/[email protected]/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[deps]
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
TestPackage = "8346427c-08d3-4941-a1ec-6285c85e2ad6"

[compat]
TestPackage = "= 0.2.0"
33 changes: 31 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,47 @@ 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()")
println(io, "Pkg.add(\"TestPackage\")")
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

0 comments on commit 4744d36

Please sign in to comment.