Skip to content

Test MSL and publish results to GitHub pages #2

Test MSL and publish results to GitHub pages

Test MSL and publish results to GitHub pages #2

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
pull_request:
branches: [main] # only for testing
workflow_dispatch:
inputs:
lib_version:
description: 'Modelica Standard Library version'
required: false
default: '4.1.0'
type: string
concurrency:
group: pages
cancel-in-progress: false # never abort a Pages deployment mid-flight
permissions:
contents: write # needed to push to gh-pages
jobs:
test-and-deploy:
name: Test MSL & Deploy Pages
runs-on: ubuntu-latest
timeout-minutes: 480
env:
LIB_VERSION: ${{ inputs.lib_version || '4.1.0' }}
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: |
'Modelica ${{ 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
uses: julia-actions/julia-buildpkg@v1
# ── Resolve versions ──────────────────────────────────────────────────────
- name: Resolve BaseModelica.jl version
id: versions
run: |
julia --project=. -e '
import BaseModelica
println("bm_version=" * string(pkgversion(BaseModelica)))
' >> "$GITHUB_OUTPUT"
# ── Run the pipeline ──────────────────────────────────────────────────────
- name: Run MSL pipeline
env:
BM_VERSION: ${{ steps.versions.outputs.bm_version }}
run: |
julia --project=. -e '
using BaseModelicaLibraryTesting
main(
version = ENV["LIB_VERSION"],
results_root = "results/$(ENV["BM_VERSION"])/Modelica/$(ENV["LIB_VERSION"])",
)
'
- name: Upload test results
uses: actions/upload-artifact@v6
with:
name: sanity-results-${{ matrix.os }}
path: results/
if-no-files-found: error
# ── 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}/Modelica/${LIB_VERSION} [$(date -u '+%Y-%m-%d')]"
git push origin HEAD:gh-pages