-
Notifications
You must be signed in to change notification settings - Fork 31
100 lines (81 loc) · 2.69 KB
/
ci.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
# Mostly copied from https://github.com/rust-lang/docs.rs/blob/master/.github/workflows/ci.yml
name: CI
on: [push, pull_request]
jobs:
nightly-clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- name: restore build & cargo cache
uses: Swatinem/rust-cache@v1
- name: show warnings as check annotations on the PR
# rust.json is copied from https://github.com/hecrj/setup-rust-action/blob/master/.github/rust.json
run: echo "##[add-matcher].github/rust.json"
- run: cargo clippy --all-targets --all-features --color never
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: windows-latest
target: i686-pc-windows-msvc
- os: windows-latest
target: x86_64-pc-windows-gnu
- os: windows-latest
target: i686-pc-windows-gnu
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master
- uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- name: restore build & cargo cache
uses: Swatinem/rust-cache@v1
- name: show warnings as check annotations on the PR
run: echo "##[add-matcher].github/rust.json"
- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --locked -- -D warnings
- name: Test
run: cargo test
test-cross:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-gnu
- name: restore build & cargo cache
uses: Swatinem/rust-cache@v1
- name: show warnings as check annotations on the PR
run: echo "##[add-matcher].github/rust.json"
- name: Test cross-compile
uses: actions-rs/cargo@v1
env:
RUSTFLAGS: -Dwarnings
with:
command: check
args: --target x86_64-pc-windows-gnu --all-targets --locked
# This fails often and also doesn't take long to run. Put it in a separate job.
fmt:
name: fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt
- name: show warnings as check annotations on the PR
run: echo "##[add-matcher].github/rust.json"
- uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check