]> git.proxmox.com Git - rustc.git/blob - compiler/rustc_codegen_gcc/.github/workflows/ci.yml
d2b7724a2215fc82381804e3031e7df191707ebb
[rustc.git] / compiler / rustc_codegen_gcc / .github / workflows / ci.yml
1 name: CI
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
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", 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" }
25 commands: [
26 "--mini-tests",
27 "--std-tests",
28 # FIXME: re-enable asm tests when GCC can emit in the right syntax.
29 # "--asm-tests",
30 "--test-libcore",
31 "--extended-rand-tests",
32 "--extended-regex-example-tests",
33 "--extended-regex-tests",
34 "--test-successful-rustc --nb-parts 2 --current-part 0",
35 "--test-successful-rustc --nb-parts 2 --current-part 1",
36 "--test-failing-rustc",
37 ]
38
39 steps:
40 - uses: actions/checkout@v3
41
42 - uses: actions/checkout@v3
43 with:
44 repository: llvm/llvm-project
45 path: llvm
46
47 - name: Install packages
48 # `llvm-14-tools` is needed to install the `FileCheck` binary which is used for asm tests.
49 run: sudo apt-get install ninja-build ripgrep llvm-14-tools
50
51 - name: Install libgccjit12
52 if: matrix.libgccjit_version.gcc == 'libgccjit12.so'
53 run: sudo apt-get install libgccjit-12-dev
54
55 - name: Download artifact
56 if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
57 uses: dawidd6/action-download-artifact@v2
58 with:
59 workflow: main.yml
60 name: ${{ matrix.libgccjit_version.gcc }}
61 path: gcc-build
62 repo: antoyo/gcc
63 branch: ${{ matrix.libgccjit_version.artifacts_branch }}
64 event: push
65 search_artifacts: true # Because, instead, the action only check the last job ran and that won't work since we want multiple artifacts.
66
67 - 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'
73 run: |
74 echo $(readlink -f gcc-build) > gcc_path
75 # NOTE: the filename is still libgccjit.so even when the artifact name is different.
76 ln gcc-build/libgccjit.so gcc-build/libgccjit.so.0
77
78 - name: Set env
79 run: |
80 echo "LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
81 echo "LD_LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
82 echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
83
84 - name: Set RUST_COMPILER_RT_ROOT
85 run: echo "RUST_COMPILER_RT_ROOT="${{ env.workspace }}/llvm/compiler-rt >> $GITHUB_ENV
86
87 - name: Cache cargo installed crates
88 uses: actions/cache@v3
89 with:
90 path: ~/.cargo/bin
91 key: cargo-installed-crates2-ubuntu-latest
92
93 - name: Cache cargo registry
94 uses: actions/cache@v3
95 with:
96 path: ~/.cargo/registry
97 key: ${{ runner.os }}-cargo-registry2-${{ hashFiles('**/Cargo.lock') }}
98
99 - name: Cache cargo index
100 uses: actions/cache@v3
101 with:
102 path: ~/.cargo/git
103 key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
104
105 - name: Cache cargo target dir
106 uses: actions/cache@v3
107 with:
108 path: target
109 key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain') }}
110
111 #- name: Cache rust repository
112 ## We only clone the rust repository for rustc tests
113 #if: ${{ contains(matrix.commands, 'rustc') }}
114 #uses: actions/cache@v3
115 #id: cache-rust-repository
116 #with:
117 #path: rust
118 #key: ${{ runner.os }}-packages-${{ hashFiles('rust/.git/HEAD') }}
119
120 - name: Build
121 run: |
122 ./prepare_build.sh
123 ${{ matrix.libgccjit_version.env_extra }} ./build.sh ${{ matrix.libgccjit_version.extra }}
124 ${{ matrix.libgccjit_version.env_extra }} cargo test ${{ matrix.libgccjit_version.extra }}
125 ./clean_all.sh
126
127 - name: Prepare dependencies
128 run: |
129 git config --global user.email "user@example.com"
130 git config --global user.name "User"
131 ./prepare.sh
132
133 # Compile is a separate step, as the actions-rs/cargo action supports error annotations
134 - name: Compile
135 uses: actions-rs/cargo@v1.0.3
136 with:
137 command: build
138 args: --release
139
140 - name: Add more failing tests for GCC 12
141 if: ${{ matrix.libgccjit_version.gcc == 'libgccjit12.so' }}
142 run: cat failing-ui-tests12.txt >> failing-ui-tests.txt
143
144 - name: Run tests
145 run: |
146 ${{ matrix.libgccjit_version.env_extra }} ./test.sh --release --clean --build-sysroot ${{ matrix.commands }} ${{ matrix.libgccjit_version.extra }}
147
148 duplicates:
149 runs-on: ubuntu-latest
150 steps:
151 - uses: actions/checkout@v3
152 - run: python tools/check_intrinsics_duplicates.py