Skip to content

Commit 4df7565

Browse files
authored
Fixing GitHub build workflow (#3)
* Fixing GitHub build workflow - Fixed test for generated dynamic library - Updated License to OSMC-PL for everything - Upload generated FMU artifacts - Adding test-import job to workflow
1 parent e85b314 commit 4df7565

File tree

12 files changed

+95
-60
lines changed

12 files changed

+95
-60
lines changed

.github/workflows/build.yml

Lines changed: 67 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
images: ghcr.io/OpenModelica/crossbuild
2828

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

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

50-
5148
test-compile:
5249
name: Test Docker image across toolchains
5350
needs: build
5451
runs-on: ubuntu-latest
5552
strategy:
5653
fail-fast: false
5754
matrix:
58-
toolchain: ["i686-linux-gnu", "i686-w64-mingw32", "x86_64-linux-gnu", "x86_64-w64-mingw32"]
59-
timeout-minutes: 60
55+
include:
56+
- toolchain: i686-linux-gnu
57+
fmi_platform_tuple: linux32
58+
lib_extension: so
59+
- toolchain: x86_64-linux-gnu
60+
fmi_platform_tuple: linux64
61+
lib_extension: so
62+
- toolchain: i686-w64-mingw32
63+
fmi_platform_tuple: win32
64+
lib_extension: dll
65+
- toolchain: x86_64-w64-mingw32
66+
fmi_platform_tuple: win64
67+
lib_extension: dll
68+
timeout-minutes: 15
6069
steps:
6170
- name: Check out the repo
6271
uses: actions/checkout@v5
6372

6473
- name: Log in to GitHub Container Registry
65-
uses: docker/login-action@v2
74+
uses: docker/login-action@v3
6675
with:
6776
registry: ghcr.io
6877
username: ${{ github.actor }}
@@ -77,19 +86,62 @@ jobs:
7786
shell: bash
7887
env:
7988
TOOLCHAIN: ${{ matrix.toolchain }}
89+
FMI_PLATFORM_TUPLE: ${{ matrix.fmi_platform_tuple }}
90+
LIB_EXTENSION: ${{ matrix.lib_extension }}
8091
run: |
81-
# Strip potential .cmake suffix and construct toolchain file path inside container
82-
TOOLCHAIN_BASE="${TOOLCHAIN%%.cmake}"
83-
TOOLCHAIN_FILE="/work/toolchain/${TOOLCHAIN_BASE}.cmake"
84-
8592
docker run --rm \
8693
-v "${{ github.workspace }}":/work \
8794
-w /work \
8895
"${{ needs.build.outputs.image }}" \
8996
bash -lc "\
9097
cmake -S test/resources/FMU_Interaction1/sources \
91-
-B test/resources/FMU_Interaction1/sources/build_${TOOLCHAIN_BASE} \
98+
-B test/resources/FMU_Interaction1/sources/build_${TOOLCHAIN} \
9299
-DFMI_INTERFACE_HEADER_FILES_DIRECTORY=/work/test/resources/fmi \
93-
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} && \
94-
cmake --build test/resources/FMU_Interaction1/sources/build_${TOOLCHAIN_BASE} --target install && \
95-
test -f test/resources/FMU_Interaction1/binaries/linux64/Interaction1.so"
100+
-DCMAKE_TOOLCHAIN_FILE=/opt/cmake/toolchain/${TOOLCHAIN}.cmake && \
101+
cmake --build test/resources/FMU_Interaction1/sources/build_${TOOLCHAIN} --target install && \
102+
test -f test/resources/FMU_Interaction1/binaries/${FMI_PLATFORM_TUPLE}/Interaction1.${LIB_EXTENSION} && \
103+
cmake --build test/resources/FMU_Interaction1/sources/build_${TOOLCHAIN} --target create_fmu"
104+
105+
- name: Upload Interaction1.fmu
106+
uses: actions/upload-artifact@v5
107+
with:
108+
name: Interaction1-${{ matrix.toolchain }}
109+
path: test/resources/Interaction1.fmu
110+
if-no-files-found: error
111+
112+
test-import:
113+
name: Test FMU import across systems
114+
needs: test-compile
115+
runs-on: ${{ matrix.os }}
116+
strategy:
117+
fail-fast: false
118+
matrix:
119+
include:
120+
- os: ubuntu-latest
121+
fmu_artifact: Interaction1-x86_64-linux-gnu
122+
- os: windows-latest
123+
fmu_artifact: Interaction1-x86_64-w64-mingw32
124+
125+
timeout-minutes: 30
126+
steps:
127+
- name: Download Interaction1.fmu
128+
uses: actions/download-artifact@v5
129+
with:
130+
name: ${{ matrix.fmu_artifact }}
131+
132+
- name: Install OMSimulator
133+
uses: OpenModelica/[email protected]
134+
with:
135+
version: '1'
136+
packages: |
137+
'omc'
138+
'omsimulator'
139+
140+
- name: Simulate 64-bit Linux FMU
141+
if: runner.os == 'Linux'
142+
shell: bash
143+
run: OMSimulator Interaction1.fmu
144+
145+
- name: Simulate 64-bit Windows FMU
146+
if: runner.os == 'Windows'
147+
run: OMSimulator.exe Interaction1.fmu

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
timeout-minutes: 60
1212
steps:
1313
- name: Check out the repo
14-
uses: actions/checkout@v4
14+
uses: actions/checkout@v5
1515

