Skip to content

Commit 252d468

Browse files
Fix add_general_registry (#28)
1 parent f813042 commit 252d468

File tree

3 files changed

+28
-17
lines changed

3 files changed

+28
-17
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ on:
1515

1616
jobs:
1717
test:
18-
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
1918
runs-on: ${{ matrix.os }}
2019
strategy:
2120
fail-fast: false
@@ -31,6 +30,9 @@ jobs:
3130
arch:
3231
- x64
3332
- x86
33+
pkg-server:
34+
- ""
35+
- "pkg.julialang.org"
3436
# 32-bit Julia binaries are not available on macOS
3537
exclude:
3638
- os: macOS-latest
@@ -68,6 +70,8 @@ jobs:
6870
${{ runner.os }}-
6971
7072
- uses: ./.github/actions/julia-buildpkg
73+
env:
74+
JULIA_PKG_SERVER: ${{ matrix.pkg-server }}
7175

7276
- uses: julia-actions/julia-runtest@v1
7377

action.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,8 @@ runs:
2525
# * https://github.com/JuliaLang/Pkg.jl/issues/2011
2626
# * https://github.com/JuliaRegistries/General/issues/16777
2727
# * https://github.com/JuliaPackaging/PkgServer.jl/issues/60
28-
- run: julia --color=yes "$GITHUB_ACTION_PATH"/add_general_registry.jl
28+
- run: julia --color=yes "$GITHUB_ACTION_PATH"/add_general_registry.buildpkg.jl
2929
shell: bash
30-
env:
31-
# We set `JULIA_PKG_SERVER` only for this step to enforce
32-
# `Pkg.Registry.add` to use Git. This way, Pkg.jl can send
33-
# the request metadata to pkg.julialang.org when installing
34-
# packages via `Pkg.test`.
35-
JULIA_PKG_SERVER: ""
3630

3731
- run: julia --color=yes --project=${{ inputs.project }} -e 'using Pkg; if VERSION >= v"1.1.0-rc1"; Pkg.build(verbose=true); else Pkg.build(); end'
3832
shell: bash

add_general_registry.jl renamed to add_general_registry.buildpkg.jl

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,35 @@ function general_registry_exists()
1818
if isfile(general_registry_tarball) && isfile(registry_toml_file)
1919
return true
2020
end
21+
2122
general_registry_dir, registry_toml_file = cloned_general_registry_location()
22-
if !isdir(general_registry_dir)
23-
return false
24-
elseif !isfile(registry_toml_file)
25-
return false
26-
else
23+
if isdir(general_registry_dir) && isfile(registry_toml_file)
2724
return true
2825
end
26+
27+
return false
2928
end
3029

3130
function add_general_registry()
32-
@info("Attempting to clone the General registry")
33-
general_registry_dir, registry_toml_file = general_registry_location()
31+
@info("Attempting to install the General registry")
32+
33+
general_registry_tarball, registry_toml_file = tarball_general_registry_location()
34+
rm(general_registry_tarball; force = true, recursive = true)
35+
rm(registry_toml_file; force = true, recursive = true)
36+
37+
general_registry_dir, registry_toml_file = cloned_general_registry_location()
3438
rm(general_registry_dir; force = true, recursive = true)
35-
Pkg.Registry.add("General")
36-
isfile(registry_toml_file) || throw(ErrorException("the Registry.toml file does not exist"))
39+
40+
# If not already set, We set `JULIA_PKG_SERVER` to enforce
41+
# `Pkg.Registry.add` to use Git. This way, Pkg.jl can send
42+
# the request metadata to pkg.julialang.org when installing
43+
# packages via `Pkg.test`.
44+
pkg_server = get(ENV, "JULIA_PKG_SERVER", "")
45+
withenv("JULIA_PKG_SERVER" => pkg_server) do
46+
Pkg.Registry.add("General")
47+
end
48+
49+
general_registry_exists() || throw(ErrorException("The Registry was not intalled properly"))
3750
return nothing
3851
end
3952

0 commit comments

Comments
 (0)