1name: Build and upload Python wheels 2 3on: 4 workflow_dispatch: 5 release: 6 types: 7 - published 8 9jobs: 10 build_sdist: 11 name: Build source distribution 12 runs-on: ubuntu-latest 13 steps: 14 - name: Check out repo 15 uses: actions/checkout@v2 16 17 - name: Install Python 3.9 18 uses: actions/setup-python@v2 19 with: 20 python-version: 3.9 21 22 - name: Build and check sdist 23 run: | 24 python setup.py sdist 25 - name: Upload sdist 26 uses: actions/upload-artifact@v2 27 with: 28 name: dist 29 path: dist/*.tar.gz 30 31 build_linux: 32 name: Build google-benchmark manylinux wheels 33 runs-on: ubuntu-latest 34 35 steps: 36 - name: Check out Google Benchmark 37 uses: actions/checkout@v2 38 39 - name: Set up Python 3.9 40 uses: actions/setup-python@v2 41 with: 42 python-version: 3.9 43 44 # TODO: Bazel does not seem to work in an emulated Docker environment, see 45 # https://github.com/bazelbuild/bazel/issues/11379 46# - name: Set up QEMU 47# uses: docker/setup-qemu-action@v1 48# with: 49# platforms: all 50 51 - name: Build Python wheels on ubuntu-latest 52 env: 53 CIBW_BUILD: 'cp37-* cp38-* cp39-* cp310-*' 54 CIBW_SKIP: "*-musllinux_*" 55 # Bazel repo only exists on CentOS 7 for x86 and ppc, so no manylinux2010 56 # TODO: Build ppc64le, aarch64 using some other trick 57 CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 58 CIBW_ARCHS_LINUX: x86_64 59 CIBW_BEFORE_ALL: > 60 curl -O --retry-delay 5 --retry 5 https://copr.fedorainfracloud.org/coprs/vbatts/bazel/repo/epel-7/vbatts-bazel-epel-7.repo && 61 cp vbatts-bazel-epel-7.repo /etc/yum.repos.d/bazel.repo && 62 yum install -y bazel4 63 CIBW_TEST_COMMAND: python {project}/bindings/python/google_benchmark/example.py 64 run: | 65 pip install cibuildwheel 66 python -m cibuildwheel --output-dir wheelhouse 67 68 - name: Upload Linux wheels 69 uses: actions/upload-artifact@v2 70 with: 71 name: dist 72 path: wheelhouse/*.whl 73 74 build_macos: 75 name: Build google-benchmark macOS wheels 76 runs-on: macos-latest 77 78 steps: 79 - name: Check out Google Benchmark 80 uses: actions/checkout@v2 81 82 - name: Set up Python 3.9 83 uses: actions/setup-python@v2 84 with: 85 python-version: 3.9 86 87 - name: Build Python wheels on macOS 88 env: 89 CIBW_ARCHS_MACOS: "x86_64 arm64" 90 CIBW_BUILD: 'cp37-* cp38-* cp39-* cp310-*' 91 # ARM64 requires Python 3.8 minimum 92 CIBW_SKIP: 'cp37-*-arm64' 93 CIBW_TEST_COMMAND: python {project}/bindings/python/google_benchmark/example.py 94 CIBW_TEST_SKIP: "*_arm64" 95 run: | 96 pip install cibuildwheel 97 python -m cibuildwheel --output-dir wheelhouse 98 99 - name: Upload macOS wheels 100 uses: actions/upload-artifact@v2 101 with: 102 name: dist 103 path: wheelhouse/*.whl 104 105 build_windows: 106 name: Build google-benchmark wheels on Windows 107 runs-on: windows-latest 108 109 steps: 110 - name: Check out Google Benchmark 111 uses: actions/checkout@v2 112 113 - name: Set up Python 3.9 114 uses: actions/setup-python@v2 115 with: 116 python-version: 3.9 117 118 - name: Build Python wheels on Windows 119 env: 120 CIBW_BUILD: 'cp37-* cp38-* cp39-* cp310-*' 121 CIBW_ARCHS_WINDOWS: AMD64 122 # otherwise, pip crashes the job by trying to remove an in-use bazel DLL 123 PIP_NO_CLEAN: true 124 CIBW_TEST_COMMAND: python {project}/bindings/python/google_benchmark/example.py 125 run: | 126 pip install cibuildwheel 127 python -m cibuildwheel --output-dir wheelhouse 128 129 - name: Upload wheels 130 uses: actions/upload-artifact@v2 131 with: 132 name: dist 133 path: wheelhouse/*.whl