Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita884484

Browse files
authored
ci: Also build/publish 32-bit wheels (#26)
Closes#25
1 parent4487c16 commita884484

File tree

2 files changed

+84
-4
lines changed

2 files changed

+84
-4
lines changed

‎.github/workflows/ci.yml‎

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,21 @@ jobs:
4141
strategy:
4242
fail-fast:false
4343
matrix:
44+
rust-toolchain:[1.45, nightly]
4445
python-version:[3.6, 3.7, 3.8, 3.9]
4546
os:[ubuntu-latest, macos-latest, windows-latest]
47+
architecture:[x86, x64]
48+
exclude:
49+
# Only build 32-bit for Windows
50+
-os:macos-latest
51+
architecture:x86
52+
-os:ubuntu-latest
53+
architecture:x86
54+
# Only build on Rust 1.45 on Linux
55+
-os:macos-latest
56+
rust-toolchain:1.45
57+
-os:windows-latest
58+
rust-toolchain:1.45
4659

4760
steps:
4861
-name:Checkout
@@ -51,22 +64,35 @@ jobs:
5164
-uses:actions/setup-python@v2
5265
with:
5366
python-version:${{ matrix.python-version }}
67+
architecture:${{ matrix.architecture }}
5468

5569
-name:Install dependencies
5670
run:|
5771
python -m pip install --upgrade pip
5872
pip install poetry
5973
poetry install
60-
-name:Install latest nightly
74+
75+
-name:Set Rust target environment variable
76+
run:bash ci/set-target.sh ${{ matrix.os }} ${{ matrix.architecture }}
77+
shell:bash
78+
79+
-name:Install Rust
6180
uses:actions-rs/toolchain@v1
6281
with:
63-
toolchain:nightly
82+
toolchain:${{ matrix.rust-toolchain }}
83+
target:${{ env.ACTIONS_RUST_TARGET }}
6484
override:true
6585

6686
-name:Build Python package
67-
run:poetry run maturin develop --release
87+
if:matrix.architecture == 'x86'
88+
run:poetry run maturin build --target ${{ env.ACTIONS_RUST_TARGET }}
89+
90+
-name:Build Python package
91+
if:matrix.architecture != 'x86'
92+
run:poetry run maturin develop
6893

6994
-name:Run Python tests
95+
if:matrix.architecture != 'x86'
7096
run:poetry run pytest -vv --color=yes
7197

7298
python-publish:
@@ -77,17 +103,31 @@ jobs:
77103
matrix:
78104
python-version:[3.6, 3.7, 3.8, 3.9]
79105
os:[ubuntu-latest, macos-latest, windows-latest]
106+
architecture:[x86, x64]
107+
exclude:
108+
# Only build 32-bit for Windows
109+
-os:macos-latest
110+
architecture:x86
111+
-os:ubuntu-latest
112+
architecture:x86
113+
80114
steps:
81115
-uses:actions/checkout@v1
82116

83117
-uses:actions/setup-python@v2
84118
with:
85119
python-version:${{ matrix.python-version }}
120+
architecture:${{ matrix.architecture }}
121+
122+
-name:Set Rust target environment variable
123+
run:bash ci/set-target.sh ${{ matrix.os }} ${{ matrix.architecture }}
124+
shell:bash
86125

87126
-name:Install latest nightly
88127
uses:actions-rs/toolchain@v1
89128
with:
90129
toolchain:nightly
130+
target:${{ env.ACTIONS_RUST_TARGET }}
91131
override:true
92132

93133
-name:Install dependencies
@@ -96,7 +136,7 @@ jobs:
96136
pip install poetry
97137
poetry install
98138
-name:Build Python package
99-
run:poetry run maturin build --release --no-sdist --strip --interpreter python${{matrix.python_version}}
139+
run:poetry run maturin build --release --no-sdist --strip --interpreter python${{matrix.python_version}} --target ${{ env.ACTIONS_RUST_TARGET }}
100140

101141
-name:List wheels
102142
if:matrix.os == 'windows-latest'

‎ci/set-target.sh‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/sh
2+
3+
if ["$#"-ne 2 ];then
4+
echo"Usage:$0 OS ARCHITECTURE">&2
5+
exit 1
6+
fi
7+
8+
os=$1
9+
architecture=$2
10+
11+
output() {
12+
echo"Setting ACTIONS_RUST_TARGET=$1"
13+
echo"ACTIONS_RUST_TARGET=$1">>"$GITHUB_ENV"
14+
exit 0
15+
}
16+
17+
if ["$architecture"="x64" ];then
18+
if ["$os"="ubuntu-latest" ];then
19+
output"x86_64-unknown-linux-gnu"
20+
elif ["$os"="macos-latest" ];then
21+
output"x86_64-apple-darwin"
22+
elif ["$os"="windows-latest" ];then
23+
output"x86_64-pc-windows-msvc"
24+
else
25+
echo"Unknown 64-bit OS:$os"
26+
exit 1
27+
fi
28+
elif ["$architecture"="x86" ];then
29+
if ["$os"="ubuntu-latest" ];then
30+
output"i686-unknown-linux-gnu"
31+
elif ["$os"="windows-latest" ];then
32+
output"i686-pc-windows-msvc"
33+
else
34+
echo"Unknown 32-bit OS:$os"
35+
exit 1
36+
fi
37+
else
38+
echo"Bad architecture:$architecture"
39+
exit 1
40+
fi

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp