|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: [push] |
| 4 | + |
| 5 | +jobs: |
| 6 | + sdist: |
| 7 | + name: Source build for pip |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - uses: actions/checkout@v4 |
| 11 | + - uses: actions/setup-python@v4 |
| 12 | + - name: install dev requirements |
| 13 | + run: python -m pip install "cibuildwheel" |
| 14 | + - name: build sdist |
| 15 | + run: > |
| 16 | + python -c "import collections, pathlib, subprocess, sys; collections.deque(map(lambda p: subprocess.check_call([sys.executable, '-m', 'build', p, '-o', sys.argv[2]]), pathlib.Path(sys.argv[1]).iterdir()), 0)" |
| 17 | + ./projects/ |
| 18 | + ./dist/ |
| 19 | + - name: upload sdist |
| 20 | + uses: actions/upload-artifact@v4 |
| 21 | + with: |
| 22 | + name: sdist |
| 23 | + path: ./dist/* |
| 24 | + |
| 25 | + bdist: |
| 26 | + name: Binary build for ${{ matrix.py-impl }} on ${{ matrix.os }} |
| 27 | + needs: sdist |
| 28 | + runs-on: ${{ matrix.github_os }} |
| 29 | + strategy: |
| 30 | + fail-fast: false |
| 31 | + matrix: |
| 32 | + py-impl: ["CPython 3.X", "PyPy 3.X"] |
| 33 | + os: [Windows, Mac, Linux, "Linux (Extra Architectures)"] |
| 34 | + |
| 35 | + include: |
| 36 | + - py-impl: "CPython 3.X" |
| 37 | + cibw_build: "cp3*" |
| 38 | + - py-impl: "PyPy 3.X" |
| 39 | + cibw_build: "pp3*" |
| 40 | + # Use the oldest OSes available for compatibility |
| 41 | + - os: Windows |
| 42 | + github_os: windows-2019 |
| 43 | + cibw_archs: AMD64 x86 ARM64 |
| 44 | + - os: Mac |
| 45 | + github_os: macos-11 |
| 46 | + cibw_archs: x86_64 arm64 universal2 |
| 47 | + - os: Linux |
| 48 | + github_os: ubuntu-20.04 |
| 49 | + cibw_archs: x86_64 i686 |
| 50 | + - os: Linux (Extra Architectures) |
| 51 | + github_os: ubuntu-20.04 |
| 52 | + cibw_archs: aarch64 ppc64le s390x |
| 53 | + |
| 54 | + exclude: |
| 55 | + # FIXME? cibuildwheel won't work with this |
| 56 | + - os: Linux (Extra Architectures) |
| 57 | + py-impl: "PyPy 3.X" |
| 58 | + |
| 59 | + steps: |
| 60 | + - uses: actions/download-artifact@v4 |
| 61 | + with: |
| 62 | + name: sdist |
| 63 | + path: ./dist/ |
| 64 | + |
| 65 | + # Used to host cibuildwheel |
| 66 | + - uses: actions/setup-python@v3 |
| 67 | + |
| 68 | + - if: matrix.os == 'Linux (Extra Architectures)' |
| 69 | + uses: docker/setup-qemu-action@v3 |
| 70 | + |
| 71 | + - name: Install cibuildwheel |
| 72 | + run: > |
| 73 | + python -c "import os, subprocess, sys; CIBW_VER = os.environ.get('_CIBW_VER', sys.argv[1]); subprocess.check_call([sys.executable, '-m', 'pip', 'install', f'cibuildwheel == {CIBW_VER}'])" |
| 74 | + 2.16.3 |
| 75 | + - name: Build wheels |
| 76 | + # https://github.com/pypa/cibuildwheel/issues/173#issuecomment-1501236916 |
| 77 | + run: > |
| 78 | + python -c "import pathlib, subprocess, sys; target = pathlib.Path(sys.argv[1]); subprocess.check_call([sys.executable, '-m', 'cibuildwheel', '--output-dir', target, *target.iterdir()])" |
| 79 | + ./dist/ |
| 80 | + env: |
| 81 | + CIBW_BUILD: ${{ matrix.cibw_build }} |
| 82 | + CIBW_ARCHS: ${{ matrix.cibw_archs }} |
| 83 | + CIBW_BUILD_VERBOSITY: 1 |
| 84 | + # FIXME? cibuildwheel disagrees with CPython 3.6 in some way |
| 85 | + # FIXME? PQClean GNU extensions break musl |
| 86 | + # FIXME? delvewheel chokes specifically on CPython on Windows on ARM |
| 87 | + CIBW_SKIP: > |
| 88 | + cp36-* |
| 89 | + *-musllinux_* |
| 90 | + cp*-win*arm* |
| 91 | + # https://cibuildwheel.readthedocs.io/en/stable/options/#:~:text=cibuildwheel%20doesn%27t%20yet%20ship%20a%20default%20repair%20command%20for%20Windows%2E |
| 92 | + CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel" |
| 93 | + CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}" |
| 94 | + |
| 95 | + - uses: actions/upload-artifact@v4 |
| 96 | + with: |
| 97 | + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} |
| 98 | + path: ./dist/*.whl |
| 99 | + if-no-files-found: error |
0 commit comments