Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 32 additions & 4 deletions .CI/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ pipeline {
booleanParam(name: 'newInst_newBackend', defaultValue: false, description: 'master branch, -d=newInst --newBackend, (ryzen-5950x-1)')
booleanParam(name: 'oldInst', defaultValue: false, description: 'master branch, with -d=nonewInst (ryzen-5950x-2)')

booleanParam(name: 'cpp_v1_24', defaultValue: false, description: 'maintenance/v1.24 branch, with --simCodeTarget=Cpp (ryzen-5950x-2).')
booleanParam(name: 'cpp_v1_24', defaultValue: false, description: 'maintenance/v1.24 branch, with --simCodeTarget=Cpp (ryzen-5950x-2).')
booleanParam(name: 'cpp_v1_25', defaultValue: false, description: 'maintenance/v1.25 branch, with --simCodeTarget=Cpp (ryzen-5950x-2).')
booleanParam(name: 'cpp', defaultValue: false, description: 'master branch, with --simCodeTarget=Cpp (ryzen-5950x-2).')
booleanParam(name: 'report_ryzen_5950x_1', defaultValue: false, description: 'Generate a report for ryzen-5950x-1 without running the tests')
booleanParam(name: 'report_ryzen_5950x_2', defaultValue: false, description: 'Generate a report for ryzen-5950x-2 without running the tests')

booleanParam(name: 'basemodelica_jl_master', defaultValue: false, description: 'OpenModelica master branch with BaseModelica export and BaseModelica.jl import (ryzen-5950x-1)')

booleanParam(name: 'conversion_script', defaultValue: false, description: 'master branch with conversion script from MSL 3 to 4 (ryzen-5950x-1). This is an experimental job that does not run on a fixed schedule.')
booleanParam(name: 'cvode', defaultValue: false, description: 'master branch, with -d=newInst and -s cvode (ryzen-5950x-2). This is an experimental job that does not run on a fixed schedule.')
booleanParam(name: 'gbode', defaultValue: false, description: 'master branch, with -d=newInst and -s gbode (ryzen-5950x-2). This is an experimental job that does not run on a fixed schedule.')
Expand Down Expand Up @@ -220,6 +222,24 @@ pipeline {
runRegressiontest('master', 'master-fmi-fmpy', '', 'origin/master', 'ripper2', 'LibraryTestingRipper2DB', false, '', false, false)
}
}

stage('master BaseModelica.jl import') {
agent {
node {
label 'ryzen-5950x-1'
customWorkspace 'ws/OpenModelicaLibraryTestingWork'
}
}
options { skipDefaultCheckout() }
when {
beforeAgent true
expression { params.basemodelica_jl_master }
}
steps {
runRegressiontest('master', 'basemodelica_jl_master', '--basemodelica-mtk-import', 'origin/master', 'ripper1', 'LibraryTestingRipper1DB', false, '', false, false)
}
}

