-
Notifications
You must be signed in to change notification settings - Fork 1
101 lines (85 loc) · 2.81 KB
/
rust.yml
File metadata and controls
101 lines (85 loc) · 2.81 KB
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
93
94
95
96
97
98
99
100
101
name: Rust
on:
push:
pull_request:
jobs:
test:
name: test-${{ matrix.toolchain }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain: ["stable", "beta"]
nightly: [false]
include:
- toolchain: "nightly"
nightly: true
continue-on-error: ${{ matrix.nightly }}
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: Get Rust Version
id: rust-version
run: echo "::set-output name=VERSION::$(cargo -V | head -n1 | awk '{print $2}')"
- uses: actions/cache@v2
with:
path: |
~/.cargo/git
~/.cargo/registry
target
key: ${{ runner.os }}-rust-${{ steps.rust-version.outputs.VERSION }}
- run: cargo test --workspace
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt -- --check
clippy:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Get Rust Version
id: rust-version
run: echo "::set-output name=VERSION::$(cargo -V | head -n1 | awk '{print $2}')"
- uses: actions/cache@v2
with:
path: |
~/.cargo/git
~/.cargo/registry
target
key: ${{ runner.os }}-rust-${{ steps.rust-version.outputs.VERSION }}-clippy
- run: cargo clippy --workspace --profile test -- -Dclippy::all
coverage:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
- name: Get Rust Version
id: rust-version
run: echo "::set-output name=VERSION::$(cargo -V | head -n1 | awk '{print $2}')"
- name: Get Tarpaulin Version
id: tarpaulin-version
run: echo "::set-output name=VERSION::$(wget -qO- 'https://api.github.com/repos/xd009642/tarpaulin/releases/latest' | jq -r '.tag_name')"
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/cargo-tarpaulin
~/.cargo/git
~/.cargo/registry
target
key: ${{ runner.os }}-rust-${{ steps.rust-version.outputs.VERSION }}-tarpaulin-${{ steps.tarpaulin-version.outputs.VERSION }}
- name: Install Tarpaulin
run: test -e ~/.cargo/bin/cargo-tarpaulin || cargo install cargo-tarpaulin --version ${{ steps.tarpaulin-version.outputs.VERSION }}
- run: |
cargo tarpaulin --workspace --forward --out Xml
bash <(curl -s https://codecov.io/bash)