Skip to content

Commit

Permalink
Generate Project.toml with Pkg's custom key order, and update referen…
Browse files Browse the repository at this point in the history
…ce tests to v1.7 (#335)

* Run reference tests with Julia 1.7

* Generate Project.toml with Pkg's custom key order

* Mock uuid4 for consistent Project.toml

* Update test/fixtures

* Run reference tests only with Julia 1.7.1

Since Manifest.toml format v2 includes Julia version, reference tests need
exactly equivalent VERSION.

* Link to a specific tag version

Co-authored-by: Nick Robinson <npr251@gmail.com>

* Avoid non-const global

Co-authored-by: Nick Robinson <npr251@gmail.com>

* Remove Julia 1.5 job

Co-authored-by: Nick Robinson <npr251@gmail.com>
  • Loading branch information
tkf and nickrobinson251 authored Jan 8, 2022
1 parent 515c2bc commit 015dfc4
Show file tree
Hide file tree
Showing 27 changed files with 480 additions and 210 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ jobs:
- os: windows-latest
arch: x86
include:
# Add a 1.5 job because that's what Invenia actually uses
# Add 1.7.1 to run the reference tests
- os: ubuntu-latest
version: 1.5
version: 1.7.1
arch: x64
steps:
- uses: actions/checkout@v2
Expand Down
17 changes: 15 additions & 2 deletions src/plugins/project_file.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,27 @@ priority(::ProjectFile, ::typeof(hook)) = typemax(Int) - 5
function hook(p::ProjectFile, t::Template, pkg_dir::AbstractString)
toml = Dict(
"name" => basename(pkg_dir),
"uuid" => string(uuid4()),
"uuid" => string(@mock uuid4()),
"authors" => t.authors,
"version" => string(p.version),
"compat" => Dict("julia" => compat_version(t.julia)),
)
open(io -> TOML.print(io, toml), joinpath(pkg_dir, "Project.toml"), "w")
write_project(joinpath(pkg_dir, "Project.toml"), toml)
end

# Taken from:
# https://github.com/JuliaLang/Pkg.jl/blob/v1.7.0/src/project.jl#L175-L177

function project_key_order(key::String)
_project_key_order = ["name", "uuid", "keywords", "license", "desc", "deps", "compat"]
return something(findfirst(x -> x == key, _project_key_order), length(_project_key_order) + 1)
end

write_project(path::AbstractString, dict) =
open(io -> write_project(io, dict), path; write = true)
write_project(io::IO, dict) =
TOML.print(io, dict, sorted = true, by = key -> (project_key_order(key), key))

"""
compat_version(v::VersionNumber) -> String
Expand Down
3 changes: 1 addition & 2 deletions src/plugins/tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ function add_test_dependency(pkg_dir::AbstractString)
toml = TOML.parsefile(path)
get!(toml, "extras", Dict())["Test"] = TEST_UUID
get!(toml, "targets", Dict())["test"] = ["Test"]
open(io -> TOML.print(io, toml), path, "w")
write_project(path, toml)

# Generate the manifest by updating the project.
# This also ensures that keys in Project.toml are sorted properly.
touch(joinpath(pkg_dir, "Manifest.toml")) # File must exist to be modified by Pkg.
with_project(Pkg.update, pkg_dir)
end
2 changes: 1 addition & 1 deletion test/fixtures/AllPlugins/.appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
environment:
matrix:
- julia_version: 1.0
- julia_version: 1.5
- julia_version: 1.7
- julia_version: nightly
platform:
- x64
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/AllPlugins/.cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ task:
folder: ~/.julia/artifacts
env:
JULIA_VERSION: 1.0
JULIA_VERSION: 1.5
JULIA_VERSION: 1.7
JULIA_VERSION: nightly
install_script:
- sh -c "$(fetch https://raw.githubusercontent.com/ararslan/CirrusCI.jl/master/bin/install.sh -o -)"
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/AllPlugins/.drone.star
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
def main(ctx):
pipelines = []
for arch in ["amd64"]:
for julia in ["1.0", "1.5"]:
for julia in ["1.0", "1.7"]:
pipelines.append(pipeline(arch, julia))
return pipelines

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/AllPlugins/.github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
matrix:
version:
- '1.0'
- '1.5'
- '1.7'
- 'nightly'
os:
- ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/AllPlugins/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Julia 1.0:
extends:
- .script
- .coverage
Julia 1.5:
image: julia:1.5
Julia 1.7:
image: julia:1.7
extends:
- .script
- .coverage
2 changes: 1 addition & 1 deletion test/fixtures/AllPlugins/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ notifications:
email: false
julia:
- 1.0
- 1.5
- 1.7
- nightly
os:
- linux
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/AllPlugins/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "AllPlugins"
uuid = "5b7e9947-ddc0-4b3f-9b55-0d8042f74170"
uuid = "c51a4d33-e9a4-4efb-a257-e0de888ecc28"
authors = ["tester"]
version = "0.1.0"

Expand Down
117 changes: 84 additions & 33 deletions test/fixtures/AllPlugins/docs/Manifest.toml
Original file line number Diff line number Diff line change
@@ -1,98 +1,149 @@
# This file is machine-generated - editing it directly is not advised

[[AllPlugins]]
julia_version = "1.7.1"
manifest_format = "2.0"

[[deps.AllPlugins]]
path = ".."
uuid = "5b7e9947-ddc0-4b3f-9b55-0d8042f74170"
uuid = "c51a4d33-e9a4-4efb-a257-e0de888ecc28"
version = "0.1.0"

[[Base64]]
[[deps.ArgTools]]
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"

[[deps.Artifacts]]
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"

[[deps.Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[Dates]]
[[deps.Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"

[[Distributed]]
deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[DocStringExtensions]]
[[deps.DocStringExtensions]]
deps = ["LibGit2", "Markdown", "Pkg", "Test"]
git-tree-sha1 = "88bb0edb352b16608036faadcc071adda068582a"
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
version = "0.8.1"

[[Documenter]]
[[deps.Documenter]]
deps = ["Base64", "Dates", "DocStringExtensions", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"]
git-tree-sha1 = "0be9bf63e854a2408c2ecd3c600d68d4d87d8a73"
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
version = "0.24.2"

[[InteractiveUtils]]
[[deps.Downloads]]
deps = ["ArgTools", "LibCURL", "NetworkOptions"]
uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"

[[deps.InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

[[JSON]]
[[deps.JSON]]
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
git-tree-sha1 = "b34d7cef7b337321e97d22242c3c2b91f476748e"
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.21.0"

[[LibGit2]]
deps = ["Printf"]
[[deps.LibCURL]]
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"

[[deps.LibCURL_jll]]
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"]
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"

[[deps.LibGit2]]
deps = ["Base64", "NetworkOptions", "Printf", "SHA"]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"

[[Libdl]]
[[deps.LibSSH2_jll]]
deps = ["Artifacts", "Libdl", "MbedTLS_jll"]
uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8"

[[deps.Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"

[[Logging]]
[[deps.Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"

[[Markdown]]
[[deps.Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"

[[Mmap]]
[[deps.MbedTLS_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"

[[deps.Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"

[[Parsers]]
[[deps.MozillaCACerts_jll]]
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"

[[deps.NetworkOptions]]
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"

[[deps.Parsers]]
deps = ["Dates", "Test"]
git-tree-sha1 = "0139ba59ce9bc680e2925aec5b7db79065d60556"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "0.3.10"

[[Pkg]]
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
[[deps.Pkg]]
deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

[[Printf]]
[[deps.Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"

[[REPL]]
deps = ["InteractiveUtils", "Markdown", "Sockets"]
[[deps.REPL]]
deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"]
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"

[[Random]]
deps = ["Serialization"]
[[deps.Random]]
deps = ["SHA", "Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[[SHA]]
[[deps.SHA]]
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"

[[Serialization]]
[[deps.Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"

[[Sockets]]
[[deps.Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"

[[Test]]
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
[[deps.TOML]]
deps = ["Dates"]
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"

[[deps.Tar]]
deps = ["ArgTools", "SHA"]
uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"

[[deps.Test]]
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[[UUIDs]]
[[deps.UUIDs]]
deps = ["Random", "SHA"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[[Unicode]]
[[deps.Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

[[deps.Zlib_jll]]
deps = ["Libdl"]
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"

[[deps.nghttp2_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"

[[deps.p7zip_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"
2 changes: 1 addition & 1 deletion test/fixtures/Basic/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "Basic"
uuid = "5b7e9947-ddc0-4b3f-9b55-0d8042f74170"
uuid = "c51a4d33-e9a4-4efb-a257-e0de888ecc28"
authors = ["tester"]
version = "0.1.0"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
matrix:
version:
- '1.0'
- '1.5'
- '1.7'
- 'nightly'
os:
- ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/DocumenterGitHubActions/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "DocumenterGitHubActions"
uuid = "5b7e9947-ddc0-4b3f-9b55-0d8042f74170"
uuid = "c51a4d33-e9a4-4efb-a257-e0de888ecc28"
authors = ["tester"]
version = "0.1.0"

Expand Down
Loading

2 comments on commit 015dfc4

@nickrobinson251
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/51952

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.7.26 -m "<description of version>" 015dfc41880ca2fd619a3513b891b1804bbdae71
git push origin v0.7.26

Please sign in to comment.