]> git.lizzy.rs Git - rust.git/blob - .github/workflows/main.yml
[CI] Run the compile step with CARGO_INCREMENTAL=1
[rust.git] / .github / workflows / main.yml
1 name: CI
2
3 on:
4   - push
5   - pull_request
6
7 jobs:
8   build:
9     runs-on: ${{ matrix.os }}
10
11     strategy:
12       fail-fast: false
13       matrix:
14         os: [ubuntu-latest, macos-latest]
15
16     steps:
17     - uses: actions/checkout@v2
18
19     # https://github.com/actions/cache/issues/133
20     - name: Fixup owner of ~/.cargo/
21       # Don't remove the trailing /. It is necessary to follow the symlink.
22       run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/
23
24     - name: Cache cargo installed crates
25       uses: actions/cache@v1.1.2
26       with:
27         path: ~/.cargo/bin
28         key: cargo-installed-crates2-${{ matrix.os }}
29
30     - name: Cache cargo registry
31       uses: actions/cache@v1
32       with:
33         path: ~/.cargo/registry
34         key: ${{ runner.os }}-cargo-registry2-${{ hashFiles('**/Cargo.lock') }}
35
36     - name: Cache cargo index
37       uses: actions/cache@v1
38       with:
39         path: ~/.cargo/git
40         key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
41
42     - name: Cache cargo target dir
43       uses: actions/cache@v1.1.2
44       with:
45         path: target
46         key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
47
48     - name: Prepare dependencies
49       run: |
50         git config --global user.email "user@example.com"
51         git config --global user.name "User"
52         ./prepare.sh
53
54     # Compile is a separate step, as the actions-rs/cargo action supports error annotations
55     - name: Compile
56       uses: actions-rs/cargo@v1.0.3
57       with:
58         command: rustc
59         args: --release -- -Zrun_dsymutil=no
60       env:
61         CARGO_INCREMENTAL: 1
62
63     - name: Test
64       run: |
65         # Enable backtraces for easier debugging
66         export RUST_BACKTRACE=1
67
68         # Reduce amount of benchmark runs as they are slow
69         export COMPILE_RUNS=2
70         export RUN_RUNS=2
71
72         ./test.sh --release