Skip to content

Commit

Permalink
fix: use native-tls on some platforms that dont support rustls-tls
Browse files Browse the repository at this point in the history
  • Loading branch information
baszalmstra committed Oct 5, 2023
1 parent 4d5a1fe commit 4dfc7c3
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 12 deletions.
87 changes: 76 additions & 11 deletions .github/workflows/release-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,20 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: ${{ matrix.platform.arch }}
- name: "Build wheels"
- name: "Build wheels (rustls-tls)"
uses: PyO3/maturin-action@v1
if: ${{ !startsWith(matrix.platform.target, 'aarch64') }}
with:
working-directory: py-rattler
target: ${{ matrix.platform.target }}
args: --release --out dist
args: --release --out dist --no-default-features --features rustls-tls
- name: "Build wheels (native-tls)"
uses: PyO3/maturin-action@v1
if: ${{ startsWith(matrix.platform.target, 'aarch64') }}
with:
working-directory: py-rattler
target: ${{ matrix.platform.target }}
args: --release --out dist --no-default-features --features native-tls
- name: "Test wheel"
if: ${{ !startsWith(matrix.platform.target, 'aarch64') }}
shell: bash
Expand Down Expand Up @@ -118,7 +126,7 @@ jobs:
working-directory: py-rattler
target: ${{ matrix.target }}
manylinux: auto
args: --release --out dist
args: --release --out dist --no-default-features --features rustls-tls
- name: "Test wheel"
if: ${{ startsWith(matrix.target, 'x86_64') }}
run: |
Expand Down Expand Up @@ -162,7 +170,55 @@ jobs:
target: ${{ matrix.platform.target }}
manylinux: auto
docker-options: ${{ matrix.platform.maturin_docker_options }}
args: --release --out dist
args: --release --out dist --no-default-features --features rustls-tls
- uses: uraimo/run-on-arch-action@v2
if: matrix.platform.arch != 'ppc64'
name: Test wheel
with:
arch: ${{ matrix.platform.arch }}
distro: ubuntu20.04
githubToken: ${{ github.token }}
install: |
apt-get update
apt-get install -y --no-install-recommends python3 python3-pip
pip3 install -U pip
run: |
pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links py-rattler/dist/ --force-reinstall
- name: "Upload wheels"
uses: actions/upload-artifact@v3
with:
name: wheels
path: py-rattler/dist

linux-cross-native-tls:
runs-on: ubuntu-latest
name: Build ${{ matrix.platform.target }}
strategy:
fail-fast: false
matrix:
platform:
- target: s390x-unknown-linux-gnu
arch: s390x
- target: powerpc64le-unknown-linux-gnu
arch: ppc64le
- target: powerpc64-unknown-linux-gnu
arch: ppc64

steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.sha }}
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: "Build wheels"
uses: PyO3/maturin-action@v1
with:
working-directory: py-rattler
target: ${{ matrix.platform.target }}
manylinux: auto
docker-options: ${{ matrix.platform.maturin_docker_options }}
args: --release --out dist --no-default-features --features native-tls
- uses: uraimo/run-on-arch-action@v2
if: matrix.platform.arch != 'ppc64'
name: Test wheel
Expand Down Expand Up @@ -199,22 +255,31 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- name: "Build wheels"
- name: "Build wheels (rustls-tls)"
if: ${{ !startsWith(matrix.platform.target, 'i686') }}
uses: PyO3/maturin-action@v1
with:
working-directory: py-rattler
target: ${{ matrix.target }}
manylinux: musllinux_1_2
args: --release --out dist --no-default-features --features rustls-tls
- name: "Build wheels (native-tls)"
if: ${{ startsWith(matrix.platform.target, 'i686') }}
uses: PyO3/maturin-action@v1
with:
working-directory: py-rattler
target: ${{ matrix.target }}
manylinux: musllinux_1_2
args: --release --out dist
args: --release --out dist --no-default-features --features native-tls
- name: "Test wheel"
if: matrix.target == 'x86_64-unknown-linux-musl'
uses: addnab/docker-run-action@v3
with:
image: alpine:latest
options: -v ${{ github.workspace }}:/py-rattler -w /py-rattler
options: -v ${{ github.workspace }}/py-rattler:/py-rattler -w /py-rattler
run: |
apk add py3-pip
pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links /py-rattler/dist/ --force-reinstall
pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links dist/ --force-reinstall
- name: "Upload wheels"
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -246,7 +311,7 @@ jobs:
working-directory: py-rattler
target: ${{ matrix.platform.target }}
manylinux: musllinux_1_2
args: --release --out dist
args: --release --out dist --no-default-features --features rustls-tls
docker-options: ${{ matrix.platform.maturin_docker_options }}
- uses: uraimo/run-on-arch-action@v2
name: Test wheel
Expand Down Expand Up @@ -280,7 +345,7 @@ jobs:
with:
working-directory: py-rattler
target: x86_64
args: --release --out dist
args: --release --out dist --no-default-features --features rustls-tls
- name: "Test wheel - x86_64"
run: |
pip install py-rattler/dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
Expand All @@ -304,7 +369,7 @@ jobs:
- name: "Build wheels - universal2"
uses: PyO3/maturin-action@v1
with:
args: --release --target universal2-apple-darwin --out dist
args: --release --target universal2-apple-darwin --out dist --no-default-features --features rustls-tls
working-directory: py-rattler
- name: "Test wheel - universal2"
run: |
Expand Down
7 changes: 6 additions & 1 deletion py-rattler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ crate-type = ["cdylib"]
anyhow = "1.0.75"
futures = "0.3.28"

[features]
default = ["native-tls"]
native-tls = ["rattler_networking/native-tls", "rattler_repodata_gateway/native-tls"]
rustls-tls = ["rattler_networking/rustls-tls", "rattler_repodata_gateway/rustls-tls"]

rattler = { path = "../crates/rattler", default-features = false }
rattler_repodata_gateway = { path = "../crates/rattler_repodata_gateway", default-features = false, features = [
"sparse",
] }
rattler_conda_types = { path = "../crates/rattler_conda_types", default-features = false }
rattler_networking = { path = "../crates/rattler_networking", default-features = false, features = ["rustls-tls"] }
rattler_networking = { path = "../crates/rattler_networking", default-features = false }
rattler_shell = { path = "../crates/rattler_shell", default-features = false }
rattler_virtual_packages = { path = "../crates/rattler_virtual_packages", default-features = false }
rattler_solve = { path = "../crates/rattler_solve", default-features = false, features = ["resolvo"] }
Expand Down

0 comments on commit 4dfc7c3

Please sign in to comment.