Revert "try mod again" #119
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 | |
| on: [push] | |
| jobs: | |
| generate: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4.1.1 | |
| with: | |
| fetch-depth: 0 # for git-restore-mtime | |
| submodules: recursive | |
| - run: | | |
| # Run the Docker command | |
| docker run -u developer:$(id -g) --rm -v "$(pwd)":/local ghcr.io/casadi/openmodelica:latest bash -c "cp -R /usr/include/omc/c/fmi /local/omc_fmi" | |
| # Loop through the .mo files | |
| for f in *.mo; do | |
| echo "file: >$f<" | |
| if [[ "$f" == 'vdp_outputs2.mo' ]]; then | |
| continue | |
| fi | |
| docker run -u developer:$(id -g) --rm -v "$(pwd)":/local ghcr.io/casadi/openmodelica:latest bash -c "python generate_fmu.py $f" | |
| f_fmu="${f%.mo}.fmu" | |
| rm -rf unzipped | |
| # Unzip the file | |
| unzip -q $f_fmu -d unzipped | |
| cp -R omc_fmi/* unzipped/sources/include | |
| rm $f_fmu | |
| cd unzipped && zip -r ../$f_fmu * && cd .. | |
| done | |
| - name: Upload compiled FMUs as artifact (Linux) | |
| uses: actions/upload-artifact@v4.3.1 | |
| with: | |
| name: source_fmus | |
| path: "*.fmu" | |
| dockcross: | |
| needs: [generate] | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: [manylinux2014-x64,manylinux2014-x86,windows-shared-x64-posix] | |
| steps: | |
| - uses: actions/checkout@v4.1.1 | |
| with: | |
| fetch-depth: 0 # for git-restore-mtime | |
| submodules: recursive | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4.1.7 | |
| with: | |
| name: source_fmus | |
| - name: Setup dockcross | |
| run: | | |
| docker pull ghcr.io/jgillis/${{ matrix.target }}:production | |
| docker run --rm --env DEFAULT_DOCKCROSS_IMAGE=ghcr.io/jgillis/${{ matrix.target }}:production ghcr.io/jgillis/${{ matrix.target }}:production > dockcross | |
| chmod +x dockcross | |
| pwd | |
| ls -al dockcross | |
| - run: ls | |
| - run: pwd | |
| - run: ./compile-dockcross.sh | |
| - name: Upload compiled FMUs as artifact (Linux) | |
| uses: actions/upload-artifact@v4.3.1 | |
| with: | |
| name: ${{matrix.target}}_fmus | |
| path: "*.fmu" | |
| mac: | |
| needs: [generate] | |
| runs-on: macos-14 | |
| steps: | |
| - uses: actions/checkout@v4.1.1 | |
| with: | |
| fetch-depth: 0 # for git-restore-mtime | |
| submodules: recursive | |
| - uses: casadi/action-setup-compiler@master | |
| with: | |
| cache-suffix: '' | |
| target: 'arm64' | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4.1.7 | |
| with: | |
| name: source_fmus | |
| - run: ls | |
| - run: | | |
| # Loop through the .fmu files | |
| for f in *.fmu; do | |
| rm -rf unzipped | |
| # Unzip the file | |
| unzip -q $f -d unzipped | |
| rm -rf unzipped/binaries/* | |
| #Remove the lines that match SHELL | |
| sed -i '' '/SHELL/d' unzipped/sources/CMakeLists.txt | |
| CC=${{ env.CC }} FC=${{ env.FC }} CXX=${{ env.CXX }} cmake -DCMAKE_OSX_SYSROOT=${{env.CONDA_BUILD_SYSROOT}} -DCMAKE_OSX_ARCHITECTURES:STRING="x86_64;arm64" -Bbuild -DFMI_INTERFACE_HEADER_FILES_DIRECTORY=`pwd`/unzipped/sources/include -DRUNTIME_DEPENDENCIES_LEVEL=none -Hunzipped/sources | |
| cmake --build build -v | |
| cmake --build build --target install -v | |
| cd unzipped && zip -r ../$f * && cd .. | |
| done | |
| - name: Upload compiled FMUs as artifact (Linux) | |
| uses: actions/upload-artifact@v4.3.1 | |
| with: | |
| name: mac_${{matrix.image == 'macos-m1' && 'm1' || '11'}}_fmus | |
| path: "*.fmu" | |
| merge-and-upload: | |
| needs: [dockcross, mac] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4.1.1 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4.1.7 | |
| with: | |
| path: artifacts | |
| - run: ls | |
| - run: ls artifacts | |
| - run: ls artifacts/* | |
| - name: Unzip and merge artifacts | |
| run: | | |
| rm -rf artifacts/source_fmus | |
| rm -rf artifacts/mac_m1_fmus | |
| for f in artifacts/*/*.fmu; do | |
| unzip -o $f -d $(basename $f).unzipped | |
| done | |
| for f in *.unzipped; do | |
| cd $f && zip -r ../$(basename $f .unzipped) * && cd .. | |
| rm -rf $f | |
| done | |
| - name: Upload merged artifacts | |
| uses: actions/upload-artifact@v4.3.1 | |
| with: | |
| name: universal_fmus | |
| path: "*.fmu" | |
| tests: | |
| needs: [merge-and-upload] | |
| runs-on: ${{ matrix.image }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| image: ["ubuntu-latest","macos-13","macos-14","windows-2022"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4.1.1 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4.1.7 | |
| with: | |
| name: universal_fmus | |
| - run: pip3 install casadi | |
| if: "!contains(matrix.image, 'windows')" | |
| - run: python3 test_fmu.py | |
| if: "!contains(matrix.image, 'windows')" | |
| - run: pip install casadi | |
| if: contains(matrix.image, 'windows') | |
| - run: python test_fmu.py | |
| if: contains(matrix.image, 'windows') |