Skip to content

update filename

update filename #182

Workflow file for this run

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: Test
run: |
ctest --no-tests=error --test-dir build/export/tests --output-on-failure
- name: "Read model paths"
run: |
MODEL_PATHS=""
while IFS= read -r line || [ -n "$line" ]; do
line=$(echo "$line" | tr -d '\r' | xargs)
if [ -z "$line" ]; then
continue
fi
if [ -z "$MODEL_PATHS" ]; then
MODEL_PATHS="$line"
else
MODEL_PATHS="$MODEL_PATHS;$line"
fi
done < build/models.txt
printf 'MODEL_PATHS=%s\n' "$MODEL_PATHS" >> $GITHUB_ENV
- name: "Download and run FMUchecker"
run: |
set -euo pipefail
wget https://github.com/modelica-tools/FMUComplianceChecker/releases/download/2.0.4/FMUChecker-2.0.4-linux64.zip -O FMUChecker-2.0.4-linux64.zip
7z x FMUChecker-2.0.4-linux64.zip && cd FMUChecker-2.0.4-linux64
IFS=';' read -r -a paths <<< "${{ env.MODEL_PATHS }}"
for mp in "${paths[@]}"; do
if [ -z "$mp" ]; then
continue
fi
mb=$(basename "$mp")
echo "Checking model: $mp ($mb)"
./fmuCheck.linux64 "../build/$mp/$mb.fmu"
done
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: Test
run: |
ctest -C Release --no-tests=error --test-dir build/export/tests --output-on-failure
- name: "Read models path/name"
shell: pwsh
run: |
$paths = Get-Content -Path build/models.txt | ForEach-Object { $_.Trim() } | Where-Object { $_ -ne '' }
$joined = $paths -join ';'
"MODEL_PATHS=$joined" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding UTF8
- name: "Download and run FMUChecker"
shell: pwsh
run: |
Invoke-WebRequest -Uri "https://github.com/modelica-tools/FMUComplianceChecker/releases/download/2.0.4/FMUChecker-2.0.4-win64.zip" -OutFile "FMUChecker-2.0.4-win64.zip"
Expand-Archive -Path "FMUChecker-2.0.4-win64.zip" -DestinationPath "." -Force
$checker = Join-Path (Resolve-Path .\FMUChecker-2.0.4-win64) 'fmuCheck.win64.exe'
$paths = $env:MODEL_PATHS -split ';'
foreach ($mp in $paths) {
if ([string]::IsNullOrWhiteSpace($mp)) { continue }
$mb = Split-Path $mp -Leaf
Write-Host "Checking model: $mp ($mb)"
& $checker "..\build\$mp\$mb.fmu"
if ($LASTEXITCODE -ne 0) {
Write-Error "FMUChecker failed for $mp with exit code $LASTEXITCODE"
exit $LASTEXITCODE
}
}