|
| 1 | +name: Python-manylinux-arch |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + os: |
| 7 | + description: 'Host OS' |
| 8 | + required: false |
| 9 | + type: string |
| 10 | + default: '["ubuntu-22.04"]' |
| 11 | + arch: |
| 12 | + description: 'Architecture target' |
| 13 | + required: true |
| 14 | + type: string |
| 15 | + |
| 16 | +permissions: write-all |
| 17 | + |
| 18 | +jobs: |
| 19 | + build_wheels: |
| 20 | + name: Build Python wheels |
| 21 | + runs-on: ${{ matrix.os }} |
| 22 | + strategy: |
| 23 | + matrix: |
| 24 | + os: ${{ fromJSON(inputs.os) }} |
| 25 | + env: |
| 26 | + # Skip 32-bit windows wheels builds. |
| 27 | + CIBW_SKIP: "*-win32* *musllinux*" |
| 28 | + CIBW_ARCHS: ${{inputs.arch}} |
| 29 | + CIBW_ENVIRONMENT_LINUX: "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/project/install/lib" |
| 30 | + CIBW_BEFORE_ALL_LINUX: > |
| 31 | + echo "Considering vtk-manylinux2014_`uname -m`.tar.gz..." && |
| 32 | + mkdir -p vtk && |
| 33 | + tar -xvzf vtk-manylinux2014_`uname -m`.tar.gz -C vtk/ && |
| 34 | + if [ -d "vtk/lib" ]; then |
| 35 | + VTK_DIR=vtk/lib/cmake/vtk-9.2/ |
| 36 | + else |
| 37 | + VTK_DIR=vtk/lib64/cmake/vtk-9.2/ |
| 38 | + fi && |
| 39 | + cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DEXTERNAL_EIGEN:BOOL=OFF -DPYTHON_WRAPPER:BOOL=OFF -DFORTRAN_WRAPPER:BOOL=OFF -DRUST_WRAPPER:BOOL=OFF -DUSE_VTK=ON -DVTK_DIR=$VTK_DIR -DMOORDYN_PACKAGE_IGNORE_VTK_DEPENDENCY=ON -DBUILD_TESTING=OFF && |
| 40 | + cmake --build build --config Release && |
| 41 | + cmake --install build --config Release |
| 42 | + CIBW_BEFORE_ALL_WINDOWS: > |
| 43 | + cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install -DEXTERNAL_EIGEN:BOOL=OFF -DPYTHON_WRAPPER:BOOL=OFF -DFORTRAN_WRAPPER:BOOL=OFF -DRUST_WRAPPER:BOOL=OFF -DUSE_VTK=ON -DVTK_DIR=${{github.workspace}}/vtk/lib/cmake/vtk-9.2/ -DMOORDYN_PACKAGE_IGNORE_VTK_DEPENDENCY=ON -DBUILD_TESTING=OFF && |
| 44 | + cmake --build ${{github.workspace}}/build --config Release && |
| 45 | + cmake --install ${{github.workspace}}/build --config Release |
| 46 | + CIBW_BEFORE_ALL_MACOS: > |
| 47 | + cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install -DEXTERNAL_EIGEN:BOOL=OFF -DPYTHON_WRAPPER:BOOL=OFF -DFORTRAN_WRAPPER:BOOL=OFF -DRUST_WRAPPER:BOOL=OFF -DUSE_VTK=ON -DMOORDYN_PACKAGE_IGNORE_VTK_DEPENDENCY=ON -DBUILD_TESTING=OFF -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 && |
| 48 | + cmake --build ${{github.workspace}}/build --config Release && |
| 49 | + cmake --install ${{github.workspace}}/build --config Release |
| 50 | + |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v4 |
| 53 | + |
| 54 | + # Used to host cibuildwheel |
| 55 | + - uses: actions/setup-python@v5 |
| 56 | + with: |
| 57 | + python-version: '3.x' |
| 58 | + |
| 59 | + - name: Create setup.py |
| 60 | + run: | |
| 61 | + mv wrappers/python/wheels.github/* ./ |
| 62 | + python set_version.py |
| 63 | + python set_eigen_data.py |
| 64 | + rm set_version.py set_eigen_data.py |
| 65 | + cat pyproject.toml |
| 66 | + shell: bash |
| 67 | + |
| 68 | + - name: download pre-built VTK static library (Linux) |
| 69 | + |
| 70 | + with: |
| 71 | + url: https://github.com/sanguinariojoe/vtk-builds/releases/download/VTK-9.2.6-static/vtk-manylinux2014_${{inputs.arch}}.tar.gz |
| 72 | + target: ${{github.workspace}}/ |
| 73 | + if: runner.os == 'Linux' |
| 74 | + |
| 75 | + - name: download pre-built VTK static library (Windows) |
| 76 | + |
| 77 | + with: |
| 78 | + url: https://github.com/sanguinariojoe/vtk-builds/releases/download/VTK-9.2.6-static/vtk-Windows-x86_64.tar.gz |
| 79 | + target: ${{github.workspace}}/ |
| 80 | + if: runner.os == 'Windows' |
| 81 | + |
| 82 | + - name: Install VTK (MacOS) |
| 83 | + run: | |
| 84 | + brew install vtk |
| 85 | + if: runner.os == 'MacOS' |
| 86 | + |
| 87 | + - name: Create folders |
| 88 | + run: | |
| 89 | + mkdir -p ${{github.workspace}}/vtk |
| 90 | + mkdir -p ${{github.workspace}}/build |
| 91 | + mkdir -p ${{github.workspace}}/install |
| 92 | +
|
| 93 | + - name: Extract VTK tgz (Windows) |
| 94 | + run: | |
| 95 | + tar -xvzf vtk-Windows-x86_64.tar.gz -C vtk/ |
| 96 | + if: runner.os == 'Windows' |
| 97 | + |
| 98 | + - name: Set up QEMU |
| 99 | + uses: docker/setup-qemu-action@v3 |
| 100 | + with: |
| 101 | + platforms: all |
| 102 | + if: runner.os == 'Linux' |
| 103 | + |
| 104 | + - name: Build wheels |
| 105 | + |
| 106 | + with: |
| 107 | + output-dir: dist |
| 108 | + |
| 109 | + - uses: actions/upload-artifact@v4 |
| 110 | + id: build_wheels |
| 111 | + with: |
| 112 | + name: python-wheels-${{runner.os}}_${{inputs.arch}} |
| 113 | + path: ./dist/* |
0 commit comments