-
-
Notifications
You must be signed in to change notification settings - Fork 554
120 lines (104 loc) · 3.73 KB
/
pypi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: pypi
on:
workflow_dispatch:
push:
tags:
- "*"
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
arch: [main, alt]
include:
- os: ubuntu-latest
platform: linux
- os: windows-latest
ls: dir
- os: macos-latest
arch: alt
alt_arch_name: arm64
- os: ubuntu-latest
platform: linux
alt_arch_name: aarch64
exclude:
- os: windows-latest
arch: alt
- os: macos-latest
arch: alt
- os: ubuntu-latest
arch: alt
steps:
- uses: actions/checkout@v3
- name: set up rust
if: matrix.os != 'ubuntu-latest'
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- run: rustup target add aarch64-apple-darwin
if: matrix.os == 'macos-latest'
- run: rustup toolchain install stable-i686-pc-windows-msvc
if: matrix.os == 'windows-latest'
- run: rustup target add i686-pc-windows-msvc
if: matrix.os == 'windows-latest'
- name: Set up QEMU
if: matrix.os == 'ubuntu-latest'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*"
CIBW_BEFORE_BUILD: >
pip install setuptools-rust cython &&
rustup default nightly &&
rustup show
# rust doesn't seem to be available for musl linux on i686
CIBW_SKIP: "*-musllinux_i686"
# we build for "alt_arch_name" if it exists, else 'auto
CIBW_ARCHS: ${{ matrix.alt_arch_name || 'auto' }}
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014"
CIBW_MUSLLINUX_X86_64_IMAGE: "musllinux_1_1"
CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux2014"
CIBW_MUSLLINUX_AARCH64_IMAGE: "musllinux_1_1"
CIBW_ENVIRONMENT: 'PATH="$HOME/.cargo/bin:$PATH"'
# Fix the following error: error: cargo rustc --lib --message-format=json-render-diagnostics --manifest-path Cargo.toml --release -v --features pyo3/extension-module -- --crate-type cdylibfailed with code -9
# You need to set a second environment variable CARGO_NET_GIT_FETCH_WITH_CLI="true" for linux environments
# Solutio found here: https://github.com/rust-lang/cargo/issues/10583
CIBW_ENVIRONMENT_LINUX: 'PATH="$HOME/.cargo/bin:$PATH" CARGO_NET_GIT_FETCH_WITH_CLI="true"'
CIBW_MANYLINUX_I686_IMAGE: "manylinux2014"
CIBW_ENVIRONMENT_WINDOWS: 'PATH="$UserProfile\.cargo\bin;$PATH"'
CIBW_BEFORE_BUILD_LINUX: >
pip install cython numpy setuptools wheel setuptools-rust &&
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=nightly --profile=minimal -y &&
rustup show
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: poetry build
- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist
- uses: pypa/[email protected]
with:
user: ${{ secrets.pypi_user }}
password: ${{ secrets.pypi_password }}