-
Notifications
You must be signed in to change notification settings - Fork 125
119 lines (101 loc) · 3.23 KB
/
rust.yml
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Rust
on:
push:
pull_request:
jobs:
test-gotham:
name: test-gotham${{ matrix.flag }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
flag: ["", "--all-features"]
command: ["test"]
include:
- flag: "--no-default-features"
command: "check"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
id: rust-toolchain
- uses: actions/cache@v4
with:
path: |
~/.cargo/git
~/.cargo/registry
target
key: ${{ runner.os }}-rust-gotham${{ matrix.flag }}-${{ steps.rust-toolchain.outputs.cachekey }}
- run: cargo ${{ matrix.command }} -p gotham ${{ matrix.flag }}
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@v4
- uses: dtolnay/rust-toolchain@master
id: rust-toolchain
with:
toolchain: ${{ matrix.toolchain }}
- uses: actions/cache@v4
with:
path: |
~/.cargo/git
~/.cargo/registry
target
key: ${{ runner.os }}-rust-${{ steps.rust-toolchain.outputs.cache-key }}
- run: cargo test --workspace
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
id: rust-toolchain
with:
toolchain: "1.77"
components: clippy
- uses: actions/cache@v4
with:
path: |
~/.cargo/git
~/.cargo/registry
target
key: ${{ runner.os }}-rust-${{ steps.rust-toolchain.outputs.cachekey }}-clippy
- run: cargo clippy --workspace --profile test -- -Dclippy::all
coverage:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
id: rust-toolchain
- name: Get Tarpaulin Version
id: tarpaulin-version
run: echo "::set-output name=VERSION::$(wget -qO- 'https://crates.io/api/v1/crates/cargo-tarpaulin' | jq -r '.crate.max_stable_version')"
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/cargo-tarpaulin
~/.cargo/git
~/.cargo/registry
target
key: ${{ runner.os }}-rust-${{ steps.rust-toolchain.outputs.cachekey }}-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
- uses: codecov/codecov-action@v3