summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: 3dca52497a4c0181d92777d219d85ff8dc52151c (plain) (blame)
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
name: Continuous integration
on: [push, pull_request, merge_group]

env:
  RUSTFLAGS: "-Dwarnings"
  RUSTDOCFLAGS: "-Dwarnings"
  TYPST_TESTS_EXTENDED: true

jobs:
  # This allows us to have one branch protection rule for the full test matrix.
  # See: https://github.com/orgs/community/discussions/4324
  tests:
    name: Tests
    runs-on: ubuntu-latest
    needs: [test-matrix]
    if: always()
    steps:
      - name: Tests successful
        if: ${{ !(contains(needs.*.result, 'failure')) }}
        run: exit 0
      - name: Tests failing
        if: ${{ contains(needs.*.result, 'failure') }}
        run: exit 1

  test-matrix:
    name: Tests
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@1.79.0
      - uses: Swatinem/rust-cache@v2
      - run: cargo test --workspace --no-run
      - run: cargo test --workspace --no-fail-fast

  checks:
    name: Check clippy, formatting, and documentation
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@1.79.0
        with:
          components: clippy, rustfmt
      - uses: Swatinem/rust-cache@v2
      - run: cargo clippy --workspace --all-targets --all-features
      - run: cargo fmt --check --all
      - run: cargo doc --workspace --no-deps

  min-version:
    name: Check mininum Rust version
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@1.77.0
      - uses: Swatinem/rust-cache@v2
      - run: cargo check --workspace

  fuzz:
    name: Check fuzzers
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: nightly-2024-06-01
      - uses: Swatinem/rust-cache@v2
      - run: cargo install --locked cargo-fuzz@0.12.0
      - run: cd tests/fuzz && cargo fuzz build --dev