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
name: CI
on:
push:
branches:
pull_request:
# So release.yml can gate a release on this exact matrix rather than
# restating a copy of it that would drift.
workflow_call:
env:
CARGO_TERM_COLOR: always
# So a panicking test says where, rather than just exiting 101.
RUST_BACKTRACE: 1
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Stable, not nightly: rustfmt.toml sets only `edition`, which stable has
# handled since 1.85. Formatting on nightly means an unrelated nightly
# can turn CI red on code nobody touched.
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- run: cargo fmt --all -- --check
test:
strategy:
fail-fast: false
matrix:
os:
# The MSRV is in the matrix so `rust-version` in Cargo.toml stays a
# fact rather than an aspiration.
toolchain:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- uses: Swatinem/rust-cache@v2
# -D warnings belongs here, after the --, so it applies to this crate
# only. As a global RUSTFLAGS it would also deny warnings in every
# dependency, and a new lint in a newer compiler would then fail the
# build for code that is not ours.
#
# Clippy is skipped on the MSRV row: its lints move with the compiler, so
# pinning an old one only tests which lints existed in 1.88.
- run: cargo clippy --all-targets --all-features -- -D warnings
if: matrix.toolchain != '1.88'
# --all-features is what builds fake-ssh. Without it tests/e2e.rs cfgs
# itself out and the end-to-end suite reports zero tests, in green.
- run: cargo test --all-features --all-targets
# --all-targets silently excludes doctests, so they need their own run.
- run: cargo test --doc