|
1 | | -name: Wheels |
| 1 | +# Python release WIP |
| 2 | +name: Build wheels |
| 3 | +on: [] |
| 4 | +# release: |
| 5 | +# types: |
| 6 | +# - published |
2 | 7 |
|
3 | | -on: [push, pull_request] |
| 8 | +concurrency: |
| 9 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 10 | + cancel-in-progress: true |
4 | 11 |
|
5 | 12 | jobs: |
6 | 13 | build_wheels: |
7 | | - name: Build wheels on ${{ matrix.os }} |
8 | | - runs-on: ${{ matrix.os }} |
| 14 | + name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }} |
| 15 | + runs-on: ${{ matrix.buildplat[0] }} |
| 16 | + environment: pypi |
9 | 17 | strategy: |
| 18 | + # Ensure that a wheel builder finishes even if another fails |
| 19 | + fail-fast: false |
10 | 20 | matrix: |
11 | | - os: [macOS-12] # windows-2019 ubuntu-20.04, |
| 21 | + # From NumPy |
| 22 | + # Github Actions doesn't support pairing matrix values together, let's improvise |
| 23 | + # https://github.com/github/feedback/discussions/7835#discussioncomment-1769026 |
| 24 | + buildplat: |
| 25 | + - [ubuntu-20.04, manylinux_x86_64] |
| 26 | + - [ubuntu-20.04, musllinux_x86_64] # No OpenBlas, no test |
| 27 | + - [macos-12, macosx_x86_64] |
| 28 | + - [macos-12, macosx_arm64] |
| 29 | + - [windows-2019, win_amd64] |
| 30 | + python: ["cp38", "cp39","cp310", "cp311"] |
12 | 31 |
|
13 | 32 | steps: |
14 | 33 | - uses: actions/checkout@v3 |
| 34 | + - name: Build wheels |
| 35 | + |
| 36 | + env: |
| 37 | + CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} |
| 38 | + - uses: actions/upload-artifact@v3 |
| 39 | + with: |
| 40 | + path: ./wheelhouse/*.whl |
15 | 41 |
|
16 | | - # Used to host cibuildwheel |
17 | | - - uses: actions/setup-python@v2 |
18 | | - |
19 | | - - name: Install cibuildwheel |
20 | | - run: python -m pip install cibuildwheel==2.7.0 |
21 | | - |
22 | | - - name: Install pyomo pybind |
23 | | - run: python -m pip install pybind11 pyomo |
24 | | - |
25 | | - - name: Create Build Environment |
26 | | - run: cmake -E make_directory ${{runner.workspace}}/build |
27 | | - |
28 | | - - name: Create install dir |
29 | | - run: cmake -E make_directory ${{runner.workspace}}/installs/ |
30 | | - |
31 | | - - name: Configure CMake |
32 | | - shell: bash |
33 | | - working-directory: ${{runner.workspace}}/build |
34 | | - run: cmake $GITHUB_WORKSPACE -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/installs/highs -DFAST_BUILD=ON |
35 | | - |
36 | | - - name: Build |
37 | | - working-directory: ${{runner.workspace}}/build |
38 | | - shell: bash |
39 | | - # Execute the build. You can specify a specific target with "--target <NAME>" |
40 | | - run: | |
41 | | - cmake --build . --parallel |
42 | | - cmake --install . |
43 | | -
|
44 | | - - name: Test |
45 | | - working-directory: ${{runner.workspace}}/build |
46 | | - shell: bash |
47 | | - # Execute tests defined by the CMake configuration. |
48 | | - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail |
49 | | - run: ctest --parallel 2 --timeout 300 --output-on-failure |
| 42 | + build_sdist: |
| 43 | + name: Build source distribution |
| 44 | + runs-on: ubuntu-latest |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@v3 |
50 | 47 |
|
51 | | - - name: Build wheels |
52 | | - run: | |
53 | | - cd $GITHUB_WORKSPACE |
54 | | - export REPAIR_LIBRARY_PATH=${{runner.workspace}}/installs/highs/lib |
55 | | - export LD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH |
56 | | - export DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH |
57 | | - ls $REPAIR_LIBRARY_PATH |
58 | | - python -m cibuildwheel --output-dir wheelhouse |
| 48 | + - name: Build sdist |
| 49 | + shell: bash -l {0} |
| 50 | + run: pipx run build --sdist |
59 | 51 |
|
60 | | - # to supply options, put them in 'env', like: |
| 52 | + - uses: actions/upload-artifact@v3 |
| 53 | + with: |
| 54 | + path: dist/*.tar.gz |
61 | 55 |
|
62 | | - env: |
63 | | - CIBW_ENVIRONMENT: REPAIR_LIBRARY_PATH=${{runner.workspace}}/installs/highs/lib LD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH |
64 | | - CIBW_REPAIR_WHEEL_COMMAND_MACOS: > |
65 | | - DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-listdeps {wheel} && |
66 | | - DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel} |
| 56 | + upload_pypi: |
| 57 | + needs: [build_wheels, build_sdist] |
| 58 | + runs-on: ubuntu-latest |
| 59 | + # upload to PyPI on every tag starting with 'v' |
| 60 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') |
| 61 | + # alternatively, to publish when a GitHub Release is created, use the following rule: |
| 62 | + # if: github.event_name == 'release' && github.event.action == 'published' |
| 63 | + steps: |
| 64 | + - uses: actions/download-artifact@v3 |
| 65 | + with: |
| 66 | + # unpacks default artifact into dist/ |
| 67 | + # if `name: artifact` is omitted, the action will create extra parent dir |
| 68 | + name: artifact |
| 69 | + path: dist |
67 | 70 |
|
68 | | - - uses: actions/upload-artifact@v2 |
| 71 | + - uses: pypa/gh-action-pypi-publish@release/v1 |
69 | 72 | with: |
70 | | - path: ./wheelhouse/*.whl |
| 73 | + user: __token__ |
| 74 | + password: ${{ secrets.PYPI_API_TOKEN }} |
0 commit comments