|
| 1 | +name: CI with the cg_gcc distributed by rustup |
| 2 | + |
| 3 | +# FIXME: run nightly (`schedule: - cron: "0 4 * * *"`) once this workflow tests the cg_gcc sources |
| 4 | +# of the rust-lang/rust commit of the nightly instead of the ones of this repository. |
| 5 | +on: workflow_dispatch |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + |
| 10 | +env: |
| 11 | + # Enable backtraces for easier debugging |
| 12 | + RUST_BACKTRACE: 1 |
| 13 | + # For the run-make tests. |
| 14 | + LLVM_BIN_DIR: /usr/bin |
| 15 | + |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + runs-on: ubuntu-24.04 |
| 19 | + # Above 3 times the longest job, so that a hang cannot run until GitHub's 6-hour limit. |
| 20 | + timeout-minutes: 90 |
| 21 | + |
| 22 | + strategy: |
| 23 | + fail-fast: false |
| 24 | + matrix: |
| 25 | + commands: [ |
| 26 | + "--std-tests --alloc-tests", |
| 27 | + # FIXME: re-enable asm tests when GCC can emit in the right syntax. |
| 28 | + # "--asm-tests", |
| 29 | + "--test-libcore", |
| 30 | + "--extended-rand-tests", |
| 31 | + "--extended-regex-example-tests --test-libcore-doctests", |
| 32 | + "--extended-regex-tests", |
| 33 | + "--test-successful-rustc --nb-parts 2 --current-part 0", |
| 34 | + "--test-successful-rustc --nb-parts 2 --current-part 1", |
| 35 | + "--librsvg-tests", |
| 36 | + "--projects --nb-parts 3 --current-part 0", |
| 37 | + "--projects --nb-parts 3 --current-part 1", |
| 38 | + "--projects --nb-parts 3 --current-part 2", |
| 39 | + "--gcc-asm-tests --test-release-libcore", |
| 40 | + ] |
| 41 | + # The tests that don't depend on the test command only run in the fastest job. |
| 42 | + include: |
| 43 | + - commands: "--extended-rand-tests" |
| 44 | + run_cargo_tests: true |
| 45 | + |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v4 |
| 48 | + |
| 49 | + # `rustup show` installs from rust-toolchain.toml |
| 50 | + - name: Setup rust toolchain |
| 51 | + run: rustup show |
| 52 | + |
| 53 | + - name: Use the cg_gcc distributed by rustup |
| 54 | + uses: ./.github/actions/rustup-cg-gcc |
| 55 | + |
| 56 | + - name: Setup rust cache |
| 57 | + uses: Swatinem/rust-cache@v2 |
| 58 | + |
| 59 | + - name: Add apt mirrors |
| 60 | + uses: ./.github/actions/apt-mirrors |
| 61 | + |
| 62 | + - name: Install packages |
| 63 | + # `llvm-14-tools` is needed to install the `FileCheck` binary which is used for asm tests. |
| 64 | + timeout-minutes: 20 |
| 65 | + run: | |
| 66 | + sudo apt-get update |
| 67 | + sudo apt-get install ninja-build ripgrep llvm-14-tools llvm |
| 68 | +
|
| 69 | + # The libgccjit distributed by rustup emits `.base64`, which needs binutils >= 2.43. |
| 70 | + # FIXME: remove when we have binutils version 2.43 in the repo. |
| 71 | + - name: Install more recent binutils |
| 72 | + # Without a limit, an unreachable mirror hangs the job until GitHub's 6-hour timeout. |
| 73 | + timeout-minutes: 20 |
| 74 | + uses: ./.github/actions/recent-binutils |
| 75 | + |
| 76 | + - name: Install the libraries needed to build librsvg |
| 77 | + if: ${{ contains(matrix.commands, '--librsvg-tests') }} |
| 78 | + timeout-minutes: 20 |
| 79 | + run: sudo apt-get install libcairo2-dev libpango1.0-dev libfontconfig1-dev libfreetype-dev libharfbuzz-dev libxml2-dev libglib2.0-dev |
| 80 | + |
| 81 | + - name: Set env |
| 82 | + run: | |
| 83 | + echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV |
| 84 | +
|
| 85 | + - name: Prepare |
| 86 | + if: ${{ matrix.run_cargo_tests }} |
| 87 | + run: ./y.sh prepare --only-libcore |
| 88 | + |
| 89 | + - name: Build |
| 90 | + if: ${{ matrix.run_cargo_tests }} |
| 91 | + run: | |
| 92 | + ./y.sh build --sysroot |
| 93 | + ./y.sh test --cargo-tests |
| 94 | + CARGO_TEST_FLAGS="-Zmir-preserve-ub" ./y.sh test --cargo-tests -- mir_preserve_ub_empty_switch |
| 95 | + CARGO_TEST_FLAGS="-Ctarget-feature=+cmpxchg16b" ./y.sh test --cargo-tests -- atomic_u128 |
| 96 | +
|
| 97 | + - name: Run y.sh cargo build |
| 98 | + if: ${{ matrix.run_cargo_tests }} |
| 99 | + run: | |
| 100 | + CARGO_PROFILE_DEV_LTO=no ./y.sh cargo build --manifest-path tests/hello-world/Cargo.toml |
| 101 | +
|
| 102 | + - name: Clean |
| 103 | + if: ${{ matrix.run_cargo_tests }} |
| 104 | + run: | |
| 105 | + ./y.sh clean all |
| 106 | +
|
| 107 | + - name: Remove rustc-dev |
| 108 | + uses: ./.github/actions/remove-rustc-dev |
| 109 | + |
| 110 | + - name: Prepare dependencies |
| 111 | + run: | |
| 112 | + git config --global user.email "user@example.com" |
| 113 | + git config --global user.name "User" |
| 114 | + ./y.sh prepare |
| 115 | +
|
| 116 | + - name: Run tests |
| 117 | + run: | |
| 118 | + ./y.sh test --release --clean --build-sysroot --no-builtins-tests ${{ matrix.commands }} |
| 119 | +
|
| 120 | + # FIXME: test LTO, based on release.yml, once rustup distributes liblto_plugin.so and lto1 |
| 121 | + # (and cg_gcc can find them in the sysroot). |
| 122 | + |
| 123 | + stdarch: |
| 124 | + runs-on: ubuntu-24.04 |
| 125 | + # Above 3 times the longest job, so that a hang cannot run until GitHub's 6-hour limit. |
| 126 | + timeout-minutes: 90 |
| 127 | + |
| 128 | + strategy: |
| 129 | + fail-fast: false |
| 130 | + matrix: |
| 131 | + cargo_runner: [ |
| 132 | + "sde -cpuid-in /home/runner/work/rustc_codegen_gcc/rustc_codegen_gcc/tests/cpuid.def -rtm_mode full --", |
| 133 | + "", |
| 134 | + ] |
| 135 | + |
| 136 | + steps: |
| 137 | + - uses: actions/checkout@v4 |
| 138 | + |
| 139 | + # `rustup show` installs from rust-toolchain.toml |
| 140 | + - name: Setup rust toolchain |
| 141 | + run: rustup show |
| 142 | + |
| 143 | + # The stdarch-gen-common tests run rustfmt. |
| 144 | + - name: Install rustfmt |
| 145 | + run: rustup component add rustfmt |
| 146 | + |
| 147 | + - name: Use the cg_gcc distributed by rustup |
| 148 | + uses: ./.github/actions/rustup-cg-gcc |
| 149 | + |
| 150 | + - name: Setup rust cache |
| 151 | + uses: Swatinem/rust-cache@v2 |
| 152 | + |
| 153 | + - name: Add apt mirrors |
| 154 | + uses: ./.github/actions/apt-mirrors |
| 155 | + |
| 156 | + - name: Install packages |
| 157 | + timeout-minutes: 20 |
| 158 | + run: sudo apt-get install ninja-build ripgrep |
| 159 | + |
| 160 | + # The libgccjit distributed by rustup emits `.base64`, which needs binutils >= 2.43. |
| 161 | + # FIXME: remove when we have binutils version 2.43 in the repo. |
| 162 | + - name: Install more recent binutils |
| 163 | + # Without a limit, an unreachable mirror hangs the job until GitHub's 6-hour timeout. |
| 164 | + timeout-minutes: 20 |
| 165 | + uses: ./.github/actions/recent-binutils |
| 166 | + |
| 167 | + - name: Install Intel Software Development Emulator |
| 168 | + if: ${{ matrix.cargo_runner }} |
| 169 | + run: | |
| 170 | + mkdir intel-sde |
| 171 | + cd intel-sde |
| 172 | + version=10.8.0-2026-03-15 |
| 173 | + dir=sde-external-$version-lin |
| 174 | + file=$dir.tar.xz |
| 175 | + wget http://ci-mirrors.rust-lang.org/$file |
| 176 | + tar xvf $file |
| 177 | + sudo mkdir /usr/share/intel-sde |
| 178 | + sudo cp -r $dir/* /usr/share/intel-sde |
| 179 | + sudo ln -s /usr/share/intel-sde/sde /usr/bin/sde |
| 180 | + sudo ln -s /usr/share/intel-sde/sde64 /usr/bin/sde64 |
| 181 | +
|
| 182 | + - name: Build |
| 183 | + run: | |
| 184 | + ./y.sh prepare --only-libcore |
| 185 | + ./y.sh build --sysroot --release --release-sysroot |
| 186 | +
|
| 187 | + - name: Clean |
| 188 | + if: ${{ !matrix.cargo_runner }} |
| 189 | + run: | |
| 190 | + ./y.sh clean all |
| 191 | +
|
| 192 | + - name: Prepare dependencies |
| 193 | + run: | |
| 194 | + git config --global user.email "user@example.com" |
| 195 | + git config --global user.name "User" |
| 196 | + ./y.sh prepare |
| 197 | +
|
| 198 | + - name: Run tests |
| 199 | + if: ${{ !matrix.cargo_runner }} |
| 200 | + run: | |
| 201 | + ./y.sh test --release --clean --release-sysroot --build-sysroot --mini-tests --std-tests --test-libcore |
| 202 | + ./y.sh test --cargo-tests |
| 203 | +
|
| 204 | + - name: Remove rustc-dev |
| 205 | + uses: ./.github/actions/remove-rustc-dev |
| 206 | + |
| 207 | + - name: Run stdarch tests |
| 208 | + if: ${{ !matrix.cargo_runner }} |
| 209 | + run: | |
| 210 | + # FIXME: remove --skip test_tile_ and --skip --skip test__tile when it's implemented. |
| 211 | + # FIXME: remove --skip test_mm_srav_epi64 when it's fixed upstream. |
| 212 | + ./y.sh test --release --stdarch-tests -- --skip test_tile_ --skip test__tile --skip test_mm_srav_epi64 |
| 213 | +
|
| 214 | + - name: Run stdarch tests |
| 215 | + if: ${{ matrix.cargo_runner }} |
| 216 | + run: | |
| 217 | + # FIXME: these tests fail when the sysroot is compiled with LTO because of a missing symbol in proc-macro. |
| 218 | + # FIXME: remove --skip test_tile_ and --skip --skip test__tile when it's implemented. |
| 219 | + # FIXME: remove --skip test_mm_srav_epi64 when it's fixed upstream. |
| 220 | + STDARCH_TEST_SKIP_FUNCTION="xsave,xsaveopt,xsave64,xsaveopt64" STDARCH_TEST_EVERYTHING=1 CHANNEL=release CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="${{ matrix.cargo_runner }}" TARGET=x86_64-unknown-linux-gnu CG_RUSTFLAGS="-Ainternal_features" ./y.sh cargo test --manifest-path build/build_sysroot/sysroot_src/library/stdarch/Cargo.toml -- --skip rtm --skip tbm --skip sse4a --skip test_tile_ --skip test__tile --skip test_mm_srav_epi64 |
| 221 | +
|
| 222 | + failures: |
| 223 | + runs-on: ubuntu-24.04 |
| 224 | + # Above 3 times the longest job, so that a hang cannot run until GitHub's 6-hour limit. |
| 225 | + timeout-minutes: 90 |
| 226 | + |
| 227 | + steps: |
| 228 | + - uses: actions/checkout@v4 |
| 229 | + |
| 230 | + # `rustup show` installs from rust-toolchain.toml |
| 231 | + - name: Setup rust toolchain |
| 232 | + run: rustup show |
| 233 | + |
| 234 | + - name: Use the cg_gcc distributed by rustup |
| 235 | + uses: ./.github/actions/rustup-cg-gcc |
| 236 | + |
| 237 | + - name: Remove rustc-dev |
| 238 | + uses: ./.github/actions/remove-rustc-dev |
| 239 | + |
| 240 | + - name: Setup rust cache |
| 241 | + uses: Swatinem/rust-cache@v2 |
| 242 | + |
| 243 | + - name: Add apt mirrors |
| 244 | + uses: ./.github/actions/apt-mirrors |
| 245 | + |
| 246 | + - name: Install packages |
| 247 | + timeout-minutes: 20 |
| 248 | + run: sudo apt-get install ninja-build ripgrep |
| 249 | + |
| 250 | + # The libgccjit distributed by rustup emits `.base64`, which needs binutils >= 2.43. |
| 251 | + # FIXME: remove when we have binutils version 2.43 in the repo. |
| 252 | + - name: Install more recent binutils |
| 253 | + # Without a limit, an unreachable mirror hangs the job until GitHub's 6-hour timeout. |
| 254 | + timeout-minutes: 20 |
| 255 | + uses: ./.github/actions/recent-binutils |
| 256 | + |
| 257 | + - name: Set env |
| 258 | + run: | |
| 259 | + echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV |
| 260 | +
|
| 261 | + - name: Prepare dependencies |
| 262 | + run: | |
| 263 | + git config --global user.email "user@example.com" |
| 264 | + git config --global user.name "User" |
| 265 | + ./y.sh prepare |
| 266 | +
|
| 267 | + - name: Run tests |
| 268 | + run: | |
| 269 | + # Without this, `tee` masks the exit status of `y.sh test`. |
| 270 | + set -o pipefail |
| 271 | + status=0 |
| 272 | + ./y.sh test --release --clean --build-sysroot --test-failing-rustc 2>&1 | tee output_log || status=$? |
| 273 | + # This suite runs the tests known to fail, so only a build system error must fail the job. |
| 274 | + if [ "$status" -ne 0 ] && [ "$status" -ne 2 ]; then |
| 275 | + exit "$status" |
| 276 | + fi |
| 277 | + rg --text "test result" output_log >> $GITHUB_STEP_SUMMARY |
| 278 | +
|
| 279 | + - name: Run failing ui pattern tests for ICE |
| 280 | + run: | |
| 281 | + # Without this, `tee` masks the exit status of `y.sh test`. |
| 282 | + set -o pipefail |
| 283 | + status=0 |
| 284 | + ./y.sh test --release --test-failing-ui-pattern-tests 2>&1 | tee output_log_ui || status=$? |
| 285 | + # This suite runs tests that fail, so only a build system error must fail the job here. |
| 286 | + if [ "$status" -ne 0 ] && [ "$status" -ne 2 ]; then |
| 287 | + exit "$status" |
| 288 | + fi |
| 289 | + if grep -q "the compiler unexpectedly panicked" output_log_ui; then |
| 290 | + echo "Error: 'the compiler unexpectedly panicked' found in output logs. CI Error!!" |
| 291 | + exit 1 |
| 292 | + fi |
0 commit comments