|
4 | 4 | push:
|
5 | 5 | branches:
|
6 | 6 | - win-sleeef
|
| 7 | + tags: |
| 8 | + - 'quaddtype-v*' |
| 9 | + paths: |
| 10 | + - 'quaddtype/**' |
7 | 11 | pull_request:
|
| 12 | + paths: |
| 13 | + - 'quaddtype/**' |
8 | 14 | workflow_dispatch:
|
9 | 15 |
|
10 | 16 | jobs:
|
| 17 | + build_wheels_linux: |
| 18 | + name: Build wheels on Linux |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v3 |
| 22 | + |
| 23 | + - name: Set up Python |
| 24 | + uses: actions/setup-python@v4 |
| 25 | + with: |
| 26 | + python-version: '>=3.10.0' |
| 27 | + |
| 28 | + - name: Install cibuildwheel |
| 29 | + run: pip install cibuildwheel==2.20.0 |
| 30 | + |
| 31 | + - name: Build wheels |
| 32 | + env: |
| 33 | + CIBW_BUILD: 'cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64' |
| 34 | + CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 |
| 35 | + CIBW_BUILD_VERBOSITY: '3' |
| 36 | + CIBW_BEFORE_ALL: | |
| 37 | + git clone https://github.com/shibatch/sleef.git |
| 38 | + cd sleef |
| 39 | + cmake -S . -B build -DSLEEF_BUILD_QUAD:BOOL=ON -DSLEEF_BUILD_SHARED_LIBS:BOOL=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON |
| 40 | + cmake --build build/ --clean-first -j |
| 41 | + cmake --install build --prefix /usr/local |
| 42 | + CIBW_ENVIRONMENT: > |
| 43 | + CFLAGS="-I/usr/local/include $CFLAGS" |
| 44 | + CXXFLAGS="-I/usr/local/include $CXXFLAGS" |
| 45 | + LDFLAGS="-L/usr/local/lib64 $LDFLAGS" |
| 46 | + LD_LIBRARY_PATH="/usr/local/lib64:$LD_LIBRARY_PATH" |
| 47 | + CIBW_REPAIR_WHEEL_COMMAND: | |
| 48 | + auditwheel repair -w {dest_dir} --plat manylinux_2_28_x86_64 {wheel} |
| 49 | + CIBW_TEST_COMMAND: | |
| 50 | + pip install {package}[test] |
| 51 | + pytest {project}/tests |
| 52 | + CIBW_TEST_EXTRAS: 'test' |
| 53 | + run: | |
| 54 | + python -m cibuildwheel --output-dir wheelhouse |
| 55 | + working-directory: ./quaddtype |
| 56 | + |
| 57 | + - uses: actions/upload-artifact@v4 |
| 58 | + with: |
| 59 | + path: ./quaddtype/wheelhouse/*.whl |
| 60 | + name: wheels-linux |
| 61 | + |
| 62 | + build_wheels_macos: |
| 63 | + name: Build wheels on ${{ matrix.os }} |
| 64 | + runs-on: ${{ matrix.os }} |
| 65 | + strategy: |
| 66 | + matrix: |
| 67 | + os: [macos-13, macos-14] |
| 68 | + |
| 69 | + steps: |
| 70 | + - uses: actions/checkout@v3 |
| 71 | + |
| 72 | + - name: Set up Python |
| 73 | + uses: actions/setup-python@v4 |
| 74 | + with: |
| 75 | + python-version: '3.10' |
| 76 | + |
| 77 | + - name: Install SLEEF |
| 78 | + env: |
| 79 | + MACOSX_DEPLOYMENT_TARGET: '11.0' |
| 80 | + run: | |
| 81 | + git clone https://github.com/shibatch/sleef.git |
| 82 | + cd sleef |
| 83 | + cmake -S . -B build \ |
| 84 | + -DSLEEF_BUILD_QUAD:BOOL=ON \ |
| 85 | + -DSLEEF_BUILD_SHARED_LIBS:BOOL=ON \ |
| 86 | + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ |
| 87 | + -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \ |
| 88 | + -DCMAKE_INSTALL_RPATH="@loader_path/../lib" \ |
| 89 | + -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON |
| 90 | + cmake --build build/ --clean-first -j |
| 91 | + sudo cmake --install build --prefix /usr/local |
| 92 | + - name: Install cibuildwheel |
| 93 | + run: pip install cibuildwheel==2.20.0 |
| 94 | + |
| 95 | + - name: Build wheels |
| 96 | + env: |
| 97 | + CIBW_BUILD: 'cp310-* cp311-* cp312-*' |
| 98 | + CIBW_ARCHS_MACOS: ${{ matrix.os == 'macos-13' && 'x86_64' || 'arm64' }} |
| 99 | + CIBW_BUILD_VERBOSITY: '1' |
| 100 | + CIBW_ENVIRONMENT: > |
| 101 | + MACOSX_DEPLOYMENT_TARGET="11.0" |
| 102 | + DYLD_LIBRARY_PATH="/usr/local/lib:$DYLD_LIBRARY_PATH" |
| 103 | + CFLAGS="-I/usr/local/include $CFLAGS" |
| 104 | + CXXFLAGS="-I/usr/local/include $CXXFLAGS" |
| 105 | + LDFLAGS="-L/usr/local/lib $LDFLAGS" |
| 106 | + CIBW_REPAIR_WHEEL_COMMAND: > |
| 107 | + delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} |
| 108 | + CIBW_TEST_COMMAND: | |
| 109 | + pip install {package}[test] |
| 110 | + pytest {project}/tests |
| 111 | + CIBW_TEST_EXTRAS: 'test' |
| 112 | + run: | |
| 113 | + python -m cibuildwheel --output-dir wheelhouse |
| 114 | + working-directory: ./quaddtype |
| 115 | + |
| 116 | + - uses: actions/upload-artifact@v4 |
| 117 | + with: |
| 118 | + path: ./quaddtype/wheelhouse/*.whl |
| 119 | + name: wheels-${{ matrix.os }} |
| 120 | + |
11 | 121 | build_wheels_windows:
|
12 | 122 | name: Build wheels on Windows
|
13 | 123 | runs-on: windows-latest
|
@@ -83,3 +193,55 @@ jobs:
|
83 | 193 | with:
|
84 | 194 | path: ./quaddtype/wheelhouse/*.whl
|
85 | 195 | name: wheels-windows-${{ matrix.architecture }}
|
| 196 | + |
| 197 | + publish_to_testpypi: |
| 198 | + name: Publish to TestPyPI |
| 199 | + needs: [build_wheels_linux, build_wheels_macos, build_wheels_windows] |
| 200 | + runs-on: ubuntu-latest |
| 201 | + if: startsWith(github.ref, 'refs/tags/quaddtype-v') |
| 202 | + steps: |
| 203 | + - name: Download all workflow run artifacts |
| 204 | + uses: actions/download-artifact@v4 |
| 205 | + with: |
| 206 | + path: dist |
| 207 | + - name: Publish to TestPyPI |
| 208 | + |
| 209 | + with: |
| 210 | + user: __token__ |
| 211 | + password: ${{ secrets.PYPI_API_TOKEN }} |
| 212 | + repository-url: https://test.pypi.org/legacy/ |
| 213 | + packages-dir: dist/* |
| 214 | + |
| 215 | + create_release: |
| 216 | + name: Create Release |
| 217 | + needs: [build_wheels_linux, build_wheels_macos, build_wheels_windows] |
| 218 | + runs-on: ubuntu-latest |
| 219 | + if: startsWith(github.ref, 'refs/tags/quaddtype-v') |
| 220 | + |
| 221 | + steps: |
| 222 | + - name: Checkout code |
| 223 | + uses: actions/checkout@v2 |
| 224 | + |
| 225 | + - name: Download all workflow run artifacts |
| 226 | + uses: actions/download-artifact@v4 |
| 227 | + with: |
| 228 | + path: artifacts |
| 229 | + |
| 230 | + - name: Create Release |
| 231 | + id: create_release |
| 232 | + uses: actions/create-release@v1 |
| 233 | + env: |
| 234 | + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} |
| 235 | + with: |
| 236 | + tag_name: ${{ github.ref }} |
| 237 | + release_name: Release ${{ github.ref }} |
| 238 | + draft: false |
| 239 | + prerelease: false |
| 240 | + |
| 241 | + - name: Upload Release Assets |
| 242 | + uses: softprops/action-gh-release@v1 |
| 243 | + if: startsWith(github.ref, 'refs/tags/') |
| 244 | + with: |
| 245 | + files: ./artifacts/**/*.whl |
| 246 | + env: |
| 247 | + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} |
0 commit comments