13 - uses: actions/checkout@v3
15 - name: Install rustfmt
17 rustup component add rustfmt
22 rustfmt --check build_system/mod.rs
25 runs-on: ${{ matrix.os }}
32 - os: ubuntu-20.04 # FIXME switch to ubuntu-22.04 once #1303 is fixed
34 TARGET_TRIPLE: x86_64-unknown-linux-gnu
37 TARGET_TRIPLE: x86_64-apple-darwin
38 # cross-compile from Linux to Windows using mingw
41 TARGET_TRIPLE: x86_64-pc-windows-gnu
44 TARGET_TRIPLE: aarch64-unknown-linux-gnu
45 # s390x requires QEMU 6.1 or greater, we could build it from source, but ubuntu 22.04 comes with 6.2 by default
48 TARGET_TRIPLE: s390x-unknown-linux-gnu
51 - uses: actions/checkout@v3
53 - name: Cache cargo installed crates
54 uses: actions/cache@v3
57 key: ${{ runner.os }}-cargo-installed-crates
59 - name: Cache cargo registry and index
60 uses: actions/cache@v3
65 key: ${{ runner.os }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
67 - name: Cache cargo target dir
68 uses: actions/cache@v3
71 key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
73 - name: Install MinGW toolchain and wine
74 if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
77 sudo apt-get install -y gcc-mingw-w64-x86-64 wine-stable
78 rustup target add x86_64-pc-windows-gnu
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: Prepare dependencies
95 - name: Build without unstable features
97 TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
98 # This is the config rust-lang/rust uses for builds
99 run: ./y.rs build --no-unstable-features
102 run: ./y.rs build --sysroot none
106 TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
108 # Enable backtraces for easier debugging
109 export RUST_BACKTRACE=1
111 # Reduce amount of benchmark runs as they are slow
112 export COMPILE_RUNS=2
115 # Enable extra checks
116 export CG_CLIF_ENABLE_VERIFIER=1
120 - name: Package prebuilt cg_clif
121 run: tar cvfJ cg_clif.tar.xz dist
123 - name: Upload prebuilt cg_clif
124 if: matrix.env.TARGET_TRIPLE != 'x86_64-pc-windows-gnu'
125 uses: actions/upload-artifact@v2
127 name: cg_clif-${{ matrix.env.TARGET_TRIPLE }}
130 - name: Upload prebuilt cg_clif (cross compile)
131 if: matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
132 uses: actions/upload-artifact@v3
134 name: cg_clif-${{ runner.os }}-cross-x86_64-mingw
138 runs-on: ${{ matrix.os }}
145 # Native Windows build with MSVC
148 TARGET_TRIPLE: x86_64-pc-windows-msvc
149 # cross-compile from Windows to Windows MinGW
152 TARGET_TRIPLE: x86_64-pc-windows-gnu
155 - uses: actions/checkout@v3
157 - name: Cache cargo installed crates
158 uses: actions/cache@v3
161 key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-installed-crates
163 - name: Cache cargo registry and index
164 uses: actions/cache@v3
169 key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
171 - name: Cache cargo target dir
172 uses: actions/cache@v3
175 key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
177 - name: Set MinGW as the default toolchain
178 if: matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
179 run: rustup set default-host x86_64-pc-windows-gnu
181 - name: Prepare dependencies
183 git config --global core.autocrlf false
184 rustc y.rs -o y.exe -g
187 - name: Build without unstable features
189 TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
190 # This is the config rust-lang/rust uses for builds
191 run: ./y.rs build --no-unstable-features
194 run: ./y.rs build --sysroot none
198 # Enable backtraces for easier debugging
199 $Env:RUST_BACKTRACE=1
201 # Reduce amount of benchmark runs as they are slow
205 # Enable extra checks
206 $Env:CG_CLIF_ENABLE_VERIFIER=1
208 # WIP Disable some tests
210 # This fails due to some weird argument handling by hyperfine, not an actual regression
211 # more of a build system issue
212 (Get-Content config.txt) -replace '(bench.simple-raytracer)', '# $1' | Out-File config.txt
214 # This fails with a different output than expected
215 (Get-Content config.txt) -replace '(test.regex-shootout-regex-dna)', '# $1' | Out-File config.txt
219 - name: Package prebuilt cg_clif
220 # don't use compression as xzip isn't supported by tar on windows and bzip2 hangs
221 run: tar cvf cg_clif.tar dist
223 - name: Upload prebuilt cg_clif
224 uses: actions/upload-artifact@v3
226 name: cg_clif-${{ matrix.env.TARGET_TRIPLE }}