Skip to content

Commit

Permalink
Windows support (#58)
Browse files Browse the repository at this point in the history
* partial windows integration

windows integration has been added for basic operations to be executed
in local on windows os (tested on Win11 pro).

not included:
- FMI
- Docker

* help added to some arguments

* Adding windows-latest to CI

* Better default value for libraries

* Updating sanity check


---------

Co-authored-by: AnHeuermann <38031952+AnHeuermann@users.noreply.github.com>
  • Loading branch information
AndreaBartolini and AnHeuermann committed Mar 1, 2024
1 parent 65dd730 commit 045cb46
Show file tree
Hide file tree
Showing 5 changed files with 264 additions and 136 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@ jobs:
name: GitHub Actions Test
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
omc-version: [stable, nightly]
python-version: ['3.10']
runs-on: ubuntu-latest
include:
- os: windows-latest
omc-version: stable
msysEnvironment: --msysEnvironment=mingw64
fail-fast: false
runs-on: ${{ matrix.os }}
timeout-minutes: 30

steps:
Expand All @@ -29,7 +35,7 @@ jobs:
'omc'
libraries: |
'Modelica 4.0.0'
'PNlib 2.2.0'
'PNlib 3.0.0'
omc-diff: true

- name: Setup Python3
Expand All @@ -44,7 +50,8 @@ jobs:
- name: Run library test
shell: bash
run: python test.py --branch="${{ matrix.omc-version }}" --noclean --verbose configs/sanityCheck.json
run: |
python test.py --branch="${{ matrix.omc-version }}" --noclean --verbose ${{ matrix.msysEnvironment }} configs/sanityCheck.json
- name: Generate HTML results
shell: bash
Expand All @@ -53,13 +60,13 @@ jobs:
- name: Zip HTML results
shell: bash
run: |
python .github/scripts/archiveResults.py "PNlib" "2.2.0" "${{ matrix.omc-version }}" "html/"
python .github/scripts/archiveResults.py "PNlib" "3.0.0" "${{ matrix.omc-version }}" "html/"
- name: Verify that overview.html contains simulation and verification
shell: bash
run: |
if ! grep -q "<tr><td><a href=\"${{ matrix.omc-version }}/PNlib_2.2.0/PNlib_2.2.0.html\">${{ matrix.omc-version }}</a></td><td><a>93</a></td><td><a>93</a></td><td><a>92</a></td><td><a>92</a></td><td><a>92</a></td><td><a>92</a></td><td><a>92</a></td><td><a>91</a></td><td><a>90</a></td></tr></table>" overview.html; then
echo "Failed to find 93 simulating and 90 verifying models in overwiew.html:"
if ! grep -q "<tr><td><a href=\"${{ matrix.omc-version }}/PNlib_3.0.0/PNlib_3.0.0.html\">${{ matrix.omc-version }}</a></td><td><a>92</a></td><td><a>92</a></td><td><a>92</a></td><td><a>92</a></td><td><a>92</a></td><td><a>92</a></td><td><a>92</a></td><td><a>92</a></td><td><a>92</a></td></tr></table>" overview.html; then
echo "Failed to find 92 simulating and 92 verifying models in overwiew.html:"
cat overview.html
exit 1
fi
Expand All @@ -68,13 +75,13 @@ jobs:
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ matrix.omc-version }}-sqlite3.db
name: ${{ matrix.os }}-${{ matrix.omc-version }}-sqlite3.db
path: |
sqlite3.db
- name: Archive HTML
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ matrix.omc-version }}-PNlib.html
name: ${{ matrix.os }}-${{ matrix.omc-version }}-PNlib.html
path: html/
4 changes: 2 additions & 2 deletions configs/sanityCheck.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[
{
"library": "PNlib",
"libraryVersion": "2.2.0",
"libraryVersion": "3.0.0",
"referenceFileExtension":"mat",
"referenceFileNameDelimiter":".",
"referenceFiles":{
"giturl":"https://github.com/AMIT-HSBI/PNlib",
"destination":"ReferenceFiles/PNlib",
"git-ref": "v2.2",
"git-ref": "v3.0.0",
"git-directory": "ReferenceFiles"
}
}
Expand Down
8 changes: 6 additions & 2 deletions shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,17 @@ def getReferenceFileName(conf):
referenceFile=""
return referenceFile

def simulationAcceptsFlag(f, checkOutput=True, cwd=None):
def simulationAcceptsFlag(f, checkOutput=True, cwd=None, isWin=False):
try:
os.unlink("HelloWorld_res.mat")
except OSError:
pass
try:
subprocess.check_output("./HelloWorld %s" % f, shell=True, stderr=subprocess.STDOUT, cwd=cwd)
if isWin:
subprocess.check_output("HelloWorld.bat %s" % f, shell=True, stderr=subprocess.STDOUT, cwd=cwd)
else:
subprocess.check_output("./HelloWorld %s" % f, shell=True, stderr=subprocess.STDOUT, cwd=cwd)

if (not os.path.exists("HelloWorld_res.mat")):
print("Result file HelloWorld_res.mat WAS NOT generated running: ./HelloWorld with flags [%s]" % f)
if (not checkOutput) or os.path.exists("HelloWorld_res.mat"):
Expand Down

0 comments on commit 045cb46

Please sign in to comment.