blob: 57d7a39de049a76ec648cd85098a7672ef19b11a [file]
name: CI with the cg_gcc distributed by rustup
# Not run in PRs since it tests the cg_gcc sources of the latest nightly, not the ones of this
# repository.
on:
schedule:
- cron: "0 4 * * *"
workflow_dispatch:
permissions:
contents: read
defaults:
run:
# Where the rustup-cg-gcc action checks out the cg_gcc sources of the nightly.
working-directory: rust/compiler/rustc_codegen_gcc
env:
# Enable backtraces for easier debugging
RUST_BACKTRACE: 1
# For the run-make tests.
LLVM_BIN_DIR: /usr/bin
jobs:
build:
runs-on: ubuntu-26.04
# Above 3 times the longest job, so that a hang cannot run until GitHub's 6-hour limit.
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
commands: [
"--std-tests --alloc-tests",
# FIXME: re-enable asm tests when GCC can emit in the right syntax.
# "--asm-tests",
"--test-libcore --test-libcore-doctests",
"--test-successful-rustc --nb-parts 2 --current-part 0",
"--test-successful-rustc --nb-parts 2 --current-part 1",
"--librsvg-tests",
"--projects --nb-parts 3 --current-part 0",
"--projects --nb-parts 3 --current-part 1",
"--projects --nb-parts 3 --current-part 2",
"--gcc-asm-tests --test-release-libcore",
]
# The tests that don't depend on the test command only run in the fastest job.
include:
- commands: "--std-tests --alloc-tests"
run_cargo_tests: true
steps:
- uses: actions/checkout@v7
with:
sparse-checkout: .github
sparse-checkout-cone-mode: false
- name: Use the cg_gcc distributed by rustup
uses: ./.github/actions/rustup-cg-gcc
with:
path: rust
- name: Add apt mirrors
uses: ./.github/actions/apt-mirrors
- name: Install packages
# `llvm-tools` is needed to install the `FileCheck` binary which is used for asm tests.
timeout-minutes: 20
run: |
sudo apt-get update
sudo apt-get install ninja-build ripgrep llvm-tools llvm
- name: Install the libraries needed to build librsvg
if: ${{ contains(matrix.commands, '--librsvg-tests') }}
timeout-minutes: 20
run: sudo apt-get install libcairo2-dev libpango1.0-dev libfontconfig1-dev libfreetype-dev libharfbuzz-dev libxml2-dev libglib2.0-dev
- name: Set env
run: |
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
# /tmp is a small tmpfs, and rustdoc keeps every compiled doctest there until the run ends.
echo "TMPDIR=$RUNNER_TEMP" >> $GITHUB_ENV
- name: Prepare
if: ${{ matrix.run_cargo_tests }}
run: ./y.sh prepare --only-libcore
- name: Build
if: ${{ matrix.run_cargo_tests }}
run: |
./y.sh build --sysroot
./y.sh test --cargo-tests
CARGO_TEST_FLAGS="-Zmir-preserve-ub" ./y.sh test --cargo-tests -- mir_preserve_ub_empty_switch
CARGO_TEST_FLAGS="-Ctarget-feature=+cmpxchg16b" ./y.sh test --cargo-tests -- atomic_u128
- name: Run y.sh cargo build
if: ${{ matrix.run_cargo_tests }}
run: |
CARGO_PROFILE_DEV_LTO=no ./y.sh cargo build --manifest-path tests/hello-world/Cargo.toml
- name: Clean
if: ${{ matrix.run_cargo_tests }}
run: |
./y.sh clean all
- name: Remove rustc-dev
uses: ./.github/actions/remove-rustc-dev
with:
directory: rust/compiler/rustc_codegen_gcc
- name: Prepare dependencies
run: |
git config --global user.email "user@example.com"
git config --global user.name "User"
./y.sh prepare
- name: Run tests
run: |
./y.sh test --release --clean --build-sysroot --no-builtins-tests ${{ matrix.commands }}
# FIXME: test LTO, based on release.yml, once rustup distributes liblto_plugin.so and lto1
# (and cg_gcc can find them in the sysroot).
stdarch:
runs-on: ubuntu-26.04
# Above 3 times the longest job, so that a hang cannot run until GitHub's 6-hour limit.
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
cargo_runner: [
"sde -cpuid-in /home/runner/work/rustc_codegen_gcc/rustc_codegen_gcc/rust/compiler/rustc_codegen_gcc/tests/cpuid.def -rtm_mode full --",
"",
]
steps:
- uses: actions/checkout@v7
with:
sparse-checkout: .github
sparse-checkout-cone-mode: false
- name: Use the cg_gcc distributed by rustup
uses: ./.github/actions/rustup-cg-gcc
with:
path: rust
# The stdarch-gen-common tests run rustfmt.
- name: Install rustfmt
run: rustup component add rustfmt
- name: Add apt mirrors
uses: ./.github/actions/apt-mirrors
- name: Install packages
timeout-minutes: 20
run: |
sudo apt-get update
sudo apt-get install ninja-build ripgrep
- name: Install Intel Software Development Emulator
if: ${{ matrix.cargo_runner }}
run: |
mkdir intel-sde
cd intel-sde
version=10.8.0-2026-03-15
dir=sde-external-$version-lin
file=$dir.tar.xz
wget http://ci-mirrors.rust-lang.org/$file
tar xvf $file
sudo mkdir /usr/share/intel-sde
sudo cp -r $dir/* /usr/share/intel-sde
sudo ln -s /usr/share/intel-sde/sde /usr/bin/sde
sudo ln -s /usr/share/intel-sde/sde64 /usr/bin/sde64
- name: Build
run: |
./y.sh prepare --only-libcore
./y.sh build --sysroot --release --release-sysroot
- name: Clean
if: ${{ !matrix.cargo_runner }}
run: |
./y.sh clean all
- name: Prepare dependencies
run: |
git config --global user.email "user@example.com"
git config --global user.name "User"
./y.sh prepare
- name: Run tests
if: ${{ !matrix.cargo_runner }}
run: |
./y.sh test --release --clean --release-sysroot --build-sysroot --mini-tests --std-tests --test-libcore
./y.sh test --cargo-tests
- name: Remove rustc-dev
uses: ./.github/actions/remove-rustc-dev
with:
directory: rust/compiler/rustc_codegen_gcc
- name: Run stdarch tests
if: ${{ !matrix.cargo_runner }}
run: |
# FIXME: remove --skip test_tile_ and --skip --skip test__tile when it's implemented.
# FIXME: remove --skip test_mm_srav_epi64 when it's fixed upstream.
./y.sh test --release --stdarch-tests -- --skip test_tile_ --skip test__tile --skip test_mm_srav_epi64
- name: Run stdarch tests
if: ${{ matrix.cargo_runner }}
run: |
# FIXME: these tests fail when the sysroot is compiled with LTO because of a missing symbol in proc-macro.
# FIXME: remove --skip test_tile_ and --skip --skip test__tile when it's implemented.
# FIXME: remove --skip test_mm_srav_epi64 when it's fixed upstream.
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
failures:
runs-on: ubuntu-26.04
# Above 3 times the longest job, so that a hang cannot run until GitHub's 6-hour limit.
timeout-minutes: 90
steps:
- uses: actions/checkout@v7
with:
sparse-checkout: .github
sparse-checkout-cone-mode: false
- name: Use the cg_gcc distributed by rustup
uses: ./.github/actions/rustup-cg-gcc
with:
path: rust
- name: Remove rustc-dev
uses: ./.github/actions/remove-rustc-dev
with:
directory: rust/compiler/rustc_codegen_gcc
- name: Add apt mirrors
uses: ./.github/actions/apt-mirrors
- name: Install packages
timeout-minutes: 20
run: |
sudo apt-get update
sudo apt-get install ninja-build ripgrep
- name: Set env
run: |
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
- name: Prepare dependencies
run: |
git config --global user.email "user@example.com"
git config --global user.name "User"
./y.sh prepare
- name: Run tests
run: |
# Without this, `tee` masks the exit status of `y.sh test`.
set -o pipefail
status=0
./y.sh test --release --clean --build-sysroot --test-failing-rustc 2>&1 | tee output_log || status=$?
# This suite runs the tests known to fail, so only a build system error must fail the job.
if [ "$status" -ne 0 ] && [ "$status" -ne 2 ]; then
exit "$status"
fi
rg --text "test result" output_log >> $GITHUB_STEP_SUMMARY
- name: Run failing ui pattern tests for ICE
run: |
# Without this, `tee` masks the exit status of `y.sh test`.
set -o pipefail
status=0
./y.sh test --release --test-failing-ui-pattern-tests 2>&1 | tee output_log_ui || status=$?
# This suite runs tests that fail, so only a build system error must fail the job here.
if [ "$status" -ne 0 ] && [ "$status" -ne 2 ]; then
exit "$status"
fi
if grep -q "the compiler unexpectedly panicked" output_log_ui; then
echo "Error: 'the compiler unexpectedly panicked' found in output logs. CI Error!!"
exit 1
fi