Merge branch 'master' into examples #293
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: [push, workflow_dispatch] | |
| jobs: | |
| build-on-linux: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: "Configure and build" | |
| run: | | |
| cmake . -B build -DFMU4CPP_BUILD_TESTS=ON -DFMU4CPP_BUILD_EXAMPLES=ON | |
| cmake --build build | |
| - name: "Download fmusim" | |
| run: | | |
| version=0.0.39 | |
| zip=Reference-FMUs-$version.zip | |
| url="https://github.com/modelica/Reference-FMUs/releases/download/v$version/$zip" | |
| wget -q "$url" -O "$zip" | |
| mkdir -p "Reference-FMUs" | |
| unzip -q "$zip" -d "Reference-FMUs" | |
| - name: "Run fmusim" | |
| working-directory: "Reference-FMUs/fmusim-x86_64-linux" | |
| run: | | |
| set -e | |
| found=0 | |
| # find all .fmu files under `build/models` (fmi2 and fmi3) | |
| while IFS= read -r -d '' f; do | |
| found=1 | |
| mb=$(basename "$f") | |
| echo "Checking FMU: $f ($mb)" | |
| ./fmusim "$f" | |
| done < <(find ${{ github.workspace }}/build/models -type f -name '*.fmu' -print0 2>/dev/null || true) | |
| if [ "$found" -eq 0 ]; then | |
| echo "No FMUs found under `build/models`, skipping fmusim run" | |
| fi | |
| - name: "Test" | |
| run: | | |
| ctest --no-tests=error --test-dir build/export/tests --output-on-failure | |
| build-on-windows: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [windows-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: "Configure and build" | |
| run: | | |
| cmake . -B build -DFMU4CPP_BUILD_TESTS=ON -DFMU4CPP_BUILD_EXAMPLES=ON -A x64 | |
| cmake --build build --config Release | |
| - name: "Download fmusim" | |
| shell: pwsh | |
| run: | | |
| $version = "0.0.39" | |
| $zip = "Reference-FMUs-$version.zip" | |
| $url = "https://github.com/modelica/Reference-FMUs/releases/download/v$version/$zip" | |
| Invoke-WebRequest -Uri $url -OutFile $zip | |
| Expand-Archive -Path $zip -DestinationPath Reference-FMUs -Force | |
| - name: "Run fmusim" | |
| shell: pwsh | |
| working-directory: "Reference-FMUs/fmusim-x86_64-windows" | |
| run: | | |
| $fmus = Get-ChildItem -Path "$env:GITHUB_WORKSPACE\build\models" -Recurse -Filter '*.fmu' -File -ErrorAction SilentlyContinue | |
| if (-not $fmus -or $fmus.Count -eq 0) { | |
| Write-Host "No FMUs found under `build/models`, skipping fmusim run" | |
| exit 0 | |
| } | |
| foreach ($f in $fmus) { | |
| Write-Host "Checking FMU: $($f.FullName) ($($f.Name))" | |
| & ./fmusim.exe $f.FullName | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Error "FMUChecker failed for $($f.FullName) with exit code $LASTEXITCODE" | |
| exit $LASTEXITCODE | |
| } | |
| } | |
| - name: "Test" | |
| run: | | |
| ctest -C Release --no-tests=error --test-dir build/export/tests --output-on-failure |