]> git.lizzy.rs Git - rust.git/blob - .github/workflows/main.yml
[gh actions] Cache target dir for specific rustc version
[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     - name: Cache cargo installed crates
20       uses: actions/cache@v1.1.2
21       with:
22         path: ~/.cargo/bin
23         key: cargo-installed-crates-${{ matrix.os }}
24
25     - name: Cache target dir
26       uses: actions/cache@v1.1.2
27       with:
28         path: target
29         key: target-dir-${{ matrix.os }}-${{ hashFiles('rust-toolchain') }}
30
31     - name: Prepare dependencies
32       run: |
33         git config --global user.email "user@example.com"
34         git config --global user.name "User"
35         ./prepare.sh
36     
37     # Compile is a separate step, as the actions-rs/cargo action supports error annotations
38     - name: Compile
39       uses: actions-rs/cargo@v1.0.1
40       with:
41         command: build
42         args: --release
43     
44     - name: Test
45       run: |
46         # Enable backtraces for easier debugging
47         export RUST_BACKTRACE=1
48         
49         # Reduce amount of benchmark runs as they are slow
50         export COMPILE_RUNS=2
51         export RUN_RUNS=2
52         
53         ./test.sh --release