@@ -42,3 +42,289 @@ jobs:
4242 - name : before_cache_script
4343 run : rm -rf $CARGO_HOME/registry/index
4444
45+
46+ # Use cross for QEMU-based testing
47+ # cross needs to execute Docker, GitHub Action already has it installed
48+ cross :
49+ runs-on : ubuntu-20.04
50+ needs : [rustfmt, minver, macos, linux_native_builds, rust_stable]
51+ strategy :
52+ fail-fast : true
53+ matrix :
54+ target : [
55+ arm-unknown-linux-gnueabi,
56+ armv7-unknown-linux-gnueabihf,
57+ i686-unknown-linux-gnu,
58+ i686-unknown-linux-musl,
59+ mips-unknown-linux-gnu,
60+ mips64-unknown-linux-gnuabi64,
61+ mips64el-unknown-linux-gnuabi64,
62+ mipsel-unknown-linux-gnu,
63+ powerpc64le-unknown-linux-gnu,
64+ ]
65+
66+ steps :
67+ - name : checkout
68+ uses : actions/checkout@v4
69+
70+ - name : setup Rust
71+ uses : dtolnay/rust-toolchain@master
72+ with :
73+ toolchain : ' ${{ env.MSRV }}'
74+ components : clippy
75+
76+ # cross relies on docker or podman, GitHub Acton already has it installed.
77+ - name : setup cross
78+ run : cargo install cross --version 0.2.5
79+
80+ - name : build
81+ uses : ./.github/actions/build
82+ with :
83+ TARGET : ' ${{ matrix.target }}'
84+ TOOL : cross
85+
86+ - name : test
87+ uses : ./.github/actions/test
88+ with :
89+ TARGET : ' ${{ matrix.target }}'
90+ TOOL : cross
91+
92+ - name : before_cache_script
93+ run : rm -rf $CARGO_HOME/registry/index
94+
95+
96+
97+ # Tasks for Linux native builds
98+ # Only test x86_64 targets on GitHub Action, leave aarch64 one in Cirrus CI.
99+ linux_native_builds :
100+ runs-on : ubuntu-20.04
101+ strategy :
102+ fail-fast : true
103+ matrix :
104+ target : [
105+ x86_64-unknown-linux-gnu,
106+ x86_64-unknown-linux-musl,
107+ ]
108+
109+ steps :
110+ - name : checkout
111+ uses : actions/checkout@v4
112+
113+ - name : setup Rust
114+ uses : dtolnay/rust-toolchain@master
115+ with :
116+ toolchain : ' ${{ env.MSRV }}'
117+ components : clippy
118+
119+ - name : install targets
120+ run : rustup target add ${{ matrix.target }}
121+
122+ - name : build
123+ uses : ./.github/actions/build
124+ with :
125+ TARGET : ' ${{ matrix.TARGET }}'
126+
127+ - name : test
128+ uses : ./.github/actions/test
129+ with :
130+ TARGET : ' ${{ matrix.TARGET }}'
131+
132+ - name : before_cache_script
133+ run : rm -rf $CARGO_HOME/registry/index
134+
135+ rust_stable :
136+ runs-on : ubuntu-20.04
137+ env :
138+ TARGET : x86_64-unknown-linux-gnu
139+ steps :
140+ - name : checkout
141+ uses : actions/checkout@v4
142+
143+ - name : setup Rust
144+ uses : dtolnay/rust-toolchain@stable
145+ with :
146+ components : clippy
147+
148+ - name : build
149+ uses : ./.github/actions/build
150+ with :
151+ TARGET : ' ${{ env.TARGET }}'
152+
153+ - name : test
154+ uses : ./.github/actions/test
155+ with :
156+ TARGET : ' ${{ env.TARGET }}'
157+
158+ - name : before_cache_script
159+ run : rm -rf $CARGO_HOME/registry/index
160+
161+
162+
163+ # Tasks for cross-compiling, but no testing
164+ cross_compiling :
165+ runs-on : ubuntu-20.04
166+ needs : [rustfmt, minver, macos, linux_native_builds, rust_stable]
167+ env :
168+ BUILD : check
169+ strategy :
170+ fail-fast : true
171+ matrix :
172+ include :
173+ # Cross claims to support Android, but when it tries to run Nix's tests it
174+ # reports undefined symbol references.
175+ - target : aarch64-linux-android
176+ - target : arm-linux-androideabi
177+ - target : armv7-linux-androideabi
178+ - target : i686-linux-android
179+ - target : x86_64-linux-android
180+ - target : arm-unknown-linux-musleabi
181+ - target : x86_64-unknown-fuchsia
182+ - target : x86_64-unknown-illumos
183+ # Cross claims to support running tests on iOS, but it actually doesn't.
184+ # https://github.com/rust-embedded/cross/issues/535
185+ - target : aarch64-apple-ios
186+ # cargo hack tries to invoke the iphonesimulator SDK for iOS
187+ NOHACK : true
188+ # Cross claims to support Linux powerpc64, but it really doesn't.
189+ # https://github.com/rust-embedded/cross/issues/441
190+ - target : powerpc64-unknown-linux-gnu
191+ - target : s390x-unknown-linux-gnu
192+ - target : x86_64-unknown-linux-gnux32
193+ - target : x86_64-unknown-netbsd
194+
195+ steps :
196+ - name : checkout
197+ uses : actions/checkout@v4
198+
199+ - name : setup Rust
200+ uses : dtolnay/rust-toolchain@master
201+ with :
202+ toolchain : ' ${{ env.MSRV }}'
203+ components : clippy
204+
205+ - name : install targets
206+ run : rustup target add ${{ matrix.target }}
207+
208+ - name : build
209+ uses : ./.github/actions/build
210+ with :
211+ TARGET : ' ${{ matrix.target }}'
212+ BUILD : ' ${{ env.BUILD }}'
213+ NOHACK : ' ${{ matrix.NOHACK }}'
214+
215+ - name : before_cache_script
216+ run : rm -rf $CARGO_HOME/registry/index
217+
218+
219+ redox :
220+ runs-on : ubuntu-20.04
221+ needs : [rustfmt, minver, macos, linux_native_builds, rust_stable]
222+ env :
223+ TARGET : x86_64-unknown-redox
224+ CLIPPYFLAGS : -D warnings
225+ BUILD : check
226+ steps :
227+ - name : checkout
228+ uses : actions/checkout@v4
229+
230+ - name : setup Rust
231+ # Redox's MSRV policy is unclear. Until they define it, use nightly.
232+ uses : dtolnay/rust-toolchain@nightly
233+ with :
234+ components : clippy
235+
236+ - name : install targets
237+ run : rustup target add ${{ env.TARGET }}
238+
239+ - name : build
240+ uses : ./.github/actions/build
241+ with :
242+ TARGET : ' ${{ env.TARGET }}'
243+ BUILD : ' ${{ env.BUILD }}'
244+ CLIPPYFLAGS : ' ${{ env.CLIPPYFLAGS }}'
245+
246+ - name : before_cache_script
247+ run : rm -rf $CARGO_HOME/registry/index
248+
249+
250+
251+ # Rust Tier 3 targets can't use Rustup
252+ tier3 :
253+ runs-on : ubuntu-20.04
254+ env :
255+ BUILD : check
256+ ZFLAGS : -Zbuild-std
257+ CLIPPYFLAGS : -D warnings
258+ strategy :
259+ fail-fast : true
260+ matrix :
261+ include :
262+ - target : x86_64-unknown-dragonfly
263+ - target : x86_64-unknown-openbsd
264+ - target : armv7-unknown-linux-uclibceabihf
265+ - target : x86_64-unknown-haiku
266+ steps :
267+ - name : checkout
268+ uses : actions/checkout@v4
269+
270+ - name : setup Rust
271+ uses : dtolnay/rust-toolchain@nightly
272+ with :
273+ components : clippy
274+
275+ - name : install src
276+ run : rustup component add rust-src
277+
278+ - name : build
279+ uses : ./.github/actions/build
280+ with :
281+ TARGET : ' ${{ matrix.target }}'
282+ BUILD : ' ${{ env.BUILD }}'
283+ ZFLAGS : ' ${{ env.ZFLAGS }}'
284+ CLIPPYFLAGS : ' ${{ env.CLIPPYFLAGS }}'
285+
286+ - name : before_cache_script
287+ run : rm -rf $CARGO_HOME/registry/index
288+
289+
290+ # Test that we can build with the lowest version of all dependencies.
291+ # "cargo test" doesn't work because some of our dev-dependencies, like
292+ # rand, can't build with their own minimal dependencies.
293+ minver :
294+ runs-on : ubuntu-20.04
295+ env :
296+ TARGET : x86_64-unknown-linux-gnu
297+ steps :
298+ - name : checkout
299+ uses : actions/checkout@v4
300+
301+ - name : setup Rust
302+ uses : dtolnay/rust-toolchain@nightly
303+
304+ - name : setup
305+ run : cargo update -Zminimal-versions
306+
307+ - name : check
308+ run : cargo check
309+
310+ - name : before_cache_script
311+ run : rm -rf $CARGO_HOME/registry/index
312+
313+ # Tasks that checks if the code is formatted right using `cargo fmt` tool
314+ rustfmt :
315+ runs-on : ubuntu-20.04
316+ steps :
317+ - name : Checkout
318+ uses : actions/checkout@v4
319+
320+ - name : Setup Rust
321+ uses : dtolnay/rust-toolchain@stable
322+ with :
323+ components : rustfmt
324+
325+ - name : Check format
326+ run : cargo fmt --all -- --check **/*.rs
327+
328+ - name : before_cache_script
329+ run : rm -rf $CARGO_HOME/registry/index
330+
0 commit comments