main
yml 83 lines 2.96 KB
Raw
1 name: Tests
2
3 # Runs on every push.
4 # Covers the Rust workspace: formatting, clippy, tests, and the rustdoc
5 # build (which catches broken intra-doc links, of which this crate has
6 # many).
7 on: push
8
9 # A newer push to the same ref supersedes the run in flight, so a burst of
10 # pushes to a branch doesn't queue a full ubuntu + macOS matrix for each one.
11 concurrency:
12 group: ci-${{ github.ref }}
13 cancel-in-progress: true
14
15 env:
16 CARGO_TERM_COLOR: always
17
18 jobs:
19 test:
20 # Both hosts on purpose. The CSR tests shell out to `openssl` to verify
21 # our output against an independent implementation, and the two runners
22 # ship different ones: ubuntu has OpenSSL 3, macOS has LibreSSL. They
23 # disagree on which stream the `verify OK` banner goes to, so a
24 # single-host matrix would let a real portability bug through. macOS is
25 # also where this crate's signing work ultimately has to run, since
26 # keychain access exists nowhere else.
27 name: Rust (${{ matrix.os }})
28 runs-on: ${{ matrix.os }}
29 strategy:
30 # Don't cancel the other host on first failure: when a test fails on
31 # exactly one of them, that difference is the most useful part of the
32 # report.
33 fail-fast: false
34 matrix:
35 os: [ubuntu-latest, macos-latest]
36
37 steps:
38 - name: Checkout
39 uses: actions/checkout@v6
40
41 - name: Install toolchain
42 uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
43 with:
44 toolchain: stable
45 components: rustfmt, clippy
46
47 - name: Setup Rust cache
48 uses: Swatinem/rust-cache@v2
49 with:
50 key: test-${{ matrix.os }}
51
52 - name: Report the openssl in use
53 # Recorded because it decides how the CSR verification tests
54 # behave, and it changes under us when GitHub bumps runner images.
55 run: openssl version
56
57 - name: Check formatting
58 run: cargo fmt --all -- --check
59
60 - name: Clippy
61 run: cargo clippy --workspace --all-targets --locked -- -D warnings
62
63 - name: Test
64 run: cargo test --workspace --locked
65
66 - name: Check each library builds on its own
67 # The layering only means something if the lower crates can be built
68 # without the upper ones. A workspace build would happily compile
69 # core with the MCP server's dependencies already in the graph and
70 # tell us nothing.
71 run: |
72 cargo check --package smbcloud-ascapi-core --locked
73 cargo check --package smbcloud-ascapi-aso --locked
74 cargo check --package smbcloud-ascapi-signing --locked
75 cargo check --package smbcloud-ascapi-play --locked
76
77 - name: Build docs
78 # Intra-doc links are load-bearing in this crate: the certificate
79 # module's warnings about lost private keys point at the csr module
80 # that explains them. A broken link silently drops that thread.
81 env:
82 RUSTDOCFLAGS: -D warnings
83 run: cargo doc --no-deps --workspace --locked