]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_codegen_gcc/.github/workflows/ci.yml
Rollup merge of #97633 - mkroening:object-osabi, r=petrochenkov
[rust.git] / compiler / rustc_codegen_gcc / .github / workflows / ci.yml
1 name: CI
2
3 on:
4   - push
5   - pull_request
6
7 jobs:
8   build:
9     runs-on: ubuntu-latest
10
11     strategy:
12       fail-fast: false
13       matrix:
14         libgccjit_version: ["libgccjit.so", "libgccjit_without_int128.so", "libgccjit12.so"]
15
16     steps:
17     - uses: actions/checkout@v2
18
19     - uses: actions/checkout@v2
20       with:
21         repository: llvm/llvm-project
22         path: llvm
23
24     - name: Install packages
25       run: sudo apt-get install ninja-build ripgrep
26
27     - name: Download artifact
28       uses: dawidd6/action-download-artifact@v2
29       with:
30           workflow: main.yml
31           name: ${{ matrix.libgccjit_version }}
32           path: gcc-build
33           repo: antoyo/gcc
34           search_artifacts: true # Because, instead, the action only check the last job ran and that won't work since we want multiple artifacts.
35
36     - name: Setup path to libgccjit
37       run: |
38           echo $(readlink -f gcc-build) > gcc_path
39           # NOTE: the filename is still libgccjit.so even when the artifact name is different.
40           ln gcc-build/libgccjit.so gcc-build/libgccjit.so.0
41
42     - name: Set env
43       run: |
44         echo "LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
45         echo "LD_LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
46         echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
47
48     - name: Set RUST_COMPILER_RT_ROOT
49       run: echo "RUST_COMPILER_RT_ROOT="${{ env.workspace }}/llvm/compiler-rt >> $GITHUB_ENV
50
51     # https://github.com/actions/cache/issues/133
52     - name: Fixup owner of ~/.cargo/
53       # Don't remove the trailing /. It is necessary to follow the symlink.
54       run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/
55
56     - name: Cache cargo installed crates
57       uses: actions/cache@v1.1.2
58       with:
59         path: ~/.cargo/bin
60         key: cargo-installed-crates2-ubuntu-latest
61
62     - name: Cache cargo registry
63       uses: actions/cache@v1
64       with:
65         path: ~/.cargo/registry
66         key: ${{ runner.os }}-cargo-registry2-${{ hashFiles('**/Cargo.lock') }}
67
68     - name: Cache cargo index
69       uses: actions/cache@v1
70       with:
71         path: ~/.cargo/git
72         key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
73
74     - name: Cache cargo target dir
75       uses: actions/cache@v1.1.2
76       with:
77         path: target
78         key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain') }}
79
80     - name: Build
81       if: matrix.libgccjit_version != 'libgccjit12.so'
82       run: |
83         ./prepare_build.sh
84         ./build.sh
85         cargo test
86         ./clean_all.sh
87
88     - name: Build
89       if: matrix.libgccjit_version == 'libgccjit12.so'
90       run: |
91         ./prepare_build.sh
92         ./build.sh --no-default-features
93         cargo test --no-default-features
94         ./clean_all.sh
95
96     - name: Prepare dependencies
97       run: |
98         git config --global user.email "user@example.com"
99         git config --global user.name "User"
100         ./prepare.sh
101
102     # Compile is a separate step, as the actions-rs/cargo action supports error annotations
103     - name: Compile
104       uses: actions-rs/cargo@v1.0.3
105       with:
106         command: build
107         args: --release
108
109     - name: Test
110       if: matrix.libgccjit_version != 'libgccjit12.so'
111       run: |
112         # Enable backtraces for easier debugging
113         export RUST_BACKTRACE=1
114
115         # Reduce amount of benchmark runs as they are slow
116         export COMPILE_RUNS=2
117         export RUN_RUNS=2
118
119         ./test.sh --release
120
121     - name: Test
122       if: matrix.libgccjit_version == 'libgccjit12.so'
123       run: |
124         # Enable backtraces for easier debugging
125         export RUST_BACKTRACE=1
126
127         # Reduce amount of benchmark runs as they are slow
128         export COMPILE_RUNS=2
129         export RUN_RUNS=2
130
131         ./test.sh --release --no-default-features