13 - uses: actions/checkout@v3
15 - name: Install rustfmt
17 rustup component add rustfmt
24 runs-on: ${{ matrix.os }}
33 TARGET_TRIPLE: x86_64-unknown-linux-gnu
36 TARGET_TRIPLE: x86_64-apple-darwin
37 # cross-compile from Linux to Windows using mingw
40 TARGET_TRIPLE: x86_64-pc-windows-gnu
43 TARGET_TRIPLE: aarch64-unknown-linux-gnu
46 - uses: actions/checkout@v3
48 - name: Cache cargo installed crates
49 uses: actions/cache@v2
52 key: ${{ runner.os }}-cargo-installed-crates
54 - name: Cache cargo registry and index
55 uses: actions/cache@v2
60 key: ${{ runner.os }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
62 - name: Cache cargo target dir
63 uses: actions/cache@v2
66 key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
68 - name: Install MinGW toolchain and wine
69 if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
72 sudo apt-get install -y gcc-mingw-w64-x86-64 wine-stable
73 rustup target add x86_64-pc-windows-gnu
75 - name: Install AArch64 toolchain and qemu
76 if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'aarch64-unknown-linux-gnu'
79 sudo apt-get install -y gcc-aarch64-linux-gnu qemu-user
81 - name: Prepare dependencies
83 git config --global user.email "user@example.com"
84 git config --global user.name "User"
87 - name: Build without unstable features
89 TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
90 # This is the config rust-lang/rust uses for builds
91 run: ./y.rs build --no-unstable-features
94 run: ./y.rs build --sysroot none
98 TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
100 # Enable backtraces for easier debugging
101 export RUST_BACKTRACE=1
103 # Reduce amount of benchmark runs as they are slow
104 export COMPILE_RUNS=2
107 # Enable extra checks
108 export CG_CLIF_ENABLE_VERIFIER=1
112 - name: Package prebuilt cg_clif
113 run: tar cvfJ cg_clif.tar.xz build
115 - name: Upload prebuilt cg_clif
116 if: matrix.env.TARGET_TRIPLE != 'x86_64-pc-windows-gnu'
117 uses: actions/upload-artifact@v2
119 name: cg_clif-${{ matrix.env.TARGET_TRIPLE }}
122 - name: Upload prebuilt cg_clif (cross compile)
123 if: matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
124 uses: actions/upload-artifact@v2
126 name: cg_clif-${{ runner.os }}-cross-x86_64-mingw
130 runs-on: ${{ matrix.os }}
137 # Native Windows build with MSVC
140 TARGET_TRIPLE: x86_64-pc-windows-msvc
141 # cross-compile from Windows to Windows MinGW
144 TARGET_TRIPLE: x86_64-pc-windows-gnu
147 - uses: actions/checkout@v3
149 - name: Cache cargo installed crates
150 uses: actions/cache@v2
153 key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-installed-crates
155 - name: Cache cargo registry and index
156 uses: actions/cache@v2
161 key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
163 - name: Cache cargo target dir
164 uses: actions/cache@v2
167 key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
169 - name: Set MinGW as the default toolchain
170 if: matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
171 run: rustup set default-host x86_64-pc-windows-gnu
173 - name: Prepare dependencies
175 git config --global user.email "user@example.com"
176 git config --global user.name "User"
177 git config --global core.autocrlf false
178 rustc y.rs -o y.exe -g
181 - name: Build without unstable features
183 TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
184 # This is the config rust-lang/rust uses for builds
185 run: ./y.rs build --no-unstable-features
188 run: ./y.rs build --sysroot none
192 # Enable backtraces for easier debugging
193 $Env:RUST_BACKTRACE=1
195 # Reduce amount of benchmark runs as they are slow
199 # Enable extra checks
200 $Env:CG_CLIF_ENABLE_VERIFIER=1
202 # WIP Disable some tests
204 # This fails due to some weird argument handling by hyperfine, not an actual regression
205 # more of a build system issue
206 (Get-Content config.txt) -replace '(bench.simple-raytracer)', '# $1' | Out-File config.txt
208 # This fails with a different output than expected
209 (Get-Content config.txt) -replace '(test.regex-shootout-regex-dna)', '# $1' | Out-File config.txt
213 - name: Package prebuilt cg_clif
214 # don't use compression as xzip isn't supported by tar on windows and bzip2 hangs
215 run: tar cvf cg_clif.tar build
217 - name: Upload prebuilt cg_clif
218 uses: actions/upload-artifact@v2
220 name: cg_clif-${{ matrix.env.TARGET_TRIPLE }}