Skip to content

simplify

simplify #173

Workflow file for this run

name: Cross-compile
on: [push, workflow_dispatch]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-22.04, windows-2022 ]
steps:
- uses: actions/checkout@v4
- name: Configure and build (Linux)
if: startsWith(runner.os, 'Linux')
run: |
cmake . -B build -DFMU4CPP_BUILD_EXAMPLES=ON -DFMU4CPP_BUILD_TESTS=OFF
cmake --build build
- name: Configure and build (Windows)
if: startsWith(runner.os, 'Windows')
run: |
cmake . -B build -DFMU4CPP_BUILD_EXAMPLES=ON -DFMU4CPP_BUILD_TESTS=OFF -A x64
cmake --build build --config Release
- name: "Stage models for upload (Linux)"
if: startsWith(runner.os, 'Linux')
run: |
mkdir -p artifacts/models-${{ matrix.os }}
rsync -a --exclude='*.fmu' build/models/ artifacts/models/ || true
- name: "Stage models for upload (Windows)"
if: startsWith(runner.os, 'Windows')
shell: pwsh
run: |
$dst = Join-Path $env:GITHUB_WORKSPACE "artifacts\models"
New-Item -ItemType Directory -Force -Path $dst | Out-Null
$rc = robocopy "$env:GITHUB_WORKSPACE\build\models" $dst /S /XF *.fmu
if ($rc -ge 8) { exit $rc }
- name: Upload models
uses: actions/upload-artifact@v4
with:
name: models-${{ matrix.os }}
path: artifacts/models
deploy:
needs: build
runs-on: ubuntu-22.04
steps:
- name: "Download models"
uses: actions/download-artifact@v4
with:
pattern: models-*
path: models
merge-multiple: true
- name: "Set permissions"
run: |
set -euo pipefail
find `models` -type d -name binaries -exec sudo chmod -R a+X '{}' +
- name: "Upload merged models"
uses: actions/upload-artifact@v4
with:
name: models
path: models