Skip to content

Commit 99bc37e

Browse files
committed
Refactor CI scripts to have a different file for libgccjit 12
1 parent d64662f commit 99bc37e

File tree

5 files changed

+261
-23
lines changed

5 files changed

+261
-23
lines changed

.github/workflows/ci.yml

+5-21
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
libgccjit_version:
22-
- { gcc: "libgccjit.so", extra: "", env_extra: "", artifacts_branch: "master" }
23-
- { gcc: "libgccjit_without_int128.so", extra: "", env_extra: "", artifacts_branch: "master-without-128bit-integers" }
24-
- { gcc: "libgccjit12.so", extra: "--no-default-features", env_extra: "TEST_FLAGS='-Cpanic=abort -Zpanic-abort-tests'", artifacts_branch: "gcc12" }
22+
- { gcc: "libgccjit.so", artifacts_branch: "master" }
23+
- { gcc: "libgccjit_without_int128.so", artifacts_branch: "master-without-128bit-integers" }
2524
commands: [
2625
"--mini-tests",
2726
"--std-tests",
@@ -33,7 +32,6 @@ jobs:
3332
"--extended-regex-tests",
3433
"--test-successful-rustc --nb-parts 2 --current-part 0",
3534
"--test-successful-rustc --nb-parts 2 --current-part 1",
36-
"--test-failing-rustc",
3735
]
3836

3937
steps:
@@ -48,12 +46,7 @@ jobs:
4846
# `llvm-14-tools` is needed to install the `FileCheck` binary which is used for asm tests.
4947
run: sudo apt-get install ninja-build ripgrep llvm-14-tools
5048

51-
- name: Install libgccjit12
52-
if: matrix.libgccjit_version.gcc == 'libgccjit12.so'
53-
run: sudo apt-get install libgccjit-12-dev
54-
5549
- name: Download artifact
56-
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
5750
uses: dawidd6/action-download-artifact@v2
5851
with:
5952
workflow: main.yml
@@ -65,11 +58,6 @@ jobs:
6558
search_artifacts: true # Because, instead, the action only check the last job ran and that won't work since we want multiple artifacts.
6659

6760
- name: Setup path to libgccjit
68-
if: matrix.libgccjit_version.gcc == 'libgccjit12.so'
69-
run: echo /usr/lib/gcc/x86_64-linux-gnu/12 > gcc_path
70-
71-
- name: Setup path to libgccjit
72-
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
7361
run: |
7462
sudo dpkg --force-overwrite -i gcc-13/gcc-13.deb
7563
echo /usr/lib/ > gcc_path
@@ -119,8 +107,8 @@ jobs:
119107
- name: Build
120108
run: |
121109
./y.sh prepare --only-libcore
122-
${{ matrix.libgccjit_version.env_extra }} ./y.sh build ${{ matrix.libgccjit_version.extra }}
123-
${{ matrix.libgccjit_version.env_extra }} cargo test ${{ matrix.libgccjit_version.extra }}
110+
./y.sh build
111+
cargo test
124112
./clean_all.sh
125113
126114
- name: Prepare dependencies
@@ -136,16 +124,12 @@ jobs:
136124
command: build
137125
args: --release
138126

139-
- name: Add more failing tests for GCC 12
140-
if: ${{ matrix.libgccjit_version.gcc == 'libgccjit12.so' }}
141-
run: cat failing-ui-tests12.txt >> failing-ui-tests.txt
142-
143127
- name: Add more failing tests because the sysroot is not compiled with LTO
144128
run: cat failing-non-lto-tests.txt >> failing-ui-tests.txt
145129

146130
- name: Run tests
147131
run: |
148-
${{ matrix.libgccjit_version.env_extra }} ./test.sh --release --clean --build-sysroot ${{ matrix.commands }} ${{ matrix.libgccjit_version.extra }}
132+
./test.sh --release --clean --build-sysroot ${{ matrix.commands }}
149133
150134
duplicates:
151135
runs-on: ubuntu-latest

