Skip to content

Commit 0392468

Browse files
authored
Use cibuildwheel and update grpcio (#57)
1 parent 25caaf0 commit 0392468

File tree

5 files changed

+302
-171
lines changed

5 files changed

+302
-171
lines changed

.github/workflows/ci.yml

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,35 +82,97 @@ jobs:
8282
include:
8383
- os: ubuntu-latest
8484
package-suffix: linux-amd64
85+
ci-arch: auto
8586
- os: macos-latest
8687
package-suffix: macos-amd64
88+
ci-arch: auto
89+
- os: macos-latest
90+
package-suffix: macos-arm64
91+
ci-arch: arm64
92+
rust-add-target: aarch64-apple-darwin
8793
- os: windows-latest
8894
package-suffix: windows-amd64
95+
ci-arch: auto
8996
runs-on: ${{ matrix.os }}
9097
steps:
9198
- uses: actions/checkout@v2
9299
with:
93100
submodules: recursive
94-
- uses: actions-rs/toolchain@v1
101+
- uses: actions/setup-python@v1
102+
with:
103+
python-version: "3.10"
104+
105+
# Install Rust locally for non-Linux (Linux uses an internal docker
106+
# command to build with cibuildwheel which uses rustup install defined
107+
# in pyproject.toml)
108+
- if: ${{ runner.os != 'Linux' }}
109+
uses: actions-rs/toolchain@v1
95110
with:
96111
toolchain: stable
97-
- uses: Swatinem/rust-cache@v1
112+
target: ${{ matrix.rust-add-target }}
113+
- if: ${{ runner.os != 'Linux' }}
114+
uses: Swatinem/rust-cache@v1
98115
with:
99116
working-directory: temporalio/bridge
117+
118+
# Prepare
119+
- run: python -m pip install --upgrade wheel poetry poethepoet
120+
- run: poetry install --no-root
121+
122+
# Add the source dist only for Linux x64 for now
123+
- if: ${{ matrix.package-suffix == 'linux-amd64' }}
124+
run: poetry build --format sdist
125+
126+
# Build and fix the wheel
127+
- run: poetry run cibuildwheel --output-dir dist --arch ${{ matrix.ci-arch }}
128+
- run: poe fix-wheel
129+
130+
# Do test only for ci-arch auto (i.e. local machine)
131+
- if: ${{ matrix.ci-arch == 'auto' }}
132+
uses: actions/setup-go@v2
133+
with:
134+
go-version: "1.18"
135+
- if: ${{ matrix.ci-arch == 'auto' }}
136+
run: poe test-dist-single
137+
138+
# Upload dist
139+
- uses: actions/upload-artifact@v2
140+
with:
141+
name: packages-${{ matrix.package-suffix }}
142+
path: dist
143+
144+
# We separate out Linux aarch64 so we can choose not to run it during PR since
145+
# it is so slow in cibuildwheel (uses QEMU emulation). We can put this back in
146+
# the above matrix when Linux ARM runners are available.
147+
compile-binaries-linux-aarch64:
148+
# Skip compiling Linux aarch64 on PR
149+
if: ${{ github.event_name != 'pull_request' }}
150+
runs-on: ubuntu-latest
151+
steps:
152+
- uses: actions/checkout@v2
153+
with:
154+
submodules: recursive
100155
- uses: actions/setup-python@v1
101156
with:
102157
python-version: "3.10"
103-
# Needed for tests since they use external server
104-
- uses: actions/setup-go@v2
158+
159+
# Need QEMU for ARM build on Linux
160+
- uses: docker/setup-qemu-action@v1
105161
with:
106-
go-version: "1.18"
162+
image: tonistiigi/binfmt:latest
163+
platforms: arm64
164+
165+
# Prepare
107166
- run: python -m pip install --upgrade wheel poetry poethepoet
108167
- run: poetry install --no-root
109-
- run: poetry build
168+
169+
# Build and fix the wheel
170+
- run: poetry run cibuildwheel --output-dir dist --arch aarch64
110171
- run: poe fix-wheel
111-
- run: poe test-dist-single
172+
173+
# Upload dist
112174
- uses: actions/upload-artifact@v2
113175
with:
114-
name: packages-${{ matrix.package-suffix }}
176+
name: packages-linux-aarch64
115177
path: dist
116178

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ These steps can be followed to use with a virtual environment and `pip`:
5757

5858
For macOS M1 users on Python 3.10+, due to an
5959
[improperly named wheel in PyPI for gRPC](https://github.com/grpc/grpc/issues/28387), you may have to run
60-
`pip install --no-binary :all: grpcio --ignore-installed` in your environment before use.
60+
`pip install --no-binary :all: grpcio --ignore-installed` in your environment before use. (this is fixed in the next
61+
version of `temporalio` and in the `main` branch)
6162

6263
The SDK is now ready for use. To build from source, see "Building" near the end of this documentation.
6364

0 commit comments

Comments
 (0)