summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-01-26 23:30:47 +0100
committerGitHub <noreply@github.com>2021-01-26 22:30:47 +0000
commita8844843a6751ae77697a731abffc50402cf008e (patch)
tree852b34239e4c66e62a12c8bb93a1843ebfe042d2
parent4487c16c8e72c24d62da589a7bf7c1e3666013a6 (diff)
ci: Also build/publish 32-bit wheels (#26)
Closes #25
-rw-r--r--.github/workflows/ci.yml48
-rwxr-xr-xci/set-target.sh40
2 files changed, 84 insertions, 4 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 61042a8..68e1a10 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -41,8 +41,21 @@ jobs:
41 strategy: 41 strategy:
42 fail-fast: false 42 fail-fast: false
43 matrix: 43 matrix:
44 rust-toolchain: [1.45, nightly]
44 python-version: [3.6, 3.7, 3.8, 3.9] 45 python-version: [3.6, 3.7, 3.8, 3.9]
45 os: [ubuntu-latest, macos-latest, windows-latest] 46 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
46 59
47 steps: 60 steps:
48 - name: Checkout 61 - name: Checkout
@@ -51,22 +64,35 @@ jobs:
51 - uses: actions/setup-python@v2 64 - uses: actions/setup-python@v2
52 with: 65 with:
53 python-version: ${{ matrix.python-version }} 66 python-version: ${{ matrix.python-version }}
67 architecture: ${{ matrix.architecture }}
54 68
55 - name: Install dependencies 69 - name: Install dependencies
56 run: | 70 run: |
57 python -m pip install --upgrade pip 71 python -m pip install --upgrade pip
58 pip install poetry 72 pip install poetry
59 poetry install 73 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
61 uses: actions-rs/toolchain@v1 80 uses: actions-rs/toolchain@v1
62 with: 81 with:
63 toolchain: nightly 82 toolchain: ${{ matrix.rust-toolchain }}
83 target: ${{ env.ACTIONS_RUST_TARGET }}
64 override: true 84 override: true
65 85
66 - name: Build Python package 86 - 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
68 93
69 - name: Run Python tests 94 - name: Run Python tests
95 if: matrix.architecture != 'x86'
70 run: poetry run pytest -vv --color=yes 96 run: poetry run pytest -vv --color=yes
71 97
72 python-publish: 98 python-publish:
@@ -77,17 +103,31 @@ jobs:
77 matrix: 103 matrix:
78 python-version: [3.6, 3.7, 3.8, 3.9] 104 python-version: [3.6, 3.7, 3.8, 3.9]
79 os: [ubuntu-latest, macos-latest, windows-latest] 105 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
80 steps: 114 steps:
81 - uses: actions/checkout@v1 115 - uses: actions/checkout@v1
82 116
83 - uses: actions/setup-python@v2 117 - uses: actions/setup-python@v2
84 with: 118 with:
85 python-version: ${{ matrix.python-version }} 119 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
86 125
87 - name: Install latest nightly 126 - name: Install latest nightly
88 uses: actions-rs/toolchain@v1 127 uses: actions-rs/toolchain@v1
89 with: 128 with:
90 toolchain: nightly 129 toolchain: nightly
130 target: ${{ env.ACTIONS_RUST_TARGET }}
91 override: true 131 override: true
92 132
93 - name: Install dependencies 133 - name: Install dependencies
@@ -96,7 +136,7 @@ jobs:
96 pip install poetry 136 pip install poetry
97 poetry install 137 poetry install
98 - name: Build Python package 138 - 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 }}
100 140
101 - name: List wheels 141 - name: List wheels
102 if: matrix.os == 'windows-latest' 142 if: matrix.os == 'windows-latest'
diff --git a/ci/set-target.sh b/ci/set-target.sh
new file mode 100755
index 0000000..f0dfbf0
--- /dev/null
+++ b/ci/set-target.sh
@@ -0,0 +1,40 @@
1#!/bin/sh
2
3if [ "$#" -ne 2 ]; then
4 echo "Usage: $0 OS ARCHITECTURE" >&2
5 exit 1
6fi
7
8os=$1
9architecture=$2
10
11output() {
12 echo "Setting ACTIONS_RUST_TARGET=$1"
13 echo "ACTIONS_RUST_TARGET=$1" >> "$GITHUB_ENV"
14 exit 0
15}
16
17if [ "$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
28elif [ "$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
37else
38 echo "Bad architecture: $architecture"
39 exit 1
40fi