.github/workflows/failures.yml

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# TODO: refactor to avoid duplication with the ci.yml file.
2+
name: Failures
3+
4+
on:
5+
- pull_request
6+
7+
permissions:
8+
contents: read
9+
10+
env:
11+
# Enable backtraces for easier debugging
12+
RUST_BACKTRACE: 1
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-22.04
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
libgccjit_version:
22+
- { gcc: "libgccjit.so", artifacts_branch: "master" }
23+
- { gcc: "libgccjit_without_int128.so", artifacts_branch: "master-without-128bit-integers" }
24+
25+
steps:
26+
- uses: actions/checkout@v3
27+
28+
- uses: actions/checkout@v3
29+
with:
30+
repository: llvm/llvm-project
31+
path: llvm
32+
33+
- name: Install packages
34+
# `llvm-14-tools` is needed to install the `FileCheck` binary which is used for asm tests.
35+
run: sudo apt-get install ninja-build ripgrep llvm-14-tools
36+
37+
- name: Download artifact
38+
uses: dawidd6/action-download-artifact@v2
39+
with:
40+
workflow: main.yml
41+
name: gcc-13
42+
path: gcc-13
43+
repo: antoyo/gcc
44+
branch: ${{ matrix.libgccjit_version.artifacts_branch }}
45+
event: push
46+
search_artifacts: true # Because, instead, the action only check the last job ran and that won't work since we want multiple artifacts.
47+
48+
- name: Setup path to libgccjit
49+
run: |
50+
sudo dpkg --force-overwrite -i gcc-13/gcc-13.deb
51+
echo /usr/lib/ > gcc_path
52+
53+
- name: Set env
54+
run: |
55+
echo "LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
56+
echo "LD_LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
57+
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
58+
59+
- name: Set RUST_COMPILER_RT_ROOT
60+
run: echo "RUST_COMPILER_RT_ROOT="${{ env.workspace }}/llvm/compiler-rt >> $GITHUB_ENV
61+
62+
- name: Cache cargo installed crates
63+
uses: actions/cache@v3
64+
with:
65+
path: ~/.cargo/bin
66+
key: cargo-installed-crates2-ubuntu-latest
67+
68+
- name: Cache cargo registry
69+
uses: actions/cache@v3
70+
with:
71+
path: ~/.cargo/registry
72+
key: ${{ runner.os }}-cargo-registry2-${{ hashFiles('**/Cargo.lock') }}
73+
74+
- name: Cache cargo index
75+
uses: actions/cache@v3
76+
with:
77+
path: ~/.cargo/git
78+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
79+
80+
- name: Cache cargo target dir
81+
uses: actions/cache@v3
82+
with:
83+
path: target
84+
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain') }}
85+
86+
#- name: Cache rust repository
87+
#uses: actions/cache@v3
88+
#id: cache-rust-repository
89+
#with:
90+
#path: rust
91+
#key: ${{ runner.os }}-packages-${{ hashFiles('rust/.git/HEAD') }}
92+
93+
- name: Build
94+
run: |
95+
./y.sh prepare --only-libcore
96+
./y.sh build
97+
cargo test
98+
./clean_all.sh
99+
100+
- name: Prepare dependencies
101+
run: |
102+
git config --global user.email "[email protected]"
103+
git config --global user.name "User"
104+
./y.sh prepare
105+
106+
# Compile is a separate step, as the actions-rs/cargo action supports error annotations
107+
- name: Compile
108+
uses: actions-rs/[email protected]
109+
with:
110+
command: build
111+
args: --release
112+
113+
- name: Add more failing tests because the sysroot is not compiled with LTO
114+
run: cat failing-non-lto-tests.txt >> failing-ui-tests.txt
115+
116+
- name: Run tests
117+
id: tests
118+
run: |
119+
./test.sh --release --clean --build-sysroot --test-failing-rustc | tee output_log
120+
rg "test result" output_log >> $GITHUB_STEP_SUMMARY