1616
- name: Log in to Docker Hub
1717
uses: docker/login-action@v3

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
2424
mingw-w64 \
2525
pkg-config \
2626
unzip \
27+
zip \
2728
&& rm -rf /var/lib/apt/lists/*

LICENSE.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

test/resources/OSMC-License.txt renamed to OSMC-License.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
* This file is part of OpenModelica.
55
*
6-
* Copyright (c) 1998-CurrentYear, Open Source Modelica Consortium (OSMC),
6+
* Copyright (c) 1998-2025, Open Source Modelica Consortium (OSMC),
77
* c/o Linköpings universitet, Department of Computer and Information Science,
88
* SE-58183 Linköping, Sweden.
99
*

README.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,18 @@ docker push $REGISTRY/crossbuild:$TAG
8181

8282
## License
8383

84-
The Dockerfile is licensed withthe MIT License, see
85-
[LICENSE.md][license].
86-
The C test files in test/resources are part of OpenModelica and licensed with
87-
PUBLIC LICENSE (OSMC-PL) VERSION 1.8, see
88-
[test/resources/OSMC-License.txt][osmc-license].
89-
90-
[gh-build-badge]: https://github.com/OpenModelica/crossbuild/actions/workflows/build.yml/badge.svg?branch=main
91-
[gh-build-workflow]: https://github.com/OpenModelica/crossbuild/actions/workflows/build.yml
92-
[gh-publish-badge]: https://github.com/OpenModelica/crossbuild/actions/workflows/publish.yml/badge.svg
93-
[gh-publish-workflow]: https://github.com/OpenModelica/crossbuild/actions/workflows/publish.yml
84+
This repository is part of OpenModelica and licensed with
85+
`OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.8`, see
86+
[./OSMC-License.txt][osmc-license].
87+
88+
[gh-build-badge]: https://github.com/OpenModelica/openmodelica-crossbuild/actions/workflows/build.yml/badge.svg?branch=main
89+
[gh-build-workflow]: https://github.com/OpenModelica/openmodelica-crossbuild/actions/workflows/build.yml
90+
[gh-publish-badge]: https://github.com/OpenModelica/openmodelica-crossbuild/actions/workflows/publish.yml/badge.svg
91+
[gh-publish-workflow]: https://github.com/OpenModelica/openmodelica-crossbuild/actions/workflows/publish.yml
9492
[i686-linux-gnu]: ./toolchain/i686-linux-gnu.cmake
9593
[x86_64-linux-gnu]: ./toolchain/x86_64-linux-gnu.cmake
9694
[i686-w64-mingw32]: ./toolchain/i686-w64-mingw32.cmake
9795
[x86_64-w64-mingw32]: ./toolchain/x86_64-w64-mingw32.cmake
9896
[gh-publish-file]: ./.github/workflows/publish.yml
9997
[docker-hub]: https://hub.docker.com/repository/docker/OpenModelica/crossbuild
100-
[license]: ./LICENSE.md
101-
[osmc-license]: ./test/resources/OSMC-License.txt
98+
[osmc-license]: ./OSMC-License.txt

test/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ resources/*
33
!resources/FMU_Interaction1/
44
resources/FMU_Interaction1/binaries/
55
resources/FMU_Interaction1/sources/build_*/
6-
!resources/OSMC-License.txt

test/genFMUResources.mos

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ buildModelFMU(Modelica.Blocks.Examples.Interaction1
2020
getErrorString();
2121

2222
system("unzip -qq Interaction1.fmu -d FMU_Interaction1"); getErrorString();
23-
system("rm -r Interaction1* FMU_Interaction1/binaries/ FMU_Interaction1/documentation/ FMU_Interaction1/resources/"); getErrorString();
23+
system("rm -r Interaction1* FMU_Interaction1/binaries/"); getErrorString();

test/resources/FMU_Interaction1/documentation/index.html

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/resources/FMU_Interaction1/modelDescription.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)