Skip to content

Commit 8bfcdb2

Browse files
committed
add wheels workflow
1 parent e0eea4d commit 8bfcdb2

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

.github/workflows/build_wheels.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Build and release wheels
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build_wheels:
10+
name: Build wheels on ${{ matrix.os }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-22.04, macos-13, macos-14]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install Bazel (Linux)
20+
if: runner.os == 'Linux'
21+
run: |
22+
sudo apt-get install -y apt-transport-https curl gnupg
23+
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel-archive-keyring.gpg
24+
sudo mv bazel-archive-keyring.gpg /usr/share/keyrings/
25+
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
26+
sudo apt-get update && sudo apt-get install -y bazel
27+
28+
- name: Install Bazel (macOS)
29+
if: runner.os == 'macOS'
30+
run: brew install bazel
31+
32+
- name: Build wheels
33+
uses: pypa/cibuildwheel@v2.21
34+
env:
35+
CIBW_BUILD: cp310-* cp311-* cp312-*
36+
CIBW_SKIP: "*-win32 *-musllinux*"
37+
CIBW_ARCHS_LINUX: x86_64
38+
CIBW_ARCHS_MACOS: auto
39+
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
40+
CIBW_BEFORE_ALL_LINUX: >
41+
yum install -y java-11-openjdk &&
42+
curl -Lo /usr/local/bin/bazel https://github.com/bazelbuild/bazel/releases/download/6.4.0/bazel-6.4.0-linux-x86_64 &&
43+
chmod +x /usr/local/bin/bazel
44+
CIBW_ENVIRONMENT: PATH="/usr/local/bin:$PATH"
45+
46+
- uses: actions/upload-artifact@v4
47+
with:
48+
name: wheels-${{ matrix.os }}
49+
path: ./wheelhouse/*.whl
50+
51+
release:
52+
needs: build_wheels
53+
runs-on: ubuntu-latest
54+
permissions:
55+
contents: write
56+
steps:
57+
- uses: actions/download-artifact@v4
58+
with:
59+
pattern: wheels-*
60+
merge-multiple: true
61+
path: dist/
62+
63+
- name: Create GitHub Release
64+
uses: softprops/action-gh-release@v2
65+
with:
66+
files: dist/*.whl
67+
generate_release_notes: true

0 commit comments

Comments
 (0)