Skip to content

Commit

Permalink
build: Use a release profile that reduces binary size (#367)
Browse files Browse the repository at this point in the history
* build: Use a release profile that reduces binary size

* build: Don't build and publish Windows x86 wheels

* add comment to the release profile
  • Loading branch information
MarquessV authored Sep 27, 2023
1 parent f1436e8 commit 3e83452
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
35 changes: 33 additions & 2 deletions .github/workflows/release-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
target: [x64, x86]
target: [x64]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
Expand Down Expand Up @@ -123,11 +123,42 @@ jobs:
with:
name: wheels
path: dist
sdist:
runs-on: ubuntu-latest
needs: is-python-release
env:
CXXFLAGS: "-std=c++11"
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: '3.20.1'
- name: Build sdist
uses: messense/maturin-action@v1
with:
command: sdist
args: --manifest-path crates/python/Cargo.toml --out dist
- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist

release:
name: Release
runs-on: ubuntu-latest
needs: [ macos, linux, windows ]
needs: [ macos, linux, windows, sdist ]
steps:
- uses: actions/download-artifact@v3
- name: Publish to PyPi
Expand Down
8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,11 @@ pyo3-asyncio = { version = "0.19", features = ["tokio-runtime"] }
pyo3-build-config = "0.19.2"
rigetti-pyo3 = { version = "0.2.0", features = ["complex"] }

# The primary intent of these options is to reduce the binary size for Python wheels
# since PyPi has limits on how much storage a project can use.
# The LTO and codegen-units settings should have the added benefit of improving
# performance. The only benefit of stripping symbols is reducing binary size.
[profile.release]
strip = true
lto = true
codegen-units = 1

0 comments on commit 3e83452

Please sign in to comment.