1+ name : pypi
2+
3+ on :
4+ workflow_dispatch :
5+ push :
6+ tags :
7+ - " *"
8+
9+ jobs :
10+ build_linux_wheels :
11+ name : Build ${{ matrix.linux_tag }} wheels with cp${{ matrix.python-version }}
12+ runs-on : ubuntu-latest
13+ strategy :
14+ matrix :
15+ linux_tag : ["manylinux", "musllinux"]
16+ python-version : ["310", "311", "312", "313"]
17+ steps :
18+ - uses : actions/checkout@v4
19+ - name : Set up QEMU
20+ uses : docker/setup-qemu-action@v3
21+ with :
22+ platforms : all
23+ - name : Build wheels
24+ 25+ timeout-minutes : 720
26+ env :
27+ CIBW_BUILD : " cp${{ matrix.python-version }}-${{ matrix.linux_tag }}_*"
28+ CIBW_ARCHS_LINUX : " x86_64 i686 aarch64"
29+ CIBW_SKIP : " *-musllinux_i686"
30+ CIBW_MANYLINUX_X86_64_IMAGE : " manylinux2014"
31+ CIBW_MANYLINUX_I686_IMAGE : " manylinux2014"
32+ CIBW_MANYLINUX_AARCH64_IMAGE : " manylinux2014"
33+ CIBW_MUSLLINUX_X86_64_IMAGE : " musllinux_1_1"
34+ CIBW_MUSLLINUX_I686_IMAGE : " musllinux_1_1"
35+ CIBW_MUSLLINUX_AARCH64_IMAGE : " musllinux_1_1"
36+ CIBW_ENVIRONMENT : ' PATH="$HOME/.cargo/bin:$PATH"'
37+ CIBW_ENVIRONMENT_LINUX : ' PATH="$HOME/.cargo/bin:$PATH" CARGO_NET_GIT_FETCH_WITH_CLI="true"'
38+ CIBW_BEFORE_BUILD : >
39+ rustup default nightly &&
40+ rustup show
41+ CIBW_BEFORE_BUILD_LINUX : >
42+ curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=nightly --profile=minimal -y &&
43+ rustup show
44+ - uses : actions/upload-artifact@v4
45+ with :
46+ name : artifact-${{ matrix.linux_tag }}-cp${{ matrix.python-version }}
47+ path : ./wheelhouse/*.whl
48+
49+ build_macos_wheels :
50+ name : Build wheels on ${{ matrix.os }}
51+ runs-on : ${{ matrix.os }}
52+ strategy :
53+ matrix :
54+ os : [macos-13, macos-14]
55+ steps :
56+ - uses : actions/checkout@v4
57+ - name : Set up rust
58+ uses : dtolnay/rust-toolchain@stable
59+ with :
60+ toolchain : nightly
61+ - run : rustup target add aarch64-apple-darwin && rustup target add x86_64-apple-darwin
62+ - name : Build wheels
63+ 64+ timeout-minutes : 720
65+ env :
66+ CIBW_BUILD : " cp310-* cp311-* cp312-* cp313-*"
67+ CIBW_ARCHS_MACOS : " universal2"
68+ # arm64 and universal2 wheels are tagged with x86_64 because there's an issue with Poetry
69+ # More information here: https://cibuildwheel.readthedocs.io/en/stable/faq/#how-to-cross-compile (CTRL + F "poetry")
70+ # https://github.com/pypa/cibuildwheel/issues/1415
71+ CIBW_REPAIR_WHEEL_COMMAND_MACOS : >
72+ ls {dest_dir} &&
73+ delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} &&
74+ for file in {dest_dir}/*.whl ; do mv $file ${file//x86_64/universal2} ; done
75+ CIBW_ENVIRONMENT : ' PATH="$HOME/.cargo/bin:$PATH"'
76+ CIBW_BEFORE_BUILD : >
77+ rustup default nightly &&
78+ rustup show
79+ - uses : actions/upload-artifact@v4
80+ with :
81+ name : artifact-${{ matrix.os }}
82+ path : ./wheelhouse/*.whl
83+
84+ build_windows_wheels :
85+ name : Build wheels on ${{ matrix.os }}
86+ runs-on : ${{ matrix.os }}
87+ strategy :
88+ matrix :
89+ os : [windows-2019, windows-2022]
90+ steps :
91+ - uses : actions/checkout@v4
92+ - name : Set up rust
93+ uses : dtolnay/rust-toolchain@stable
94+ with :
95+ toolchain : nightly
96+ - run : rustup toolchain install stable-i686-pc-windows-msvc
97+ - run : rustup target add i686-pc-windows-msvc
98+ - name : Build wheels
99+ 100+ timeout-minutes : 720
101+ env :
102+ CIBW_BUILD : " cp310-* cp311-* cp312-* cp313-*"
103+ CIBW_ARCHS_WINDOWS : " AMD64 x86"
104+ CIBW_ENVIRONMENT : ' PATH="$HOME/.cargo/bin:$PATH"'
105+ CIBW_ENVIRONMENT_WINDOWS : ' PATH="$UserProfile\.cargo\bin;$PATH"'
106+ CIBW_BEFORE_BUILD : >
107+ rustup default nightly &&
108+ rustup show
109+ - uses : actions/upload-artifact@v4
110+ with :
111+ name : artifact-${{ matrix.os }}
112+ path : ./wheelhouse/*.whl
113+
114+ build_sdist :
115+ name : Build source distribution
116+ # Can't use more than 12 jobs in parallel
117+ needs : [build_macos_wheels]
118+ runs-on : ubuntu-latest
119+ steps :
120+ - uses : actions/checkout@v4
121+
122+ - name : Build River
123+ uses : ./.github/actions/install-env
124+ with :
125+ python-version : " 3.13"
126+
127+ - name : Build dist
128+ run : poetry build
129+
130+ - uses : actions/upload-artifact@v4
131+ with :
132+ name : artifact-sdist
133+ path : dist/*.tar.gz
134+
135+ merge_artifacts :
136+ runs-on : ubuntu-latest
137+ needs : [build_linux_wheels, build_macos_wheels, build_windows_wheels, build_sdist]
138+ steps :
139+ - name : Merge Artifacts
140+ uses : actions/upload-artifact/merge@v4
141+ with :
142+ name : artifact
143+ pattern : artifact-*
144+
145+ upload_pypi :
146+ needs : merge_artifacts
147+ runs-on : ubuntu-latest
148+ steps :
149+ 150+ with :
151+ name : artifact
152+ path : dist
153+
154+ 155+ with :
156+ user : __token__
157+ password : ${{ secrets.PYPI_API_TOKEN }}
0 commit comments