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
# Format, lint, test and package the crate on its own, the way someone who
# clones this repository would.
#
# This repository mirrors packages/wuapi-sdk-rust of the wuapi monorepo (see
# RELEASING.md); the same checks run there before anything lands here.
name: CI
on:
push:
branches:
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
stable:
name: Stable (fmt, clippy, test, package)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v5
# This action has no major tags: the ref names the toolchain, like the
# `channel = "stable"` of rust-toolchain.toml.
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --check
- run: cargo clippy --all-targets -- -D warnings
- run: cargo test
- name: Package (dry run)
run: cargo publish --dry-run
msrv:
name: MSRV (rust-version of Cargo.toml)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v5
- name: Read rust-version
id: msrv
run: echo "version=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].rust_version')" >> "$GITHUB_OUTPUT"
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.msrv.outputs.version }}
- uses: Swatinem/rust-cache@v2
# `+<version>` wins over rust-toolchain.toml, which names stable. The
# library only: the tests' dependencies may need a newer compiler.
- run: cargo "+${{ steps.msrv.outputs.version }}" check