aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: 37ced3c0766b1ab49de20428abead0c103b76cf8 (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
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

name: CI

jobs:
  ci:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        rust:
          - 1.36.0  # MSRV
          - stable
          - beta
          - nightly
        features:
          - ""
          - "serde"

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Set up Rust
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust }}

      - name: MSRV dependencies
        if: matrix.rust == '1.36.0'
        run: |
          cargo generate-lockfile
          cargo update -p serde_json --precise 1.0.99
          cargo update -p serde --precise 1.0.156
          cargo update -p quote --precise 1.0.30
          cargo update -p proc-macro2 --precise 1.0.65

      - name: Build (no_std)
        run: cargo build --no-default-features

      - name: Build
        run: cargo build --features "${{ matrix.features }}"

      - name: Test
        run: cargo test --features "${{ matrix.features }}"

      - name: Doc
        run: cargo doc --features "${{ matrix.features }}"

  clippy:
    name: Rustfmt and Clippy
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Set up nightly Rust
        uses: dtolnay/rust-toolchain@nightly
        with:
          components: rustfmt, clippy

      - name: Rustfmt
        run: cargo fmt --all -- --check

      - name: Clippy
        run: cargo clippy  # -- -D warnings