-
Notifications
You must be signed in to change notification settings - Fork 737
137 lines (135 loc) · 3.94 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
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
name: CI
on:
push:
branches: [ "master", "v0.7.x" ]
pull_request:
branches: [ "master", "v0.7.x" ]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
CI: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
Test:
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Install Cargo-hack
run: cargo install --debug cargo-hack
- name: Check all features
run: cargo hack check --feature-powerset
- name: Tests
run: cargo test --all-features
- name: Tests release build
run: cargo test --release --all-features
MinimalVersions:
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
- name: Install minimal verions
run: cargo update -Zminimal-versions
- name: Tests
run: cargo test --all-features
MSRV:
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-latest"]
# TODO: once we update our MSRV above 1.53 add macOS again. Currently
# macOS, specifically Xcode 14, broke support for rustc < 1.53. See
# https://github.com/rust-lang/rust/issues/105167.
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
# NOTE: When updating also update Clippy flags, some are disabled due to
# MSRV.
toolchain: 1.46.0
- name: Check
# We only run check allowing us to use newer features in tests.
# We enable all features except for the `log` feature as since log v0.4.19
# it requires a MSRV later then rustc 1.46.
run: cargo check --no-default-features --features os-poll,os-ext,net
Nightly:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
- name: Tests
run: cargo test --all-features
Clippy:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Clippy
# NOTE: `clippy::uninlined-format-args` is enabled due to MSRV.
run: cargo clippy --all-features -- -D warnings -A clippy::cognitive-complexity -A clippy::uninlined-format-args
Docs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Check docs
run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
Rustfmt:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
# FIXME: for some reason this doesn't actually check all files.
# So instead we run `rustfmt` directly on each file.
#cargo fmt --all -- --check
run: find src tests examples -type f -iname "*.rs" | xargs rustfmt --check
CheckTargets:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Install all targets
run: make install_targets
- name: Install Cargo-hack
run: cargo install --debug cargo-hack
- name: Check all targets
run: make check_all_targets
# Single job required to merge the pr.
Passed:
runs-on: ubuntu-latest
needs:
- Test
- MinimalVersions
- MSRV
- Nightly
- Clippy
- Docs
- Rustfmt
- CheckTargets
steps:
- run: exit 0