Compare commits

...

8 Commits

Author SHA1 Message Date
Sascha Mann
18a454f022 Deprecate @master 2023-03-15 23:07:14 +01:00
Fredrik Ekre
72ddd0fcdc Export the JULIA_PKG_SERVER_REGISTRY_PREFERENCE variable for subsequent steps. (#33) 2023-03-13 18:32:34 +01:00
Fredrik Ekre
7c59a056df Revert shortcut for missing deps/build.jl file. (#32) 2023-03-13 13:09:48 +01:00
Fredrik Ekre
fcafde1b68 Use eager Pkg server registry instead of git cloning (#31)
* Use eager Pkg server registry instead of git cloning

This patch removes the git cloning of General and instead uses the eager
registry flavor. In addition, the action exits early if no deps/build.jl
file exist.

* Use env: key instead.
2023-03-13 12:20:47 +01:00
Ian Butterworth
252d4686a5 Fix add_general_registry (#28) 2022-12-20 11:52:13 +01:00
Ian Butterworth
f813042500 Detect if the registry is already installed via tarball (#25) 2022-12-19 01:16:36 +01:00
Ian Butterworth
139ec78da3 Disable autoprecompile by default (#26) 2022-12-17 18:35:44 +01:00
Rik Huijzer
6d50efe063 Suggest using releases instead of master (#18) 2022-02-11 14:40:27 +01:00
4 changed files with 35 additions and 71 deletions

View File

@@ -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

View File

@@ -26,10 +26,20 @@ 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
``` ```
### Registry flavor preference
This actions defines (and exports for subsequent steps of the workflow) the
environmental variable `JULIA_PKG_SERVER_REGISTRY_PREFERENCE=eager` unless it
is already set. If you want another registry flavor (i.e. `conservative`) this
should be defined in the `env:` section of the relevant workflow or step. See
[Registry flavors](https://pkgdocs.julialang.org/dev/registries/#Registry-flavors)
for more information.

View File

@@ -10,26 +10,25 @@ inputs:
project: project:
description: 'Value passed to the --project flag. The default value is the repository root: "@."' description: 'Value passed to the --project flag. The default value is the repository root: "@."'
default: '@.' 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:
# Occasionally, there are rather large delays (> a few hours) - name: 'DEPRECATION WARNING: julia-actions/julia-buildpkg@master will no longer receive updates and will start to error in the future. Please use version tags like julia-actions/julia-buildpkg@v1 or commit SHAs in your workflows!'
# between the time a package is registered in General and run: |
# propagated to pkg.julialang.org. We can avoid this by manually echo "::warning title=DEPRECATION WARNING::julia-actions/julia-buildpkg@master will no longer receive updates and will start to error in the future. Please use version tags like julia-actions/julia-buildpkg@v1 or commit SHAs in your workflows!"
# cloning ~/.julia/registries/General/ in Julia 1.5 and later. echo "# :warning: DEPRECATION WARNING :warning: julia-actions/julia-buildpkg@master will no longer receive updates and will start to error in the future. Please use version tags like julia-actions/julia-buildpkg@v1 or commit SHAs in your workflows!" >> $GITHUB_STEP_SUMMARY
# See:
# * 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
shell: bash shell: bash
- name: Set and export registry flavor preference
run: echo "JULIA_PKG_SERVER_REGISTRY_PREFERENCE=${JULIA_PKG_SERVER_REGISTRY_PREFERENCE:-eager}" >> ${GITHUB_ENV}
shell: bash
- run: |
import Pkg
VERSION >= v"1.5-" && Pkg.Registry.add("General")
VERSION >= v"1.1.0-rc1" ? Pkg.build(verbose=true) : Pkg.build()
shell: julia --color=yes --project=${{ inputs.project }} {0}
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=${{ inputs.project }} -e 'using Pkg; if VERSION >= v"1.1.0-rc1"; Pkg.build(verbose=true); else Pkg.build(); end'
shell: bash

View File

@@ -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()