|
| 1 | +name: Build python-libsbml Wheels (3.8) |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + make_sdist: |
| 8 | + name: Make SDist |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v4 |
| 12 | + with: |
| 13 | + fetch-depth: 0 # Optional, use if you use setuptools_scm |
| 14 | + |
| 15 | + - name: checkout needed submodules |
| 16 | + shell: bash |
| 17 | + run: | |
| 18 | + ./.github/workflows/checkout-submodules.sh |
| 19 | +
|
| 20 | + - name: Build SDist |
| 21 | + run: pipx run build --sdist |
| 22 | + |
| 23 | + - uses: actions/upload-artifact@v4 |
| 24 | + with: |
| 25 | + path: dist/*.tar.gz |
| 26 | + name: libSBML-sdist |
| 27 | + |
| 28 | + build_wheels: |
| 29 | + name: Wheel on ${{ matrix.os }} for ${{ matrix.python_version }} |
| 30 | + runs-on: ${{ matrix.os }} |
| 31 | + needs: make_sdist |
| 32 | + strategy: |
| 33 | + fail-fast: false |
| 34 | + matrix: |
| 35 | + # macos-15-intel is an Intel runner, macos-14 is Apple silicon |
| 36 | + os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-15-intel, macos-14] |
| 37 | + python_version: ['cp38-*'] |
| 38 | + |
| 39 | + steps: |
| 40 | + - uses: actions/download-artifact@v4 |
| 41 | + with: |
| 42 | + name: libSBML-sdist |
| 43 | + |
| 44 | + - name: Extract sdist into the current directory |
| 45 | + shell: bash |
| 46 | + run: | |
| 47 | + tar zxf *.tar.gz --strip-components=1 |
| 48 | +
|
| 49 | +
|
| 50 | + - uses: actions/setup-python@v5 |
| 51 | + with: |
| 52 | + python-version: '3.11' |
| 53 | + |
| 54 | + - name: Install cibuildwheel |
| 55 | + run: | |
| 56 | + python -m pip install cibuildwheel==3.0.0 swig==4.4.1 cmake==3.31.6 |
| 57 | + |
| 58 | + # print versions |
| 59 | + python --version |
| 60 | + cmake --version |
| 61 | + swig -version |
| 62 | + |
| 63 | + # echo python major.minor version into a environment variable |
| 64 | + echo "PYTHON_VERSION=$(python -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')" >> $GITHUB_ENV |
| 65 | + |
| 66 | + - name: Set artifact name |
| 67 | + id: artifact-name |
| 68 | + shell: bash |
| 69 | + run: | |
| 70 | + python_tag="${CIBW_BUILD%-*}" |
| 71 | + echo "name=libSBML-${{ matrix.os }}-${python_tag}-${{ strategy.job-index }}" >> $GITHUB_OUTPUT |
| 72 | + env: |
| 73 | + CIBW_BUILD: ${{ matrix.python_version }} |
| 74 | + - name: Build Wheels |
| 75 | + run: | |
| 76 | + python -m cibuildwheel --output-dir wheelhouse |
| 77 | + env: |
| 78 | + CIBW_BUILD: ${{ matrix.python_version }} |
| 79 | + CIBW_ARCHS_MACOS: x86_64 arm64 |
| 80 | + CIBW_BEFORE_BUILD_LINUX: "pip install swig==4.4.1" |
| 81 | + CIBW_SKIP: "*-manylinux_i686" |
| 82 | + |
| 83 | + - name: Upload wheels |
| 84 | + uses: actions/upload-artifact@v4 |
| 85 | + with: |
| 86 | + path: wheelhouse/*.whl |
| 87 | + name: ${{ steps.artifact-name.outputs.name }} |
| 88 | + |
| 89 | + merge_wheels: |
| 90 | + needs: [build_wheels] |
| 91 | + runs-on: ubuntu-latest |
| 92 | + steps: |
| 93 | + - uses: actions/download-artifact@v4 |
| 94 | + with: |
| 95 | + pattern: libSBML-* |
| 96 | + path: dist |
| 97 | + |
| 98 | + - name: Move wheels from dist subfolder to dist folder |
| 99 | + run: | |
| 100 | + find dist -name "*.whl" -exec mv {} dist/ \; |
| 101 | + find dist -name "*.tar.gz" -exec mv {} dist/ \; |
| 102 | + find dist -type d -empty -delete |
| 103 | +
|
| 104 | + - uses: actions/upload-artifact@v4 |
| 105 | + with: |
| 106 | + name: libSBML-combined |
| 107 | + path: dist |
| 108 | + |
| 109 | + |
0 commit comments