Repository navigation
279 lines (256 loc) · 12 KB
/
Copy pathcoverage.yml
File metadata and controls
279 lines (256 loc) · 12 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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
name: MSL coverage
# The coverage of the Modelica Standard Library examples through OM.jl
# (flatten, translate, simulate, validate against the reference results),
# published as documentation: docs/COVERAGE.md and the "Latest coverage"
# section of README.md (scripts/publish_coverage.jl), and on the coverage site
# (GitHub Pages from the gh-pages branch, scripts/publish_site.jl): one page
# per measured date, an index over all runs and the README badge.
#
# The run is a no-skip run (OMJL_COVERAGE_NOSKIP=1): the registry's
# skipPhases and broken marks are removed, so every model goes through every
# phase and the documentation shows what really stops each one.
#
# Two shard jobs measure every second model each (OMJL_COVERAGE_SHARD), each
# within the 6-hour job limit; the publish job merges their results
# (scripts/merge_coverage.jl, every model exactly once, the same commits) and
# publishes them. Standard runners only.
#
# Two MSL versions: 3.2.3 weekly (docs/COVERAGE.md, the README's coverage
# section, the site's root) and 4.1.0 every third day (docs/COVERAGE_4.1.0.md,
# its own README section, the site's msl-4.1.0/). OMFrontend bundles 3.2.3;
# 4.1.0 is installed on the runner from the MSL repository, as OpenModelica's
# package manager lays it out (~/.openmodelica/libraries).
#
# OM.jl and the sibling packages are checked out at the branch this workflow
# runs on (or `line`), as in OM.jl's omjl-ci.yml. The models' experiment
# settings come from models/experiments_Modelica_<version>.txt (there is no
# omc on the runner; record_experiments() refreshes the file).
#
# Manual runs (Actions > MSL coverage > Run workflow) commit the documentation
# back and publish the run on the site when `commit` is set; the scheduled
# runs always do. A schedule only fires
# from the default branch, so it measures that branch's line.
on:
workflow_dispatch:
inputs:
msl:
description: MSL version
type: choice
options: ["3.2.3", "4.1.0"]
default: "3.2.3"
line:
description: OM.jl line to measure (empty for the branch the workflow runs on)
required: false
default: ""
julia:
description: Julia version
required: false
default: "1.13"
workers:
description: Worker processes (models run in parallel; 2 ran out of the runner's 16 GB at model 327, 2026-10-03)
required: false
default: "1"
timeout:
description: Seconds per model
required: false
default: "600"
commit:
description: Commit docs/COVERAGE.md and README.md back to the branch and add the run to the coverage site
type: boolean
required: false
default: false
schedule:
- cron: "0 2 * * 0" # MSL 3.2.3: Sundays 02:00 UTC
- cron: "0 14 */3 * *" # MSL 4.1.0: every third day of the month (1st, 4th, ...), 14:00 UTC
permissions:
contents: write # the documentation commit
actions: write # julia-actions/cache deletes the caches it replaces
concurrency:
group: coverage-${{ github.ref }}
cancel-in-progress: false
jobs:
coverage:
name: MSL ${{ inputs.msl || (github.event.schedule == '0 14 */3 * *' && '4.1.0') || '3.2.3' }} coverage, shard ${{ matrix.shard }}/2, Julia ${{ inputs.julia || '1.13' }}
runs-on: ubuntu-latest
timeout-minutes: 360
strategy:
fail-fast: false
matrix:
shard: [1, 2]
env:
JULIA_PKG_PRECOMPILE_AUTO: "0"
LD_LIBRARY_PATH: ${{ github.workspace }}/OM.jl/OMRuntimeExternalC.jl/lib/ext/shared/x86_64-linux-gnu
# The MSL version: the input, 4.1.0 for the every-third-day schedule, else 3.2.3.
MSL: ${{ inputs.msl || (github.event.schedule == '0 14 */3 * *' && '4.1.0') || '3.2.3' }}
OMJL_COVERAGE_MSL: MSL:${{ inputs.msl || (github.event.schedule == '0 14 */3 * *' && '4.1.0') || '3.2.3' }}
steps:
- name: Check out OM.jl
uses: JKRT/OM.jl/.github/actions/checkout-siblings@master
with:
packages: OM
path: .
line: ${{ inputs.line }}
- name: Check out OMLibraryTesting
uses: actions/checkout@v4
with:
path: OM.jl/OMLibraryTesting.jl
- name: Set up
uses: ./OM.jl/OMLibraryTesting.jl/.github/actions/coverage-setup
with:
line: ${{ inputs.line }}
julia: ${{ inputs.julia || '1.13' }}
msl: ${{ env.MSL }}
# The MAP-LIB reference results (1.3 GB for 3.2.3, 2 GB for 4.1.0) change with
# download_refs.sh and the experiment lists only.
- name: Cache the reference results
id: refs
uses: actions/cache@v4
with:
path: |
OM.jl/OMLibraryTesting.jl/reference/csv
OM.jl/OMLibraryTesting.jl/reference/signals
OM.jl/OMLibraryTesting.jl/reference/${{ env.MSL }}
key: msl-refs-${{ env.MSL }}-${{ hashFiles('OM.jl/OMLibraryTesting.jl/reference/download_refs.sh', 'OM.jl/OMLibraryTesting.jl/models/experiments_Modelica_*.txt') }}
- name: Download the reference results
if: steps.refs.outputs.cache-hit != 'true'
working-directory: OM.jl/OMLibraryTesting.jl/reference
run: |
if [ "$MSL" = 3.2.3 ]; then bash download_refs.sh; else bash download_refs.sh --msl "$MSL"; fi
- name: Commits measured
run: |
for d in OM.jl OM.jl/*.jl; do
if [ -d "$d/.git" ]; then echo "$(basename "$d") $(git -C "$d" rev-parse --short HEAD)"; fi
done | tee commits.txt
- name: Coverage
working-directory: OM.jl/OMLibraryTesting.jl
env:
OMJL_COVERAGE_TAG: ci
OMJL_COVERAGE_NOSKIP: "1"
OMJL_COVERAGE_SHARD: ${{ matrix.shard }}/2
OMJL_COVERAGE_WORKERS: ${{ inputs.workers || '1' }}
OMJL_COVERAGE_TIMEOUT: ${{ inputs.timeout || '600' }}
# One thread per worker: OMLibraryTesting runs no parallel workloads.
JULIA_NUM_THREADS: "1"
# A model whose worker passes its share of 11 GB fails with its memory (the limit is
# per worker: OMJL_COVERAGE_MEMORY_LIMIT_GB); past the runner's 16 GB the runner shut
# down and the shard's results were lost (MSL 3.2.3 Rectifier6pulseFFT, 2026-10-24).
run: |
export OMJL_COVERAGE_MEMORY_LIMIT_GB=$(awk -v w="$OMJL_COVERAGE_WORKERS" 'BEGIN { printf "%.1f", 11 / w }')
julia --color=yes --project=. scripts/run_full_coverage.jl
- name: Upload the shard's results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: msl-coverage-${{ env.MSL }}-shard-${{ matrix.shard }}
path: |
commits.txt
OM.jl/OMLibraryTesting.jl/reports/
OM.jl/OMLibraryTesting.jl/logs/partial_ci_*.jls
if-no-files-found: error
# Both shards' results as one run: the reports, the documentation and the site.
publish:
name: MSL ${{ inputs.msl || (github.event.schedule == '0 14 */3 * *' && '4.1.0') || '3.2.3' }} coverage, publish
needs: coverage
runs-on: ubuntu-latest
timeout-minutes: 90
env:
JULIA_PKG_PRECOMPILE_AUTO: "0"
LD_LIBRARY_PATH: ${{ github.workspace }}/OM.jl/OMRuntimeExternalC.jl/lib/ext/shared/x86_64-linux-gnu
MSL: ${{ inputs.msl || (github.event.schedule == '0 14 */3 * *' && '4.1.0') || '3.2.3' }}
OMJL_COVERAGE_MSL: MSL:${{ inputs.msl || (github.event.schedule == '0 14 */3 * *' && '4.1.0') || '3.2.3' }}
OMJL_COVERAGE_TAG: ci
NOTE: >-
No-skip run on GitHub Actions (ubuntu-latest, Julia ${{ inputs.julia || '1.13' }}),
2 shards of ${{ inputs.workers || '1' }} workers, ${{ inputs.timeout || '600' }} s per model
steps:
- name: Check out OM.jl
uses: JKRT/OM.jl/.github/actions/checkout-siblings@master
with:
packages: OM
path: .
line: ${{ inputs.line }}
- name: Check out OMLibraryTesting
uses: actions/checkout@v4
with:
path: OM.jl/OMLibraryTesting.jl
- name: Set up
uses: ./OM.jl/OMLibraryTesting.jl/.github/actions/coverage-setup
with:
line: ${{ inputs.line }}
julia: ${{ inputs.julia || '1.13' }}
- name: The version's documentation
run: |
doc=docs/COVERAGE.md
[ "$MSL" = 3.2.3 ] || doc="docs/COVERAGE_$MSL.md"
echo "COVERAGE_MD=$doc" >> "$GITHUB_ENV"
- name: Download the shards' results
uses: actions/download-artifact@v4
with:
pattern: msl-coverage-${{ env.MSL }}-shard-*
path: ${{ runner.temp }}/shards
# Both shards measured the same commits (checked out at their start).
- name: Commits measured
run: |
shards="$RUNNER_TEMP/shards"
for f in "$shards"/*/commits.txt; do
cmp -s "$f" "$shards/msl-coverage-$MSL-shard-1/commits.txt" ||
{ echo "::error::The shards measured different commits"; diff "$shards"/*/commits.txt; exit 1; }
done
cp "$shards/msl-coverage-$MSL-shard-1/commits.txt" commits.txt
cat commits.txt
- name: Merge the shards
working-directory: OM.jl/OMLibraryTesting.jl
run: julia --color=yes --project=. scripts/merge_coverage.jl "$RUNNER_TEMP"/shards/*/OM.jl/OMLibraryTesting.jl/logs/partial_ci_*.jls
- name: Publish
id: publish
working-directory: OM.jl/OMLibraryTesting.jl
run: |
results=$(ls -t logs/partial_ci_*.jls | head -1)
julia --color=yes --project=. scripts/publish_coverage.jl "$results" "$GITHUB_WORKSPACE/commits.txt" "$NOTE"
cat "$COVERAGE_MD" >> "$GITHUB_STEP_SUMMARY"
- name: Upload the reports
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: msl-coverage-${{ env.MSL }}
path: |
commits.txt
OM.jl/OMLibraryTesting.jl/reports/
OM.jl/OMLibraryTesting.jl/logs/partial_ci_*.jls
OM.jl/OMLibraryTesting.jl/${{ env.COVERAGE_MD }}
if-no-files-found: warn
- name: Commit the documentation
if: steps.publish.outcome == 'success' && (github.event_name == 'schedule' || inputs.commit)
working-directory: OM.jl/OMLibraryTesting.jl
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add README.md "$COVERAGE_MD"
if git diff --cached --quiet; then echo "Coverage unchanged"; exit 0; fi
git commit -m "Coverage of $(date -u +%Y-%m-%d), MSL $MSL [skip ci]"
git push origin "HEAD:${GITHUB_REF_NAME}"
# The run on the coverage site: runs/<date>/, the index and the badges on
# the gh-pages branch (created on the first run), which Pages serves; the
# root for MSL 3.2.3, msl-<version>/ for another (site_folder).
- name: Publish the coverage site
if: steps.publish.outcome == 'success' && (github.event_name == 'schedule' || inputs.commit)
working-directory: OM.jl/OMLibraryTesting.jl
run: |
export OMJL_SITE_URL="https://${GITHUB_REPOSITORY_OWNER,,}.github.io/${GITHUB_REPOSITORY#*/}/"
site="$RUNNER_TEMP/site"
if git fetch --depth=1 origin gh-pages; then
git worktree add -B gh-pages "$site" FETCH_HEAD
else
git worktree add --orphan -b gh-pages "$site"
fi
results=$(ls -t logs/partial_ci_*.jls | head -1)
report=$(ls -t reports/coverage_ci_*.html | head -1)
julia --color=yes --project=. scripts/publish_site.jl "$site" "$results" "$report" "$COVERAGE_MD" "$GITHUB_WORKSPACE/commits.txt" "$NOTE"
cd "$site"
git add -A
if git diff --cached --quiet; then echo "Site unchanged"; exit 0; fi
git -c user.name="github-actions[bot]" -c user.email="41898282+github-actions[bot]@users.noreply.github.com" \
commit -q -m "Coverage of $(date -u +%Y-%m-%d), MSL $MSL"
git push origin gh-pages
folder=""; [ "$MSL" = 3.2.3 ] || folder="msl-$MSL/"
echo "Coverage site: $OMJL_SITE_URL$folder" >> "$GITHUB_STEP_SUMMARY"