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
82 changes: 67 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
images: ghcr.io/OpenModelica/crossbuild

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -42,27 +42,36 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}

# Expose the image tag(s) produced by the metadata action as a job output so
# downstream jobs can reference and pull the exact image.
outputs:
image: ${{ steps.meta.outputs.tags }}


test-compile:
name: Test Docker image across toolchains
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain: ["i686-linux-gnu", "i686-w64-mingw32", "x86_64-linux-gnu", "x86_64-w64-mingw32"]
timeout-minutes: 60
include:
- toolchain: i686-linux-gnu
fmi_platform_tuple: linux32
lib_extension: so
- toolchain: x86_64-linux-gnu
fmi_platform_tuple: linux64
lib_extension: so
- toolchain: i686-w64-mingw32
fmi_platform_tuple: win32
lib_extension: dll
- toolchain: x86_64-w64-mingw32
fmi_platform_tuple: win64
lib_extension: dll
timeout-minutes: 15
steps:
- name: Check out the repo
uses: actions/checkout@v5

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -77,19 +86,62 @@ jobs:
shell: bash
env:
TOOLCHAIN: ${{ matrix.toolchain }}
FMI_PLATFORM_TUPLE: ${{ matrix.fmi_platform_tuple }}
LIB_EXTENSION: ${{ matrix.lib_extension }}
run: |
# Strip potential .cmake suffix and construct toolchain file path inside container
TOOLCHAIN_BASE="${TOOLCHAIN%%.cmake}"
TOOLCHAIN_FILE="/work/toolchain/${TOOLCHAIN_BASE}.cmake"

docker run --rm \
-v "${{ github.workspace }}":/work \
-w /work \
"${{ needs.build.outputs.image }}" \
bash -lc "\
cmake -S test/resources/FMU_Interaction1/sources \
-B test/resources/FMU_Interaction1/sources/build_${TOOLCHAIN_BASE} \
-B test/resources/FMU_Interaction1/sources/build_${TOOLCHAIN} \
-DFMI_INTERFACE_HEADER_FILES_DIRECTORY=/work/test/resources/fmi \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} && \
cmake --build test/resources/FMU_Interaction1/sources/build_${TOOLCHAIN_BASE} --target install && \
test -f test/resources/FMU_Interaction1/binaries/linux64/Interaction1.so"
-DCMAKE_TOOLCHAIN_FILE=/opt/cmake/toolchain/${TOOLCHAIN}.cmake && \
cmake --build test/resources/FMU_Interaction1/sources/build_${TOOLCHAIN} --target install && \
test -f test/resources/FMU_Interaction1/binaries/${FMI_PLATFORM_TUPLE}/Interaction1.${LIB_EXTENSION} && \
cmake --build test/resources/FMU_Interaction1/sources/build_${TOOLCHAIN} --target create_fmu"

- name: Upload Interaction1.fmu
uses: actions/upload-artifact@v5
with:
name: Interaction1-${{ matrix.toolchain }}
path: test/resources/Interaction1.fmu
if-no-files-found: error

test-import:
name: Test FMU import across systems
needs: test-compile
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
fmu_artifact: Interaction1-x86_64-linux-gnu
- os: windows-latest
fmu_artifact: Interaction1-x86_64-w64-mingw32

timeout-minutes: 30
steps:
- name: Download Interaction1.fmu
uses: actions/download-artifact@v5
with:
name: ${{ matrix.fmu_artifact }}

- name: Install OMSimulator
uses: OpenModelica/[email protected]
with:
version: '1'
packages: |
'omc'
'omsimulator'

- name: Simulate 64-bit Linux FMU
if: runner.os == 'Linux'
shell: bash
run: OMSimulator Interaction1.fmu

- name: Simulate 64-bit Windows FMU
if: runner.os == 'Windows'
run: OMSimulator.exe Interaction1.fmu
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
timeout-minutes: 60
steps:
- name: Check out the repo
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Log in to Docker Hub
uses: docker/login-action@v3
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
mingw-w64 \
pkg-config \
unzip \
zip \
&& rm -rf /var/lib/apt/lists/*
25 changes: 0 additions & 25 deletions LICENSE.md

This file was deleted.

2 changes: 1 addition & 1 deletion test/resources/OSMC-License.txt → OSMC-License.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-CurrentYear, Open Source Modelica Consortium (OSMC),
* Copyright (c) 1998-2025, Open Source Modelica Consortium (OSMC),
* c/o Linköpings universitet, Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
*
Expand Down
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,18 @@ docker push $REGISTRY/crossbuild:$TAG

## License

The Dockerfile is licensed withthe MIT License, see
[LICENSE.md][license].
The C test files in test/resources are part of OpenModelica and licensed with
PUBLIC LICENSE (OSMC-PL) VERSION 1.8, see
[test/resources/OSMC-License.txt][osmc-license].

[gh-build-badge]: https://github.com/OpenModelica/crossbuild/actions/workflows/build.yml/badge.svg?branch=main
[gh-build-workflow]: https://github.com/OpenModelica/crossbuild/actions/workflows/build.yml
[gh-publish-badge]: https://github.com/OpenModelica/crossbuild/actions/workflows/publish.yml/badge.svg
[gh-publish-workflow]: https://github.com/OpenModelica/crossbuild/actions/workflows/publish.yml
This repository is part of OpenModelica and licensed with
`OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.8`, see
[./OSMC-License.txt][osmc-license].

[gh-build-badge]: https://github.com/OpenModelica/openmodelica-crossbuild/actions/workflows/build.yml/badge.svg?branch=main
[gh-build-workflow]: https://github.com/OpenModelica/openmodelica-crossbuild/actions/workflows/build.yml
[gh-publish-badge]: https://github.com/OpenModelica/openmodelica-crossbuild/actions/workflows/publish.yml/badge.svg
[gh-publish-workflow]: https://github.com/OpenModelica/openmodelica-crossbuild/actions/workflows/publish.yml
[i686-linux-gnu]: ./toolchain/i686-linux-gnu.cmake
[x86_64-linux-gnu]: ./toolchain/x86_64-linux-gnu.cmake
[i686-w64-mingw32]: ./toolchain/i686-w64-mingw32.cmake
[x86_64-w64-mingw32]: ./toolchain/x86_64-w64-mingw32.cmake
[gh-publish-file]: ./.github/workflows/publish.yml
[docker-hub]: https://hub.docker.com/repository/docker/OpenModelica/crossbuild
[license]: ./LICENSE.md
[osmc-license]: ./test/resources/OSMC-License.txt
[osmc-license]: ./OSMC-License.txt
1 change: 0 additions & 1 deletion test/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ resources/*
!resources/FMU_Interaction1/
resources/FMU_Interaction1/binaries/
resources/FMU_Interaction1/sources/build_*/
!resources/OSMC-License.txt
2 changes: 1 addition & 1 deletion test/genFMUResources.mos
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ buildModelFMU(Modelica.Blocks.Examples.Interaction1
getErrorString();

system("unzip -qq Interaction1.fmu -d FMU_Interaction1"); getErrorString();
system("rm -r Interaction1* FMU_Interaction1/binaries/ FMU_Interaction1/documentation/ FMU_Interaction1/resources/"); getErrorString();
system("rm -r Interaction1* FMU_Interaction1/binaries/"); getErrorString();
12 changes: 12 additions & 0 deletions test/resources/FMU_Interaction1/documentation/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/resources/FMU_Interaction1/modelDescription.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
5 changes: 2 additions & 3 deletions test/resources/FMU_Interaction1/sources/CMakeLists.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.