13 - uses: actions/checkout@v3
15 - name: Install rustfmt
17 rustup component add rustfmt
22 rustfmt --check build_system/mod.rs
26 runs-on: ${{ matrix.os }}
39 TARGET_TRIPLE: x86_64-unknown-linux-gnu
42 TARGET_TRIPLE: x86_64-apple-darwin
43 # cross-compile from Linux to Windows using mingw
46 TARGET_TRIPLE: x86_64-pc-windows-gnu
49 TARGET_TRIPLE: aarch64-unknown-linux-gnu
50 # s390x requires QEMU 6.1 or greater, we could build it from source, but ubuntu 22.04 comes with 6.2 by default
53 TARGET_TRIPLE: s390x-unknown-linux-gnu
56 TARGET_TRIPLE: x86_64-pc-windows-msvc
59 TARGET_TRIPLE: x86_64-pc-windows-gnu
62 - uses: actions/checkout@v3
64 - name: Cache cargo target dir
65 uses: actions/cache@v3
68 key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
70 - name: Set MinGW as the default toolchain
71 if: matrix.os == 'windows-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
72 run: rustup set default-host x86_64-pc-windows-gnu
74 - name: Install MinGW toolchain and wine
75 if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
78 sudo apt-get install -y gcc-mingw-w64-x86-64 wine-stable
80 - name: Install AArch64 toolchain and qemu
81 if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'aarch64-unknown-linux-gnu'
84 sudo apt-get install -y gcc-aarch64-linux-gnu qemu-user
86 - name: Install s390x toolchain and qemu
87 if: matrix.env.TARGET_TRIPLE == 's390x-unknown-linux-gnu'
90 sudo apt-get install -y gcc-s390x-linux-gnu qemu-user
92 - name: Use sparse cargo registry
94 cat >> ~/.cargo/config.toml <<EOF
96 sparse-registry = true
99 - name: Prepare dependencies
102 - name: Build without unstable features
104 TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
105 # This is the config rust-lang/rust uses for builds
106 run: ./y.rs build --no-unstable-features
109 run: ./y.rs build --sysroot none
113 TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
118 runs-on: ${{ matrix.os }}
131 TARGET_TRIPLE: x86_64-unknown-linux-gnu
134 TARGET_TRIPLE: x86_64-apple-darwin
137 TARGET_TRIPLE: x86_64-pc-windows-msvc
140 TARGET_TRIPLE: x86_64-pc-windows-gnu
143 - uses: actions/checkout@v3
145 - name: Cache cargo target dir
146 uses: actions/cache@v3
149 key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
151 - name: Set MinGW as the default toolchain
152 if: matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
153 run: rustup set default-host x86_64-pc-windows-gnu
155 - name: Use sparse cargo registry
157 cat >> ~/.cargo/config.toml <<EOF
159 sparse-registry = true
162 - name: Prepare dependencies
166 run: ./y.rs build --sysroot none
168 - name: Test abi-cafe
170 TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
175 runs-on: ubuntu-latest
183 - uses: actions/checkout@v3
185 - name: Cache cargo target dir
186 uses: actions/cache@v3
189 key: ${{ runner.os }}-x86_64-unknown-linux-gnu-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
191 - name: Cache cargo bin dir
192 uses: actions/cache@v3
195 key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-bin-dir-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
197 - name: Use sparse cargo registry
199 cat >> ~/.cargo/config.toml <<EOF
201 sparse-registry = true
204 - name: Install hyperfine
205 run: cargo install hyperfine || true
207 - name: Prepare dependencies
211 run: CI_OPT=1 ./y.rs build --sysroot none
214 run: CI_OPT=1 ./y.rs bench
218 runs-on: ${{ matrix.os }}
229 # FIXME update at some point in the future once most distros use a newer glibc
232 TARGET_TRIPLE: x86_64-unknown-linux-gnu
235 TARGET_TRIPLE: x86_64-apple-darwin
236 # cross-compile from Linux to Windows using mingw
239 TARGET_TRIPLE: x86_64-pc-windows-gnu
242 TARGET_TRIPLE: x86_64-pc-windows-msvc
245 TARGET_TRIPLE: x86_64-pc-windows-gnu
248 - uses: actions/checkout@v3
250 - name: Cache cargo target dir
251 uses: actions/cache@v3
254 key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-dist-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
256 - name: Set MinGW as the default toolchain
257 if: matrix.os == 'windows-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
258 run: rustup set default-host x86_64-pc-windows-gnu
260 - name: Install MinGW toolchain and wine
261 if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
264 sudo apt-get install -y gcc-mingw-w64-x86-64 wine-stable
266 - name: Use sparse cargo registry
268 cat >> ~/.cargo/config.toml <<EOF
270 sparse-registry = true
273 - name: Prepare dependencies
276 - name: Build backend
277 run: CI_OPT=1 ./y.rs build --sysroot none
279 - name: Build sysroot
280 run: CI_OPT=1 ./y.rs build
282 - name: Package prebuilt cg_clif
283 run: tar cvfJ cg_clif.tar.xz dist
285 - name: Upload prebuilt cg_clif
286 if: matrix.os == 'windows-latest' || matrix.env.TARGET_TRIPLE != 'x86_64-pc-windows-gnu'
287 uses: actions/upload-artifact@v3
289 name: cg_clif-${{ matrix.env.TARGET_TRIPLE }}
292 - name: Upload prebuilt cg_clif (cross compile)
293 if: matrix.os != 'windows-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
294 uses: actions/upload-artifact@v3
296 name: cg_clif-${{ runner.os }}-cross-x86_64-mingw