Skip to content

Commit

Permalink
Fix add_general_registry (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth authored Dec 20, 2022
1 parent f813042 commit 252d468
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 17 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ on:

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -31,6 +30,9 @@ jobs:
arch:
- x64
- x86
pkg-server:
- ""
- "pkg.julialang.org"
# 32-bit Julia binaries are not available on macOS
exclude:
- os: macOS-latest
Expand Down Expand Up @@ -68,6 +70,8 @@ jobs:
${{ runner.os }}-
- uses: ./.github/actions/julia-buildpkg
env:
JULIA_PKG_SERVER: ${{ matrix.pkg-server }}

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

Expand Down
8 changes: 1 addition & 7 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,8 @@ runs:
# * https://github.com/JuliaLang/Pkg.jl/issues/2011
# * https://github.com/JuliaRegistries/General/issues/16777
# * https://github.com/JuliaPackaging/PkgServer.jl/issues/60
- run: julia --color=yes "$GITHUB_ACTION_PATH"/add_general_registry.jl
- run: julia --color=yes "$GITHUB_ACTION_PATH"/add_general_registry.buildpkg.jl
shell: bash
env:
# We set `JULIA_PKG_SERVER` only for this step to enforce
# `Pkg.Registry.add` to use Git. This way, Pkg.jl can send
# the request metadata to pkg.julialang.org when installing
# packages via `Pkg.test`.
JULIA_PKG_SERVER: ""

- 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'
shell: bash
Expand Down
31 changes: 22 additions & 9 deletions add_general_registry.jl → add_general_registry.buildpkg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,35 @@ function general_registry_exists()
if isfile(general_registry_tarball) && isfile(registry_toml_file)
return true
end

general_registry_dir, registry_toml_file = cloned_general_registry_location()
if !isdir(general_registry_dir)
return false
elseif !isfile(registry_toml_file)
return false
else
if isdir(general_registry_dir) && isfile(registry_toml_file)
return true
end

return false
end

function add_general_registry()
@info("Attempting to clone the General registry")
general_registry_dir, registry_toml_file = general_registry_location()
@info("Attempting to install the General registry")

general_registry_tarball, registry_toml_file = tarball_general_registry_location()
rm(general_registry_tarball; force = true, recursive = true)
rm(registry_toml_file; force = true, recursive = true)

general_registry_dir, registry_toml_file = cloned_general_registry_location()
rm(general_registry_dir; force = true, recursive = true)
Pkg.Registry.add("General")
isfile(registry_toml_file) || throw(ErrorException("the Registry.toml file does not exist"))

# If not already set, We set `JULIA_PKG_SERVER` to enforce
# `Pkg.Registry.add` to use Git. This way, Pkg.jl can send
# the request metadata to pkg.julialang.org when installing
# packages via `Pkg.test`.
pkg_server = get(ENV, "JULIA_PKG_SERVER", "")
withenv("JULIA_PKG_SERVER" => pkg_server) do
Pkg.Registry.add("General")
end

general_registry_exists() || throw(ErrorException("The Registry was not intalled properly"))
return nothing
end

Expand Down

0 comments on commit 252d468

Please sign in to comment.