Fix loop for new line separted entries #30
Workflow file for this run
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 Docker Image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - 'releases/**' | |
| tags: | |
| - v* | |
| pull_request: | |
| branches: | |
| - main | |
| - 'releases/**' | |
| jobs: | |
| build: | |
| name: Build Docker image | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v5 | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/openmodelica/crossbuild | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| id: build-image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| tags: ${{ steps.meta.outputs.tags }} | |
| annotations: ${{ steps.meta.outputs.annotations }} | |
| # Only push when this is NOT a pull_request (avoid GHCR write for PRs) | |
| push: ${{ github.event_name != 'pull_request' }} | |
| - name: Save image as tar for pull_request runs | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| # pick first tag from metadata (comma separated) | |
| img="${{ steps.meta.outputs.tags }}" | |
| img="${img%%,*}" | |
| docker save -o crossbuild-image.tar "$img" | |
| - name: Upload image artifact for pull_request runs | |
| if: github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: crossbuild-image | |
| path: crossbuild-image.tar | |
| 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: | |
| 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 | |
| - toolchain: aarch64-linux-gnu | |
| fmi_platform_tuple: linux64 | |
| lib_extension: so | |
| - toolchain: arm-linux-gnueabi | |
| fmi_platform_tuple: linux32 | |
| lib_extension: so | |
| - toolchain: arm-linux-gnueabihf | |
| fmi_platform_tuple: linux32 | |
| lib_extension: so | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v5 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Pull image pushed by build job | |
| if: github.event_name != 'pull_request' | |
| shell: bash | |
| run: | | |
| IMAGES="${{ needs.build.outputs.image }}" | |
| while read -r img; do | |
| docker pull "$img" | |
| done <<< "$IMAGES" | |
| - name: Download and load image artifact for pull_request runs | |
| if: github.event_name == 'pull_request' | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: crossbuild-image | |
| path: ./image | |
| - name: Load image for pull_request runs | |
| if: github.event_name == 'pull_request' | |
| run: docker load -i ./image/crossbuild-image.tar | |
| - name: Test cross-compilation for matrix toolchain | |
| shell: bash | |
| env: | |
| TOOLCHAIN: ${{ matrix.toolchain }} | |
| FMI_PLATFORM_TUPLE: ${{ matrix.fmi_platform_tuple }} | |
| LIB_EXTENSION: ${{ matrix.lib_extension }} | |
| run: | | |
| IMAGES="${{ needs.build.outputs.image }}" | |
| while read -r img; do | |
| docker run --rm \ | |
| -v "${{ github.workspace }}":/work \ | |
| -w /work \ | |
| "$img" \ | |
| bash -lc "\ | |
| rm -rf test/resources/FMU_Interaction1/sources/build_${TOOLCHAIN} test/resources/FMU_Interaction1/binaries/${FMI_PLATFORM_TUPLE}/Interaction1.${LIB_EXTENSION} &&\ | |
| cmake -S test/resources/FMU_Interaction1/sources \ | |
| -B test/resources/FMU_Interaction1/sources/build_${TOOLCHAIN} \ | |
| -DFMI_INTERFACE_HEADER_FILES_DIRECTORY=/work/test/resources/fmi \ | |
| -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" | |
| done <<< "$IMAGES" | |
| - 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@v6 | |
| 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 |