Skip to content

MSL Test & GitHub Pages #26

MSL Test & GitHub Pages

MSL Test & GitHub Pages #26

Workflow file for this run

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'
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' }}
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@v2
- 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
main(
library = ENV["LIB_NAME"],
version = ENV["LIB_VERSION"],
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
run: 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