-
Notifications
You must be signed in to change notification settings - Fork 0
184 lines (164 loc) · 6.79 KB
/
msl-test.yml
File metadata and controls
184 lines (164 loc) · 6.79 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: MSL Test & GitHub Pages
# Run the full Modelica Standard Library pipeline and publish results to
# GitHub Pages at results/<bm_version>/Modelica/<lib_version>/
#
# Prerequisites (one-time repo setup):
# Settings → Pages → Source: Deploy from a branch → Branch: gh-pages / (root)
on:
schedule:
- cron: '0 3 * * *' # every day 03:00 UTC
workflow_dispatch:
inputs:
library:
description: 'Modelica library name'
required: false
default: 'Modelica'
type: string
lib_version:
description: 'Modelica Standard Library version'
required: false
default: '4.1.0'
type: string
bm_version:
description: 'BaseModelica.jl version (branch, tag, or "main")'
required: false
default: 'main'
type: string
bm_options:
description: 'Comma-separated --baseModelicaOptions values for OpenModelica Base Modelica export'
required: false
default: 'scalarize,moveBindings,inlineFunctions'
type: string
filter:
description: 'Julia regex string to filter model names (empty string means no filter)'
required: false
default: '^(?!Modelica\.Clocked)'
type: string
solver:
description: 'ODE solver algorithm (any DifferentialEquations.jl algorithm name, e.g. Rodas5P, FBDF)'
required: false
default: 'Rodas5P'
type: string
concurrency:
group: pages-${{ inputs.library || 'Modelica' }}-${{ inputs.lib_version || '4.1.0' }}-${{ inputs.bm_version || 'main' }}
cancel-in-progress: false # never abort a Pages deployment mid-flight
permissions:
contents: write # needed to push to gh-pages
pages: write # needed to deploy to GitHub Pages
id-token: write # needed for OIDC Pages deployment
jobs:
test-and-deploy:
name: Test MSL & Deploy Pages
runs-on: ubuntu-latest
timeout-minutes: 480
env:
LIB_NAME: ${{ inputs.library || 'Modelica' }}
LIB_VERSION: ${{ inputs.lib_version || '4.1.0' }}
BM_VERSION_INPUT: ${{ inputs.bm_version || 'main' }}
BM_OPTIONS: ${{ inputs.bm_options || 'scalarize,moveBindings,inlineFunctions' }}
FILTER: ${{ inputs.filter || '^(?!Modelica\.Clocked)' }}
SOLVER: ${{ inputs.solver || 'Rodas5P' }}
steps:
- name: Checkout source
uses: actions/checkout@v6
- name: Set up OpenModelica (nightly)
uses: OpenModelica/setup-openmodelica@v1.0
with:
version: nightly
packages: |
omc
libraries: |
'${{ env.LIB_NAME }} ${{ env.LIB_VERSION }}'
- name: Set up Julia
uses: julia-actions/setup-julia@v2
with:
version: '1'
arch: x64
- name: Restore Julia package cache
uses: julia-actions/cache@v3
- name: Build package
run: |
julia --project=. -e '
using Pkg
bm_ver = get(ENV, "BM_VERSION_INPUT", "main")
if bm_ver != "main"
Pkg.add(name="BaseModelica", version=bm_ver)
else
Pkg.add(name="BaseModelica", rev=bm_ver)
end
Pkg.instantiate()
'
# ── Resolve versions ──────────────────────────────────────────────────────
- name: Resolve BaseModelica.jl version
id: versions
run: |
if [ "$BM_VERSION_INPUT" = "main" ]; then
echo "bm_version=main" >> "$GITHUB_OUTPUT"
else
julia --project=. -e '
import BaseModelica
println("bm_version=" * string(pkgversion(BaseModelica)))
' >> "$GITHUB_OUTPUT"
fi
# ── Reference results ─────────────────────────────────────────────────────
- name: Checkout MAP-LIB reference results
uses: actions/checkout@v6
with:
repository: modelica/MAP-LIB_ReferenceResults
ref: v${{ env.LIB_VERSION }}
path: MAP-LIB_ReferenceResults
fetch-depth: 1
# ── Run the pipeline ──────────────────────────────────────────────────────
- name: Run MSL pipeline
env:
BM_VERSION: ${{ steps.versions.outputs.bm_version }}
run: |
julia --project=. -e '
using BaseModelicaLibraryTesting
using DifferentialEquations
solver_name = get(ENV, "SOLVER", "Rodas5P")
configure_simulate!(solver = getproperty(DifferentialEquations, Symbol(solver_name))())
filter_str = get(ENV, "FILTER", "")
main(
library = ENV["LIB_NAME"],
version = ENV["LIB_VERSION"],
filter = isempty(filter_str) ? nothing : filter_str,
results_root = "results/$(ENV["BM_VERSION"])/$(ENV["LIB_NAME"])/$(ENV["LIB_VERSION"])",
ref_root = "MAP-LIB_ReferenceResults",
)
'
# ── Deploy to gh-pages ────────────────────────────────────────────────────
- name: Prepare gh-pages worktree
run: |
git fetch origin gh-pages 2>/dev/null || true
if git show-ref --verify refs/remotes/origin/gh-pages 2>/dev/null; then
git worktree add site origin/gh-pages
else
# First ever run: create an orphan branch
git worktree add --orphan -b gh-pages site
fi
- name: Copy new results into gh-pages tree
env:
BM_VERSION: ${{ steps.versions.outputs.bm_version }}
run: |
rm -rf "site/results/${BM_VERSION}/${LIB_NAME}/${LIB_VERSION}"
rsync -a results/ site/results/
- name: Generate landing page
run: python3 .github/scripts/gen_landing_page.py site
- name: Commit and push to gh-pages
env:
BM_VERSION: ${{ steps.versions.outputs.bm_version }}
run: |
cd site
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git diff --cached --quiet && { echo "Nothing to commit."; exit 0; }
git commit -m "results: ${BM_VERSION}/${LIB_NAME}/${LIB_VERSION} [$(date -u '+%Y-%m-%d')]"
git push origin HEAD:gh-pages
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v4
with:
path: site/
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4