|
10 | 10 | type: string |
11 | 11 | localregistry: |
12 | 12 | description: 'URLs of registries besides General to use. Specified by providing the url (https/ssh) to the Github |
13 | | - repositories as a newline (\n) seperated list. Should correspond to the registry names listed in |
14 | | - `localregistry-names`.' |
15 | | - default: "" |
16 | | - required: false |
17 | | - type: string |
18 | | - localregistry-names: |
19 | | - description: 'Names of registries besides General to use. Specified by providing the name of the registries |
20 | | - as a newline (\n) seperated list. Should correspond to the registry URLs listed in `localregistry`.' |
| 13 | + repositories as a newline (\n) seperated list.' |
21 | 14 | default: "" |
22 | 15 | required: false |
23 | 16 | type: string |
@@ -53,23 +46,32 @@ jobs: |
53 | 46 | - name: "Run CompatHelper" |
54 | 47 | run: | |
55 | 48 | import CompatHelper |
| 49 | + import LibGit2 |
56 | 50 | import Pkg |
| 51 | + import TOML |
| 52 | + function registry_info_from_url(url::AbstractString) |
| 53 | + return mktempdir() do tmp_path |
| 54 | + # Retry to help spurious connection issues, particularly on CI. |
| 55 | + # See https://github.com/JuliaLang/Pkg.jl/blob/v1.11.0/src/Registry/Registry.jl#L246-L248. |
| 56 | + repo = retry(LibGit2.clone; delays=fill(1.0, 5), check=(s, e) -> e isa LibGit2.GitError)(url, tmp_path) |
| 57 | + LibGit2.close(repo) |
| 58 | + return TOML.parsefile(joinpath(tmp_path, "Registry.toml")) |
| 59 | + end |
| 60 | + end |
| 61 | + registry_name_from_url(url::AbstractString) = registry_info_from_url(url)["name"] |
57 | 62 | registries = [ |
58 | 63 | Pkg.RegistrySpec(; |
59 | | - name = "General", |
60 | 64 | url = "https://github.com/JuliaRegistries/General.git", |
| 65 | + name = "General", |
61 | 66 | ) |
62 | 67 | ] |
63 | 68 | if !isempty("${{ inputs.localregistry }}") |
64 | 69 | registry_urls = split("${{ inputs.localregistry }}", "\n") .|> string |
65 | | - registry_names = if !isempty("${{ inputs.localregistry-names }}") |
66 | | - split("${{ inputs.localregistry-names }}", "\n") .|> string |
67 | | - else |
68 | | - # Guess the registry name from the last part of the repository URL. |
69 | | - map(registry_url -> string(first(split(last(split(registry_url, '/')), '.'))), registry_urls) |
70 | | - end |
71 | | - for (registry_url, registry_name) in zip(registry_urls, registry_names) |
| 70 | + for registry_url in registry_urls |
72 | 71 | isempty(registry_url) && continue |
| 72 | + registry_name = registry_name_from_url(registry_url) |
| 73 | + # `CompatHelper.main` requires both the URL and the name. |
| 74 | + # TODO: Raise an issue about that in CompatHelper.jl. |
73 | 75 | push!(registries, Pkg.RegistrySpec(; url=registry_url, name=registry_name)) |
74 | 76 | end |
75 | 77 | end |
|
0 commit comments