]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_codegen_gcc/.github/workflows/ci.yml
Add 'compiler/rustc_smir/' from commit '9abcb5c7b574cf316eb23d3f469187bb86ba3019'
[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"]
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       run: |
82         ./prepare_build.sh
83         ./build.sh
84         cargo test
85         ./clean_all.sh
86
87     - name: Prepare dependencies
88       run: |
89         git config --global user.email "user@example.com"
90         git config --global user.name "User"
91         ./prepare.sh
92
93     # Compile is a separate step, as the actions-rs/cargo action supports error annotations
94     - name: Compile
95       uses: actions-rs/cargo@v1.0.3
96       with:
97         command: build
98         args: --release
99
100     - name: Test
101       run: |
102         # Enable backtraces for easier debugging
103         export RUST_BACKTRACE=1
104
105         # Reduce amount of benchmark runs as they are slow
106         export COMPILE_RUNS=2
107         export RUN_RUNS=2
108
109         ./test.sh --release