-
-
Notifications
You must be signed in to change notification settings - Fork 8
112 lines (96 loc) · 2.87 KB
/
ci.yaml
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
name: CI
on:
pull_request:
push:
schedule:
- cron: '29 1 * * *' # *-*-* 01:29:00 UTC
permissions:
contents: read
env:
RUST_BACKTRACE: full
RUSTFLAGS: -Dwarnings
jobs:
test:
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
rust: [nightly, beta, stable]
os: [ubuntu-latest, macos-latest, windows-latest]
name: Test ${{ matrix.rust }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust ${{ matrix.rust }}
run: |
rustup update --no-self-update beta
rustup default ${{ matrix.rust }}
rustup component add rust-analyzer
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Install cargo-hack
# Always use stable rustc to compile cargo-hack, which has MSRV 1.65.
# https://github.com/taiki-e/cargo-hack/commit/5baa4262710414ebde4845494f1db22643acc0ba
run: cargo +stable install cargo-hack
# `cargo build` doesn't pull in [dev-dependencies].
- name: Build
run: cargo hack build --each-feature
- name: Doc test
run: cargo hack test --each-feature --doc
- name: Test
run: cargo hack test --each-feature --all-targets
- name: Test examples
run: cargo test --all-features --examples -- --ignored
msrv:
timeout-minutes: 15
name: MSRV
strategy:
fail-fast: false
matrix:
# FIXME: MacOS' `sed` is incompatible with `gnused`.
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
# Sync with Cargo.toml!
- name: Install Rust
run: |
rustup update --no-self-update stable
rustup default 1.64
rustup component add rust-analyzer
- name: Build
# Workaround of `-Z avoid-dev-deps`
# See: https://github.com/rust-lang/cargo/issues/5133#issuecomment-1307094647
run: |
sed -i 's/\[dev-dependencies]/[workaround-avoid-dev-deps]/g' ./Cargo.toml
cargo build --all-features
clippy:
name: Clippy
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
run: |
rustup update --no-self-update stable
rustup default stable
- run: |
cargo clippy --all-targets --all-features -- -Dclippy::all
docs:
name: Docs
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
run: |
rustup update --no-self-update stable
rustup default stable
- name: cargo doc
env:
RUSTDOCFLAGS: --cfg docsrs_ -Dwarnings
run: cargo doc --all-features