Skip to content

Commit b733526

Browse files
chore: polish patch_grpc_web script
1 parent f6119a1 commit b733526

File tree

2 files changed

+40
-48
lines changed

2 files changed

+40
-48
lines changed

.github/workflows/release-python-grpc-web.yml

+37-44
Original file line numberDiff line numberDiff line change
@@ -26,42 +26,40 @@ jobs:
2626
steps:
2727
- run: echo "Publishing wheels"
2828

29-
# macos:
30-
# runs-on: macos-12
31-
# needs: [is-python-release, should-publish-wheels]
32-
# env:
33-
# CXXFLAGS: "-std=c++11 -stdlib=libc++"
34-
# steps:
35-
# - uses: actions/checkout@v2
36-
# - uses: actions/setup-python@v4
37-
# with:
38-
# python-version: ${{ matrix.python-version }}
39-
# - name: Install protoc
40-
# uses: arduino/setup-protoc@v1
41-
# with:
42-
# repo-token: ${{ secrets.GITHUB_TOKEN }}
43-
# version: '3.20.1'
44-
# - name: Patch package metadata for grpc-web
45-
# working-directory: ./crates/python
46-
# run: |
47-
# pip install toml
48-
# python scripts/patch_package_name.py
49-
# cd ../..
50-
# python crates/python/scripts/patch_hyper_proxy.py
51-
# - name: Build wheels - universal2
52-
# # universal2 supports both x86_64 and aarch64
53-
# uses: messense/maturin-action@v1
54-
# with:
55-
# args: -i 3.8 3.9 3.10 3.11 3.12 --release --target universal2-apple-darwin --manifest-path crates/python/Cargo.toml --features grpc-web --out dist
56-
# docker-options: -e CI
57-
# - name: Install wheel
58-
# run: |
59-
# pip install qcs-sdk-python --find-links dist --force-reinstall
60-
# - name: Upload wheels
61-
# uses: actions/upload-artifact@v3
62-
# with:
63-
# name: wheels-grpc-web
64-
# path: dist
29+
macos:
30+
runs-on: macos-12
31+
needs: [is-python-release, should-publish-wheels]
32+
env:
33+
CXXFLAGS: "-std=c++11 -stdlib=libc++"
34+
steps:
35+
- uses: actions/checkout@v2
36+
- uses: actions/setup-python@v4
37+
with:
38+
python-version: ${{ matrix.python-version }}
39+
- name: Install protoc
40+
uses: arduino/setup-protoc@v1
41+
with:
42+
repo-token: ${{ secrets.GITHUB_TOKEN }}
43+
version: '3.20.1'
44+
- name: Patch package metadata for grpc-web
45+
run: |
46+
pip install toml
47+
python crates/python/scripts/patch_grpc_web.py
48+
cargo update
49+
- name: Build wheels - universal2
50+
# universal2 supports both x86_64 and aarch64
51+
uses: messense/maturin-action@v1
52+
with:
53+
args: -i 3.8 3.9 3.10 3.11 3.12 --release --target universal2-apple-darwin --manifest-path crates/python/Cargo.toml --features grpc-web --out dist
54+
docker-options: -e CI
55+
- name: Install wheel
56+
run: |
57+
pip install qcs-sdk-python --find-links dist --force-reinstall
58+
- name: Upload wheels
59+
uses: actions/upload-artifact@v3
60+
with:
61+
name: wheels-grpc-web
62+
path: dist
6563

6664
linux:
6765
runs-on: ubuntu-latest
@@ -83,12 +81,9 @@ jobs:
8381
repo-token: ${{ secrets.GITHUB_TOKEN }}
8482
version: '3.20.1'
8583
- name: Patch package metadata for grpc-web
86-
working-directory: ./crates/python
8784
run: |
8885
pip install toml
89-
python scripts/patch_package_name.py
90-
cd ../..
91-
python crates/python/scripts/patch_hyper_proxy.py
86+
python crates/python/scripts/patch_grpc_web.py
9287
cargo update
9388
- name: Build wheels
9489
uses: messense/maturin-action@v1
@@ -123,12 +118,10 @@ jobs:
123118
repo-token: ${{ secrets.GITHUB_TOKEN }}
124119
version: '3.20.1'
125120
- name: Patch package metadata for grpc-web
126-
working-directory: ./crates/python
127121
run: |
128122
pip install toml
129-
python scripts/patch_package_name.py
130-
cd ../..
131-
python crates/python/scripts/patch_hyper_proxy.py
123+
python crates/python/scripts/patch_grpc_web.py
124+
cargo update
132125
- name: Build sdist
133126
uses: messense/maturin-action@v1
134127
with:

crates/python/scripts/patch_grpc_web.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
"""
22
Appends grpc-web to the project name of both Cargo.toml and pyproject.toml,
3-
and patches the `hyper-proxy` dependency.
3+
and patches the `hyper-proxy` dependency to allow ppc64le wheel builds.
44
5-
This is used in CI to update the package metadata before publishing the alternate
6-
package with the grpc-web feature enabled.
5+
This is used in CI to prepare grpc-web-specific python artifacts for publishing.
76
"""
87

98
from io import TextIOWrapper
10-
from os.path import dirname, realpath, relpath, join
9+
from os.path import dirname, realpath, join
1110
import toml
1211

1312
pycrate_path = dirname(dirname(realpath(__file__)))

0 commit comments

Comments
 (0)