aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: bfaffaf6c1b18a69396a1df2793e3ee5cc2a6192 (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: CI

on:
  push:
  pull_request:
  schedule: [cron: "40 1 * * *"]

permissions:
  contents: read

env:
  RUSTFLAGS: -Dwarnings

jobs:
  test:
    name: Rust nightly ${{matrix.os == 'windows' && '(windows)' || ''}}
    runs-on: ${{matrix.os}}-latest
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu, windows]
    timeout-minutes: 45
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@nightly
      - run: cargo test
      - run: cargo test --features preserve_order --tests -- --skip ui --exact
      - run: cargo test --features float_roundtrip --tests -- --skip ui --exact
      - run: cargo test --features arbitrary_precision --tests -- --skip ui --exact
      - run: cargo test --features float_roundtrip,arbitrary_precision --tests -- --skip ui --exact
      - run: cargo test --features raw_value --tests -- --skip ui --exact
      - run: cargo test --features unbounded_depth --tests -- --skip ui --exact

  build:
    name: Rust ${{matrix.rust}} ${{matrix.os == 'windows' && '(windows)' || ''}}
    runs-on: ${{matrix.os}}-latest
    strategy:
      fail-fast: false
      matrix:
        rust: [beta, 1.56.1, 1.53.0, 1.46.0, 1.40.0, 1.38.0, 1.36.0]
        os: [ubuntu]
        include:
          - rust: stable
            os: ubuntu
            target: aarch64-unknown-none
          - rust: stable
            os: windows
    timeout-minutes: 45
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{matrix.rust}}
          targets: ${{matrix.target}}
      - run: cargo check
      - run: cargo check --features float_roundtrip
      - run: cargo check --features arbitrary_precision
      - run: cargo check --features raw_value
      - run: cargo check --features unbounded_depth
      - run: cargo check --manifest-path tests/crate/Cargo.toml --no-default-features --features alloc
      - run: cargo check --manifest-path tests/crate/Cargo.toml --no-default-features --features alloc,arbitrary_precision
      - run: cargo check --manifest-path tests/crate/Cargo.toml --no-default-features --features alloc,raw_value
      - run: cargo check --features preserve_order
        if: matrix.rust != '1.53.0' && matrix.rust != '1.46.0' && matrix.rust != '1.45.0' && matrix.rust != '1.40.0' && matrix.rust != '1.38.0' && matrix.rust != '1.36.0'
      - run: cargo check --manifest-path tests/crate/Cargo.toml --no-default-features --features alloc,preserve_order
        if: matrix.rust != '1.53.0' && matrix.rust != '1.46.0' && matrix.rust != '1.45.0' && matrix.rust != '1.40.0' && matrix.rust != '1.38.0' && matrix.rust != '1.36.0'
      - name: Build without std
        run: cargo check --manifest-path tests/crate/Cargo.toml --target ${{matrix.target}} --no-default-features --features alloc
        if: matrix.target

  miri:
    name: Miri
    runs-on: ubuntu-latest
    env:
      MIRIFLAGS: -Zmiri-strict-provenance
    timeout-minutes: 45
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@miri
      - run: cargo miri test
      - run: cargo miri test --features preserve_order,float_roundtrip,arbitrary_precision,raw_value

  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    if: github.event_name != 'pull_request'
    timeout-minutes: 45
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@clippy
      - run: cargo clippy --tests -- -Dclippy::all -Dclippy::pedantic
      - run: cargo clippy --all-features --tests -- -Dclippy::all -Dclippy::pedantic

  docs:
    name: Documentation
    runs-on: ubuntu-latest
    timeout-minutes: 45
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@nightly
      - run: cargo doc --features raw_value,unbounded_depth
        env:
          RUSTDOCFLAGS: --cfg docsrs

  fuzz:
    name: Fuzz
    runs-on: ubuntu-latest
    timeout-minutes: 45
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@nightly
      - uses: dtolnay/install@cargo-fuzz
      - run: cargo fuzz check

  outdated:
    name: Outdated
    runs-on: ubuntu-latest
    if: github.event_name != 'pull_request'
    timeout-minutes: 45
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/install@cargo-outdated
      - run: cargo outdated --workspace --exit-code 1
      - run: cargo outdated --manifest-path fuzz/Cargo.toml --exit-code 1