Skip to content

Commit 3bee7c7

Browse files
committed
New version: OMParser v0.0.5
UUID: 11f87224-cae7-4e99-a924-e50d12f62c59 Repo: Tree: b66d6d9785caeb71e502dc0dd0416d17358288cf
1 parent a5dcbd7 commit 3bee7c7

6 files changed

Lines changed: 166 additions & 2 deletions

File tree

.ci/auto_register.jl

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#=
2+
Auto-registration driver. Run from the registry repository root:
3+
4+
julia .ci/auto_register.jl
5+
6+
For each package listed in .ci/packages.toml:
7+
1. Shallow-clone the configured branch into a temp dir.
8+
2. Read the working copy's Project.toml version.
9+
3. Compare against the highest version already in <L>/<name>/Versions.toml.
10+
4. If the working copy is newer, call LocalRegistry.register(...; push=false)
11+
so a single commit lands in the registry working tree. The workflow does
12+
the actual git push.
13+
14+
Packages whose cloned Project.toml still contains a [sources] block are
15+
skipped with a warning. This script is the wrong tool for those.
16+
=#
17+
18+
using Pkg
19+
using TOML
20+
21+
const REGISTRY_PATH = pwd()
22+
const CONFIG_PATH = joinpath(REGISTRY_PATH, ".ci", "packages.toml")
23+
24+
Pkg.add("LocalRegistry")
25+
using LocalRegistry
26+
27+
function latest_registered(regdir::AbstractString, name::AbstractString)
28+
L = uppercase(string(name[1]))
29+
vfile = joinpath(regdir, L, name, "Versions.toml")
30+
isfile(vfile) || return nothing
31+
parsed = TOML.parsefile(vfile)
32+
isempty(parsed) && return nothing
33+
return maximum(VersionNumber.(keys(parsed)))
34+
end
35+
36+
function clone_at(repo::AbstractString, branch::AbstractString)
37+
dir = mktempdir(; prefix = "regsync_")
38+
run(`git clone --depth 1 --branch $branch $repo $dir`)
39+
return dir
40+
end
41+
42+
function process(pkg)
43+
name = pkg["name"]
44+
repo = pkg["repo"]
45+
branch = get(pkg, "branch", "master")
46+
println("[check] $name @ $branch ($repo)")
47+
48+
clonedir = clone_at(repo, branch)
49+
proj = TOML.parsefile(joinpath(clonedir, "Project.toml"))
50+
51+
if haskey(proj, "sources")
52+
@warn "Skipping $name: cloned Project.toml has a [sources] block"
53+
return
54+
end
55+
56+
wcver = VersionNumber(proj["version"])
57+
regver = latest_registered(REGISTRY_PATH, name)
58+
59+
if regver !== nothing && wcver <= regver
60+
println("[skip] $name v$wcver already covered (registered: v$regver)")
61+
return
62+
end
63+
64+
println("[register] $name v$wcver (previous: $(regver === nothing ? "none" : "v$regver"))")
65+
register(clonedir; registry = REGISTRY_PATH, push = false)
66+
end
67+
68+
function main()
69+
cfg = TOML.parsefile(CONFIG_PATH)
70+
packages = get(cfg, "package", Any[])
71+
isempty(packages) && (println("No packages configured."); return)
72+
for pkg in packages
73+
try
74+
process(pkg)
75+
catch err
76+
@error "Failed to process $(get(pkg, "name", "?"))" exception = (err, catch_backtrace())
77+
end
78+
end
79+
end
80+
81+
main()

.ci/packages.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Packages tracked by the daily auto-update workflow.
2+
#
3+
# Only list packages whose Project.toml has NO [sources] block. Packages with
4+
# in-tree path sources require a separate strip-and-register flow and must not
5+
# be added here.
6+
#
7+
# Each entry needs:
8+
# name = the package name as recorded in the registry
9+
# repo = HTTPS git URL to clone
10+
# branch = branch to track (default master)
11+
12+
[[package]]
13+
name = "ImmutableList"
14+
repo = "https://github.com/OpenModelica/ImmutableList.jl.git"
15+
branch = "master"
16+
17+
[[package]]
18+
name = "OMParser"
19+
repo = "https://github.com/OpenModelica/OMParser.jl.git"
20+
branch = "master"
21+
22+
[[package]]
23+
name = "OMRuntimeExternalC"
24+
repo = "https://github.com/OpenModelica/OMRuntimeExternalC.jl.git"
25+
branch = "master"

.github/workflows/auto-update.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Auto-update registry
2+
3+
on:
4+
schedule:
5+
# Daily at 23:00 UTC. GitHub schedules are best-effort; jobs may run
6+
# several minutes late or be skipped under platform load.
7+
- cron: '0 23 * * *'
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: write
12+
13+
concurrency:
14+
group: auto-update
15+
cancel-in-progress: false
16+
17+
jobs:
18+
update:
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 20
21+
steps:
22+
- name: Checkout registry
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Configure git identity
28+
run: |
29+
git config user.name "OpenModelica Registry Bot"
30+
git config user.email "actions@users.noreply.github.com"
31+
32+
- name: Set up Julia
33+
uses: julia-actions/setup-julia@v2
34+
with:
35+
version: '1.12'
36+
37+
- name: Run auto-register
38+
run: julia --color=yes .ci/auto_register.jl
39+
40+
- name: Push registry commits
41+
run: |
42+
if [ "$(git rev-parse HEAD)" != "$(git rev-parse origin/master)" ]; then
43+
git push origin HEAD:master
44+
else
45+
echo "No new versions; nothing to push."
46+
fi

O/OMParser/Compat.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
[0]
1+
["0-0.0.2"]
22
julia = "1.7.0-1"
3+
4+
["0.0.5-0"]
5+
Absyn = "1.3.3"

O/OMParser/Deps.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,10 @@ MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
1010
MetaModelica = "9d7f2a79-07b5-5542-8b19-c0100dda6b06"
1111
Tar = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
1212
TarIterators = "06456b94-f2fb-4c2e-911f-0795f0d2fb0a"
13-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1413
ZipFile = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea"
14+
15+
["0-0.0.2"]
16+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
17+
18+
["0.0.5-0"]
19+
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

O/OMParser/Versions.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
["0.0.1"]
22
git-tree-sha1 = "2e1925ff3350126130574e0a8f0124d7b5130440"
3+
34
["0.0.2"]
45
git-tree-sha1 = "f9399093c0d32efdba35c12733facf17eca540c6"
6+
7+
["0.0.5"]
8+
git-tree-sha1 = "b66d6d9785caeb71e502dc0dd0416d17358288cf"

0 commit comments

Comments
 (0)