summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: 8353c96615fb2fd500f12ca02062357d789407e3 (plain)
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
name: Rust CI checks
on:
  push:
  pull_request:

env:
  CARGO_TERM_COLOR: always
# Make sure CI fails on all warnings, including Clippy lints
  RUSTFLAGS: "-Dwarnings"

jobs:
  lint:
    name: Run lint checks
    runs-on: ubuntu-latest
    strategy:
      matrix:
        feature:
          - actix4,warp,axum
          - actix3
    steps:
      - uses: actions/checkout@v2
      - name: Install Rust stable toolchain
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: stable
          components: rustfmt, clippy
      - name: Run formatting
        run: cargo fmt --all --check
      - name: Run Clippy
        run: cargo clippy --all-targets -F "${{ matrix.feature }}"

  test:
    name: Run tests
    runs-on: ubuntu-latest
    strategy:
      matrix:
        # NOTE: this crate's MSRC if 1.63
        # However, many of the web frameworks that 
        # this provides support for have greater/missing MSRVs.
        # We attempt to test the MSRV here if it is known.
        rust:
          - stable
          - 1.63.0
        feature:
          - ""
          - actix4
          - actix3
          - warp
          - axum

        # test frameworks for specific MSRVs (where known)
        include:
        # axum 0.8 has a MSRV of 1.75.0
        - rust: 1.75.0
          feature: axum

        # exclude frameworks that have a different/unknown MSRV
        exclude:
        - rust: 1.63.0
          feature: axum
        # actix does not seem to actually adhere
        # to its MSRV -- it states 1.75 but has a dependency `zerofrom`
        # that requires Rust 1.81. We'll punt on testing it
        - rust: 1.63.0
          feature: actix4
        - rust: 1.63.0
          feature: actix3
        # warp does not list an MSRV
        # see: https://github.com/seanmonstar/warp/issues/1077
        - rust: 1.63.0
          feature: warp
    steps:
      - uses: actions/checkout@v4
      - name: Install Rust stable toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: ${{ matrix.rust }}
      - name: Run test ${{ matrix.feature }}
        run: |
          cargo test --all-targets --features "${{ matrix.feature }}"
          cargo test --doc --features "${{ matrix.feature }}"