stage('newInst-daeMode') {
agent {
node {
Expand Down Expand Up @@ -581,6 +601,7 @@ def runRegressiontest(branch, name, extraFlags, omsHash, dbPrefix, sshConfig, om
fi
'''
FMI_TESTING_FLAG=""
JULIA_TESTTING_FLAG=""
if (!name.contains('fmpy') && omsHash) {
sh """
if ! test -d OMSimulator; then
Expand Down Expand Up @@ -615,7 +636,7 @@ def runRegressiontest(branch, name, extraFlags, omsHash, dbPrefix, sshConfig, om
"""
FMI_TESTING_FLAG="--fmi=true --fmisimulator=${env.HOME}/saved_omc/OMSimulator/install/bin/OMSimulator --default=ulimitExe=50"
}

if (name.contains('fmpy')) {
sh """
# update fmpy
Expand All @@ -625,6 +646,13 @@ def runRegressiontest(branch, name, extraFlags, omsHash, dbPrefix, sshConfig, om
FMI_TESTING_FLAG="--fmi=true --fmisimulator='python3 -m fmpy' --default=ulimitExe=50"
}

if (name.contains('basemodelica-mtk-import')) {
sh """
julia --project=TestBaseModelica -e 'import Pkg; Pkg.build(verbose=true); Pkg.precompile()'
"""
JULIA_TESTTING_FLAG="--basemodelica-mtk-import --extraflags=\"setCommandLineOptions(\\\"--baseModelica\\\");\""
}

OMCPATH = "${omcompiler ? '../' : './'}OMCompiler"

sh '''
Expand Down Expand Up @@ -774,7 +802,7 @@ def runRegressiontest(branch, name, extraFlags, omsHash, dbPrefix, sshConfig, om

cd OpenModelicaLibraryTesting
# Force /usr/bin/omc as being used for generating the mos-files. Ensures consistent behavior among all tested OMC versions
stdbuf -oL -eL time ./test.py --ompython_omhome=/usr ${FMI_TESTING_FLAG} --extraflags='${extraFlags}' --extrasimflags='${extrasimflags}' --branch="${name}" --output="libraries.openmodelica.org:/var/www/libraries.openmodelica.org/branches/${name}/" --libraries='${libraryPath}/.openmodelica/libraries/' --jobs=${jobs} ${libs_config_file} ${params.OLDLIBS ? "configs/conf-old.json configs/conf-nonstandard.json" : ""} || (killall omc ; false) || exit 1
stdbuf -oL -eL time ./test.py --ompython_omhome=/usr ${FMI_TESTING_FLAG} ${JULIA_TESTTING_FLAG} --extraflags='${extraFlags}' --extrasimflags='${extrasimflags}' --branch="${name}" --output="libraries.openmodelica.org:/var/www/libraries.openmodelica.org/branches/${name}/" --libraries='${libraryPath}/.openmodelica/libraries/' --jobs=${jobs} ${libs_config_file} ${params.OLDLIBS ? "configs/conf-old.json configs/conf-nonstandard.json" : ""} || (killall omc ; false) || exit 1
"""
sh 'date'
sh "rm -f OpenModelicaLibraryTesting/${dbPrefix}-sqlite3.db.tmp"
Expand All @@ -783,5 +811,5 @@ def runRegressiontest(branch, name, extraFlags, omsHash, dbPrefix, sshConfig, om
sh "cp OpenModelicaLibraryTesting/sqlite3.db ~/TEST_LIBS_BACKUP/${dbPrefix}-sqlite3.db"
sh "rm -f ~/TEST_LIBS_BACKUP/${dbPrefix}-`date +sqlite3.%Y%m%d.db`"

sshPublisher(publishers: [sshPublisherDesc(configName: sshConfig, transfers: [sshTransfer(removePrefix: 'OpenModelicaLibraryTesting', sourceFiles: 'OpenModelicaLibraryTesting/sqlite3.db')])], failOnError: true)
sshPublisher(publishers: [sshPublisherDesc(configName: sshConfig, transfers: [sshTransfer(removePrefix: 'OpenModelicaLibraryTesting', sourceFiles: 'OpenModelicaLibraryTesting/sqlite3.db')])], failOnError: true)
}
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies

- name: Install Python dependencies
shell: bash
run: |
Expand Down
108 changes: 108 additions & 0 deletions .github/workflows/test_julia.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Continuous Integration BaseModelica.jl

on:
pull_request:
push:
branches:
- master
tags: '*'

jobs:
unittest-testbasemodelica:
name: Unit test TestBaseModelica.jl
strategy:
matrix:
os: [ubuntu-latest]
julia-version: [1.11]
fail-fast: false
runs-on: ${{ matrix.os }}
timeout-minutes: 60

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Julia
uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}

- name: Cache Julia
uses: julia-actions/cache@v2

- name: Build TestBaseModelica
uses: julia-actions/julia-buildpkg@v1
with:
project: TestBaseModelica

- name: Test TestBaseModelica
uses: julia-actions/julia-runtest@v1
with:
project: TestBaseModelica

test-mtk-import:
name: Sanity check TestBaseModelica.jl + test.py
strategy:
matrix:
os: [ubuntu-latest]
julia-version: [1.11]
omc-version: [stable]
python-version: ['3.10']
fail-fast: false
runs-on: ${{ matrix.os }}
timeout-minutes: 60

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Julia
uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}

- name: Cache Julia
uses: julia-actions/cache@v2

- name: Setup OpenModelica
uses: OpenModelica/setup-openmodelica@v1
with:
version: ${{ matrix.omc-version }}
packages: |
'omc'
libraries: |
'Modelica 4.0.0'
omc-diff: true

- name: Check if .CI/installLibraries.mos works
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
omc .CI/installLibraries.mos
fi

- name: Setup Python3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies

- name: Install Python dependencies
shell: bash
run: |
pip install -r requirements.txt

- name: Run library test
shell: bash
run: |
export MY_SANITY_CHECK_DIRECTORY=sanityCheck
python test.py --branch="${{ matrix.omc-version }}" --basemodelica-mtk-import --no-julia-sys-image --noclean --verbose configs/sanityCheck.json

- name: Generate HTML results
shell: bash
run: python report.py --branches="${{ matrix.omc-version }}" configs/sanityCheck.json

- name: Zip HTML results
shell: bash
run: |
python .github/scripts/archiveResults.py "MyLibrary" "1.0.0" "${{ matrix.omc-version }}" "html/"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
__pycache__
!HelloWorld.mo
!HelloWorld.mos
/.venv/
/.vscode/
/*.files
/*.html
/*.json
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,17 @@ export MSLREFERENCE="/some/path/to/ReferenceFiles/"
```

For the other libraries just clone the repositories to `/some/path/to/ReferenceFiles/`.

## Examples

### BaseModelica export and BaseModelica.jl import

```bash
export MY_SANITY_CHECK_DIRECTORY=sanityCheck
./test.py --basemodelica-mtk-import --branch=master --noclean --verbose configs/sanityCheck.json
./report.py --branches="${{ matrix.omc-version }}" configs/sanityCheck.json
```

This will create a Julia system image to speedup tests. This can take a lot of
time, but will reduce the Julia startup penalty. To disable add
`--no-julia-sys-image`.
Loading
Loading