.github/workflows/gcc12.yml

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: CI libgccjit 12
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
permissions:
8+
contents: read
9+
10+
env:
11+
# Enable backtraces for easier debugging
12+
RUST_BACKTRACE: 1
13+
TEST_FLAGS: "-Cpanic=abort -Zpanic-abort-tests"
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-22.04
18+
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
commands: [
23+
"--mini-tests",
24+
# TODO(antoyo): re-enable those commands when the build with libgccjit 12 is fixed.
25+
#"--std-tests",
26+
# FIXME: re-enable asm tests when GCC can emit in the right syntax.
27+
# "--asm-tests",
28+
#"--test-libcore",
29+
#"--extended-rand-tests",
30+
#"--extended-regex-example-tests",
31+
#"--extended-regex-tests",
32+
#"--test-successful-rustc --nb-parts 2 --current-part 0",
33+
#"--test-successful-rustc --nb-parts 2 --current-part 1",
34+
#"--test-failing-rustc",
35+
]
36+
37+
steps:
38+
- uses: actions/checkout@v3
39+
40+
- uses: actions/checkout@v3
41+
with:
42+
repository: llvm/llvm-project
43+
path: llvm
44+
45+
- name: Install packages
46+
# `llvm-14-tools` is needed to install the `FileCheck` binary which is used for asm tests.
47+
run: sudo apt-get install ninja-build ripgrep llvm-14-tools libgccjit-12-dev
48+
49+
- name: Setup path to libgccjit
50+
run: echo /usr/lib/gcc/x86_64-linux-gnu/12 > gcc_path
51+
52+
- name: Set env
53+
run: |
54+
echo "LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
55+
echo "LD_LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
56+
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
57+
58+
- name: Set RUST_COMPILER_RT_ROOT
59+
run: echo "RUST_COMPILER_RT_ROOT="${{ env.workspace }}/llvm/compiler-rt >> $GITHUB_ENV
60+
61+
- name: Cache cargo installed crates
62+
uses: actions/cache@v3
63+
with:
64+
path: ~/.cargo/bin
65+
key: cargo-installed-crates2-ubuntu-latest
66+
67+
- name: Cache cargo registry
68+
uses: actions/cache@v3
69+
with:
70+
path: ~/.cargo/registry
71+
key: ${{ runner.os }}-cargo-registry2-${{ hashFiles('**/Cargo.lock') }}
72+
73+
- name: Cache cargo index
74+
uses: actions/cache@v3
75+
with:
76+
path: ~/.cargo/git
77+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
78+
79+
- name: Cache cargo target dir
80+
uses: actions/cache@v3
81+
with:
82+
path: target
83+
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain') }}
84+
85+
#- name: Cache rust repository
86+
## We only clone the rust repository for rustc tests
87+
#if: ${{ contains(matrix.commands, 'rustc') }}
88+
#uses: actions/cache@v3
89+
#id: cache-rust-repository
90+
#with:
91+
#path: rust
92+
#key: ${{ runner.os }}-packages-${{ hashFiles('rust/.git/HEAD') }}
93+
94+
- name: Build
95+
run: |
96+
./y.sh prepare --only-libcore
97+
# TODO(antoyo): build the sysroot when the build with libgccjit 12 is fixed.
98+
#./y.sh build --no-default-features
99+
# TODO(antoyo): run the tests when we can build the sysroot with libgccjit 12.
100+
#cargo test --no-default-features
101+
./clean_all.sh
102+
103+
- name: Prepare dependencies
104+
run: |
105+
git config --global user.email "[email protected]"
106+
git config --global user.name "User"
107+
./y.sh prepare
108+
109+
# Compile is a separate step, as the actions-rs/cargo action supports error annotations
110+
- name: Compile
111+
uses: actions-rs/[email protected]
112+
with:
113+
command: build
114+
args: --release
115+
116+
- name: Add more failing tests for GCC 12
117+
run: cat failing-ui-tests12.txt >> failing-ui-tests.txt
118+
119+
- name: Run tests
120+
run: |
121+
# TODO(antoyo): add --build-sysroot when the build with libgccjit 12 is fixed.
122+
# FIXME(antoyo): we need to set GCC_EXEC_PREFIX so that the linker can find the linker plugin.
123+
# Not sure why it's not found otherwise.
124+
GCC_EXEC_PREFIX=/usr/lib/gcc/ ./test.sh --release --clean ${{ matrix.commands }} --no-default-features

.ignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
!/build_sysroot/sysroot_src
2+
!/simple-raytracer
3+
!/regex
4+
!/rand
5+
!/test-backend
6+
!/gcc_path
7+
!/benchmarks
8+
!*gimple*
9+
!*asm*
10+
!.github

build_system/src/build.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::config::set_config;
22
use crate::utils::{
3-
get_gcc_path, run_command, run_command_with_env, run_command_with_output_and_env, walk_dir,
3+
get_gcc_path, run_command, run_command_with_output_and_env, walk_dir,
44
};
55
use std::collections::HashMap;
66
use std::ffi::OsStr;
@@ -200,7 +200,7 @@ fn build_codegen(args: &BuildArg) -> Result<(), String> {
200200
for feature in &ref_features {
201201
command.push(feature);
202202
}
203-
run_command_with_env(&command, None, Some(&env))?;
203+
run_command_with_output_and_env(&command, None, Some(&env))?;
204204

205205
let config = set_config(&mut env, &[], Some(&args.gcc_path))?;
206206

0 commit comments

Comments
 (0)