4141strategy :
4242fail-fast :false
4343matrix :
44+ rust-toolchain :[1.45, nightly]
4445python-version :[3.6, 3.7, 3.8, 3.9]
4546os :[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
4760steps :
4861 -name :Checkout
@@ -51,22 +64,35 @@ jobs:
5164 -uses :actions/setup-python@v2
5265with :
5366python-version :${{ matrix.python-version }}
67+ architecture :${{ matrix.architecture }}
5468
5569 -name :Install dependencies
5670run :|
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
6180uses :actions-rs/toolchain@v1
6281with :
63- toolchain :nightly
82+ toolchain :${{ matrix.rust-toolchain }}
83+ target :${{ env.ACTIONS_RUST_TARGET }}
6484override :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'
7096run :poetry run pytest -vv --color=yes
7197
7298python-publish :
@@ -77,17 +103,31 @@ jobs:
77103matrix :
78104python-version :[3.6, 3.7, 3.8, 3.9]
79105os :[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+
80114steps :
81115 -uses :actions/checkout@v1
82116
83117 -uses :actions/setup-python@v2
84118with :
85119python-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
88127uses :actions-rs/toolchain@v1
89128with :
90129toolchain :nightly
130+ target :${{ env.ACTIONS_RUST_TARGET }}
91131override :true
92132
93133 -name :Install dependencies
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
102142if :matrix.os == 'windows-latest'