-
Notifications
You must be signed in to change notification settings - Fork 4
92 lines (90 loc) · 2.62 KB
/
basic.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Basic
on:
pull_request:
branches:
- "*"
push:
branches:
- "*"
jobs:
build:
name: Build
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: true
matrix:
platform:
- ubuntu-latest
# - macos-latest
# - windows-latest
toolchain:
- stable
- beta
- nightly
include:
- platform: ubuntu-latest
toolchain: beta
clippyetc: true
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
name: Acquire minimal Rust ${{ matrix.toolchain }}
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
override: true
if: "!matrix.clippyetc"
- uses: actions-rs/toolchain@v1
name: Acquire minimal Rust ${{ matrix.toolchain }} with clippy and rustfmt
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
override: true
components: clippy, rustfmt
if: matrix.clippyetc
- name: Determine the compiler identity
shell: bash
id: rustc
run: |
echo "commit_hash=$(rustc -vV | grep commit-hash | cut -b14-23)" >> $GITHUB_OUTPUT
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo git trees
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-gits-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ matrix.target }}-${{ steps.rustc.outputs.commit_hash }}-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/cargo@v1
name: Build the library in debug mode
with:
command: build
args: --all --all-features
- uses: actions-rs/cargo@v1
name: Run the tests
with:
command: test
args: --all --all-features
- uses: actions-rs/cargo@v1
name: Run clippy
with:
command: clippy
args: --all --all-features
if: matrix.clippyetc
- uses: actions-rs/cargo@v1
name: Check formatting
with:
command: fmt
args: --all -- --check
if: matrix.clippyetc
- name: Clear the cargo caches
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean
cargo-cache