Skip to content

Add CI compiling rustc #67

Add CI compiling rustc

Add CI compiling rustc #67

Workflow file for this run

name: Nightly compilation of rustc with rustc_codegen_gcc
on:
pull_request:
# TODO: remove pull_request and add schedule to run during the night.
env:
# Enable backtraces for easier debugging
RUST_BACKTRACE: 1
jobs:
build:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
arch:
- host_target: "x86_64-unknown-linux-gnu"
steps:
- uses: actions/checkout@v4
with:
path: "rustc_codegen_gcc"
- uses: actions/checkout@v4
with:
repository: "rust-lang/rust"
path: "rust"
fetch-depth: 10
# `rustup show` installs from rust-toolchain.toml
- name: Setup rust toolchain
run: rustup show
- name: Setup rust cache
uses: Swatinem/rust-cache@v2
- name: Download and install artifacts
run: |
curl -L -o package.deb https://github.com/rust-lang/gcc/releases/latest/download/gcc-15.deb
sudo dpkg --force-overwrite -i package.deb
- name: Compile rustc
run: |
cd rust
./x build --host=${{ matrix.arch.host_target }} --stage 2 --config ../rustc_codegen_gcc/tests/bootstraps/bootstrap.${{ matrix.arch.host_target }}.toml
- name: Link toolchain
run: |
cd rust
rustup toolchain link my-toolchain build/${{ matrix.arch.host_target }}/stage2
- name: Smoke test
run: |
rustc +my-toolchain -V > output
grep rustc output
- name: Compile test program
run: |
cd rustc_codegen_gcc/tests/hello-world
cargo +my-toolchain build
objcopy --dump-section .comment=comment target/debug/hello_world
grep "rustc version .* with libgccjit" comment
grep 'GCC: ' comment
cargo +my-toolchain run > hello_world_stdout
expected_output="40"
test $(cat hello_world_stdout) == $expected_output || (echo "Output differs. Actual output: $(cat hello_world_stdout)"; exit 1)