mirror of
https://github.com/julia-actions/julia-buildpkg.git
synced 2026-02-12 09:26:54 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
252d4686a5 | ||
|
|
f813042500 | ||
|
|
139ec78da3 | ||
|
|
6d50efe063 | ||
|
|
f995fa4149 |
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@@ -15,7 +15,6 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@@ -31,6 +30,9 @@ jobs:
|
|||||||
arch:
|
arch:
|
||||||
- x64
|
- x64
|
||||||
- x86
|
- x86
|
||||||
|
pkg-server:
|
||||||
|
- ""
|
||||||
|
- "pkg.julialang.org"
|
||||||
# 32-bit Julia binaries are not available on macOS
|
# 32-bit Julia binaries are not available on macOS
|
||||||
exclude:
|
exclude:
|
||||||
- os: macOS-latest
|
- os: macOS-latest
|
||||||
@@ -68,6 +70,8 @@ jobs:
|
|||||||
${{ runner.os }}-
|
${{ runner.os }}-
|
||||||
|
|
||||||
- uses: ./.github/actions/julia-buildpkg
|
- uses: ./.github/actions/julia-buildpkg
|
||||||
|
env:
|
||||||
|
JULIA_PKG_SERVER: ${{ matrix.pkg-server }}
|
||||||
|
|
||||||
- uses: julia-actions/julia-runtest@v1
|
- uses: julia-actions/julia-runtest@v1
|
||||||
|
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ jobs:
|
|||||||
julia-arch: x86
|
julia-arch: x86
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1.0.0
|
- uses: actions/checkout@v2
|
||||||
- uses: julia-actions/setup-julia@latest
|
- uses: julia-actions/setup-julia@v1
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.julia-version }}
|
version: ${{ matrix.julia-version }}
|
||||||
- uses: julia-actions/julia-buildpkg@master
|
- uses: julia-actions/julia-buildpkg@v1
|
||||||
- uses: julia-actions/julia-runtest@master
|
- uses: julia-actions/julia-runtest@v1
|
||||||
```
|
```
|
||||||
|
|||||||
22
action.yml
22
action.yml
@@ -6,6 +6,14 @@ branding:
|
|||||||
icon: 'box'
|
icon: 'box'
|
||||||
color: 'gray-dark'
|
color: 'gray-dark'
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
project:
|
||||||
|
description: 'Value passed to the --project flag. The default value is the repository root: "@."'
|
||||||
|
default: '@.'
|
||||||
|
precompile:
|
||||||
|
description: 'Whether to allow auto-precompilation (via the `JULIA_PKG_PRECOMPILE_AUTO` env var). Options: yes | no. Default value: no.'
|
||||||
|
default: 'no'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'composite'
|
using: 'composite'
|
||||||
steps:
|
steps:
|
||||||
@@ -17,14 +25,10 @@ runs:
|
|||||||
# * https://github.com/JuliaLang/Pkg.jl/issues/2011
|
# * https://github.com/JuliaLang/Pkg.jl/issues/2011
|
||||||
# * https://github.com/JuliaRegistries/General/issues/16777
|
# * https://github.com/JuliaRegistries/General/issues/16777
|
||||||
# * https://github.com/JuliaPackaging/PkgServer.jl/issues/60
|
# * 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
|
||||||
|
|
||||||
|
- 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
|
shell: bash
|
||||||
env:
|
env:
|
||||||
# We set `JULIA_PKG_SERVER` only for this step to enforce
|
JULIA_PKG_PRECOMPILE_AUTO: "${{ inputs.precompile }}"
|
||||||
# `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 -e 'using Pkg; if VERSION >= v"1.1.0-rc1"; Pkg.build(verbose=true); else Pkg.build(); end'
|
|
||||||
shell: bash
|
|
||||||
|
|||||||
73
add_general_registry.buildpkg.jl
Normal file
73
add_general_registry.buildpkg.jl
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
using Pkg
|
||||||
|
|
||||||
|
function tarball_general_registry_location()
|
||||||
|
reg_dir = joinpath(DEPOT_PATH[1], "registries")
|
||||||
|
general_registry_tarball = joinpath(reg_dir, "General.tar.gz")
|
||||||
|
registry_toml_file = joinpath(reg_dir, "General.toml")
|
||||||
|
return general_registry_tarball, registry_toml_file
|
||||||
|
end
|
||||||
|
|
||||||
|
function cloned_general_registry_location()
|
||||||
|
general_registry_dir = joinpath(DEPOT_PATH[1], "registries", "General")
|
||||||
|
registry_toml_file = joinpath(general_registry_dir, "Registry.toml")
|
||||||
|
return general_registry_dir, registry_toml_file
|
||||||
|
end
|
||||||
|
|
||||||
|
function general_registry_exists()
|
||||||
|
general_registry_tarball, registry_toml_file = tarball_general_registry_location()
|
||||||
|
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) && isfile(registry_toml_file)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function add_general_registry()
|
||||||
|
@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)
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
function main(; n = 10, max_delay = 120)
|
||||||
|
VERSION >= v"1.5-" || return
|
||||||
|
|
||||||
|
if general_registry_exists()
|
||||||
|
@info("The General registry already exists locally")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
delays = ExponentialBackOff(; n = n, max_delay = max_delay)
|
||||||
|
try
|
||||||
|
retry(add_general_registry; delays = delays)()
|
||||||
|
@info("Successfully added the General registry")
|
||||||
|
catch ex
|
||||||
|
msg = "I was unable to add the General registry. However, the build will continue."
|
||||||
|
@error(msg, exception=(ex,catch_backtrace()))
|
||||||
|
end
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
main()
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
using Pkg
|
|
||||||
|
|
||||||
function general_registry_location()
|
|
||||||
general_registry_dir = joinpath(DEPOT_PATH[1], "registries", "General")
|
|
||||||
registry_toml_file = joinpath(general_registry_dir, "Registry.toml")
|
|
||||||
return general_registry_dir, registry_toml_file
|
|
||||||
end
|
|
||||||
|
|
||||||
function general_registry_exists()
|
|
||||||
general_registry_dir, registry_toml_file = general_registry_location()
|
|
||||||
if !isdir(general_registry_dir)
|
|
||||||
return false
|
|
||||||
elseif !isfile(registry_toml_file)
|
|
||||||
return false
|
|
||||||
else
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function add_general_registry()
|
|
||||||
@info("Attempting to clone the General registry")
|
|
||||||
general_registry_dir, registry_toml_file = 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"))
|
|
||||||
return nothing
|
|
||||||
end
|
|
||||||
|
|
||||||
function main(; n = 10, max_delay = 120)
|
|
||||||
VERSION >= v"1.5-" || return
|
|
||||||
|
|
||||||
if general_registry_exists()
|
|
||||||
@info("The General registry already exists locally")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
delays = ExponentialBackOff(; n = n, max_delay = max_delay)
|
|
||||||
try
|
|
||||||
retry(add_general_registry; delays = delays)()
|
|
||||||
@info("Successfully added the General registry")
|
|
||||||
catch ex
|
|
||||||
msg = "I was unable to add the General registry. However, the build will continue."
|
|
||||||
@error(msg, exception=(ex,catch_backtrace()))
|
|
||||||
end
|
|
||||||
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
main()
|
|
||||||
Reference in New Issue
Block a user