-
Notifications
You must be signed in to change notification settings - Fork 17
/
action.yml
70 lines (61 loc) · 2.88 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: 'Run Pkg.build'
description: 'Run the build step in a Julia package'
author: 'David Anthoff'
branding:
icon: 'box'
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'
localregistry:
description: 'Add local registries hosted on GitHub. Specified by providing the url (https/ssh) to the repositories as a newline (\n) seperated list.
User is responsible for setting up the necessary SSH-Keys to access the repositories if necessary.'
default: ''
git_cli:
description: 'Determine if Pkg uses the cli git executable (Julia >= 1.7). Might be necessary for more complicated SSH setups.
Options: true | false. Default : false'
default: 'false'
ignore-no-cache:
description: 'Whether to ignore if there appears to be no depot caching. Silences an action notice recommending `julia-actions/cache`.'
default: 'false'
runs:
using: 'composite'
steps:
- 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: |
if "${{ inputs.ignore-no-cache }}" == "false" && !isdir(DEPOT_PATH[1])
println("::notice title=[julia-buildpkg] Caching of the julia depot was not detected ::Consider using `julia-actions/cache` to speed up runs https://github.com/julia-actions/cache To ignore, set input `ignore-no-cache: true` ")
end
import Pkg
# Determine if Pkg uses git-cli executable instead of LibGit2
VERSION >= v"1.7-" && (ENV["JULIA_PKG_USE_CLI_GIT"] = ${{ inputs.git_cli }})
if VERSION < v"1.7-" && ${{ inputs.git_cli }} == true
printstyled("::notice::JULIA_PKG_USE_CLI_GIT requires Julia >= 1.7. Using default LibGit2 git-interface instead! \n"; color = :yellow)
end
if VERSION >= v"1.5-"
if VERSION >= v"1.8-"
# Install the default registries
Pkg.Registry.add()
else
Pkg.Registry.add("General")
end
# If provided add local registries
if !isempty("${{ inputs.localregistry }}")
local_repos = split("${{ inputs.localregistry }}", "\n") .|> string
for repo_url in local_repos
isempty(repo_url) && continue
Pkg.Registry.add(Pkg.RegistrySpec(; url = repo_url))
end
end
end
VERSION >= v"1.1.0-rc1" ? retry(Pkg.build)(verbose=true) : retry(Pkg.build)()
shell: julia --color=yes --project=${{ inputs.project }} {0}
env:
JULIA_PKG_PRECOMPILE_AUTO: "${{ inputs.precompile }}"
GITHUB_TOKEN: ${{ github.token }}