-
Notifications
You must be signed in to change notification settings - Fork 1
140 lines (117 loc) · 3.65 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Rust
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
CARGO_TERM_COLOR: always
NIGHTLY_TOOLCHAIN: nightly-2022-11-25
STABLE_TOOLCHAIN: '1.65'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Try to restore toolchain, sccache dir & other crates from cache
id: cache-toolchain
uses: actions/cache@v3
with:
path: |
~/.cargo
~/.rustup
~/.cache/sccache
key: ${{ runner.os }}-nightly-${{ env.NIGHTLY_TOOLCHAIN }}-reset1
- name: Install nightly
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
override: true
profile: minimal
components: rustfmt, clippy, miri, rust-src
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
- name: Install SARIF support
run: cargo install clippy-sarif sarif-fmt
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
- name: Install sccache
run: cargo install sccache
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
- name: Clippy
run: cargo clippy --all-features --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
env:
RUSTC_WRAPPER: sccache
RUSTFLAGS: -D warnings
continue-on-error: true
- name: Upload SARIF results
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: rust-clippy-results.sarif
wait-for-processing: true
if: ${{ github.event_name == 'pull_request' }}
- name: Check formatting
run: cargo fmt --check
- name: Check README.md
run: diff README.md <(cat readme-parts/{header,main,license}.md)
- name: Run tests
run: cargo test --verbose
env:
RUSTC_WRAPPER: sccache
- name: Run doctests
run: cargo test --doc --verbose
env:
RUSTC_WRAPPER: sccache
miri:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Try to restore toolchain from cache
id: cache-toolchain
uses: actions/cache@v3
with:
path: |
~/.cargo
~/.rustup
key: ${{ runner.os }}-nightly-miri-${{ env.NIGHTLY_TOOLCHAIN }}-reset1
- name: Install nightly
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
override: true
profile: minimal
components: miri, rust-src
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
- name: Run miri
run: cargo miri test -- --skip ui
build_stable:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Try to restore toolchain & SARIF support from cache
id: cache-toolchain
uses: actions/cache@v3
with:
path: |
~/.cargo
~/.rustup
~/.cache/sccache
key: ${{ runner.os }}-stable-${{ env.STABLE_TOOLCHAIN }}-reset1
- name: Install stable
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.STABLE_TOOLCHAIN }}
override: true
profile: minimal
components: rustc, cargo
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
- name: Install sccache
run: cargo install sccache
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
- name: Run tests
# UI tests are too brittle to run them on two different toolchains
run: cargo test --verbose -- --skip ui
env:
RUSTC_WRAPPER: sccache
- name: Run doctests
run: cargo test --doc --verbose
env:
RUSTC_WRAPPER: sccache