|
| 1 | +name: Build and upload Wheels to TestPyPI |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + build_wheels: |
| 8 | + name: Build wheels on ${{ matrix.os }} |
| 9 | + runs-on: ${{ matrix.os }} |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + # macos13 is intel macos14 is arm |
| 13 | + os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-13, macos-14] |
| 14 | + |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + |
| 18 | + # Set GCC and Deployment Target for macOS 13 |
| 19 | + - name: Set GCC and MACOSX_DEPLOYMENT_TARGET for macOS 13 |
| 20 | + if: matrix.os == 'macos-13' |
| 21 | + run: | |
| 22 | + echo "MACOSX_DEPLOYMENT_TARGET=13.0" >> $GITHUB_ENV |
| 23 | +
|
| 24 | + # Set GCC and Deployment Target for macOS 14 |
| 25 | + - name: Set GCC and MACOSX_DEPLOYMENT_TARGET for macOS 14 |
| 26 | + if: matrix.os == 'macos-14' |
| 27 | + run: | |
| 28 | + echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> $GITHUB_ENV |
| 29 | +
|
| 30 | + - name: Install libomp for clang (macOS only) |
| 31 | + if: startsWith(matrix.os, 'macos') |
| 32 | + run: | |
| 33 | + brew install libomp |
| 34 | +
|
| 35 | + - name: Build wheels |
| 36 | + uses: pypa/cibuildwheel@v2.23.3 |
| 37 | + with: |
| 38 | + package-dir: . |
| 39 | + output-dir: wheelhouse |
| 40 | + config-file: "{package}/pyproject.toml" |
| 41 | + env: |
| 42 | + CIBW_SKIP: "pp*" |
| 43 | + CIBW_ENVIRONMENT_MACOS: > |
| 44 | + CC=$(brew --prefix llvm@15)/bin/clang |
| 45 | + CXX=$(brew --prefix llvm@15)/bin/clang++ |
| 46 | + LDFLAGS="-L$(brew --prefix libomp)/lib" |
| 47 | + CPPFLAGS="-I$(brew --prefix libomp)/include" |
| 48 | + - uses: actions/upload-artifact@v4 |
| 49 | + with: |
| 50 | + name: pyvale-wheels-${{ matrix.os }}-${{ strategy.job-index }} |
| 51 | + path: ./wheelhouse/*.whl |
| 52 | + |
| 53 | + |
| 54 | + build_sdist: |
| 55 | + name: Build source distribution |
| 56 | + runs-on: ubuntu-latest |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@v4 |
| 59 | + |
| 60 | + - name: Build sdist |
| 61 | + run: pipx run build --sdist |
| 62 | + |
| 63 | + - uses: actions/upload-artifact@v4 |
| 64 | + with: |
| 65 | + name: pyvale-sdist |
| 66 | + path: dist/*.tar.gz |
| 67 | + |
| 68 | + upload_pypi: |
| 69 | + needs: [build_wheels, build_sdist] |
| 70 | + runs-on: ubuntu-latest |
| 71 | + environment: pypi |
| 72 | + permissions: |
| 73 | + id-token: write |
| 74 | + |
| 75 | + steps: |
| 76 | + - uses: actions/download-artifact@v4 |
| 77 | + with: |
| 78 | + pattern: pyvale-* |
| 79 | + path: dist |
| 80 | + merge-multiple: true |
| 81 | + |
| 82 | + # upload to pypi |
| 83 | + - uses: pypa/gh-action-pypi-publish@release/v1 |
| 84 | + with: |
| 85 | + repository-url: https://test.pypi.org/legacy/ |
0 commit comments