• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: CI
2
3on:
4  push:
5  pull_request:
6  workflow_dispatch:
7  schedule: [cron: "40 1 * * *"]
8
9permissions:
10  contents: read
11
12env:
13  RUSTFLAGS: -Dwarnings
14
15jobs:
16  pre_ci:
17    uses: dtolnay/.github/.github/workflows/pre_ci.yml@master
18
19  test:
20    name: Rust ${{matrix.rust}}
21    needs: pre_ci
22    if: needs.pre_ci.outputs.continue
23    runs-on: ubuntu-latest
24    strategy:
25      fail-fast: false
26      matrix:
27        rust: [nightly, beta, stable, 1.52.0, 1.46.0, 1.40.0, 1.39.0, 1.36.0, 1.33.0, 1.32.0, 1.31.0]
28    timeout-minutes: 45
29    steps:
30      - uses: actions/checkout@v4
31      - uses: dtolnay/rust-toolchain@master
32        with:
33          toolchain: ${{matrix.rust}}
34      - name: Enable type layout randomization
35        run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zrandomize-layout >> $GITHUB_ENV
36        if: matrix.rust == 'nightly'
37      - run: cargo test
38      - run: cargo check --no-default-features
39      - run: cargo check --features serde
40      - run: cargo check --no-default-features --features serde
41
42  node:
43    name: Node
44    needs: pre_ci
45    if: needs.pre_ci.outputs.continue
46    runs-on: ubuntu-latest
47    timeout-minutes: 45
48    steps:
49      - uses: actions/checkout@v4
50      - uses: dtolnay/rust-toolchain@stable
51      - run: npm install semver
52      - run: cargo test
53        env:
54          RUSTFLAGS: --cfg test_node_semver ${{env.RUSTFLAGS}}
55
56  minimal:
57    name: Minimal versions
58    needs: pre_ci
59    if: needs.pre_ci.outputs.continue
60    runs-on: ubuntu-latest
61    timeout-minutes: 45
62    steps:
63      - uses: actions/checkout@v4
64      - uses: dtolnay/rust-toolchain@nightly
65      - run: cargo generate-lockfile -Z minimal-versions
66      - run: cargo check --locked --features serde
67
68  doc:
69    name: Documentation
70    needs: pre_ci
71    if: needs.pre_ci.outputs.continue
72    runs-on: ubuntu-latest
73    timeout-minutes: 45
74    env:
75      RUSTDOCFLAGS: -Dwarnings
76    steps:
77      - uses: actions/checkout@v4
78      - uses: dtolnay/rust-toolchain@nightly
79      - uses: dtolnay/install@cargo-docs-rs
80      - run: cargo docs-rs
81
82  clippy:
83    name: Clippy
84    runs-on: ubuntu-latest
85    if: github.event_name != 'pull_request'
86    timeout-minutes: 45
87    steps:
88      - uses: actions/checkout@v4
89      - uses: dtolnay/rust-toolchain@clippy
90      - run: cargo clippy --tests --benches -- -Dclippy::all -Dclippy::pedantic
91
92  miri:
93    name: Miri
94    needs: pre_ci
95    if: needs.pre_ci.outputs.continue
96    runs-on: ubuntu-latest
97    env:
98      MIRIFLAGS: -Zmiri-strict-provenance
99    timeout-minutes: 45
100    steps:
101      - uses: actions/checkout@v4
102      - uses: dtolnay/rust-toolchain@miri
103      - name: Run cargo miri test (64-bit little endian)
104        run: cargo miri test --target x86_64-unknown-linux-gnu
105      - name: Run cargo miri test (64-bit big endian)
106        run: cargo miri test --target powerpc64-unknown-linux-gnu
107      - name: Run cargo miri test (32-bit little endian)
108        run: cargo miri test --target i686-unknown-linux-gnu
109      - name: Run cargo miri test (32-bit big endian)
110        run: cargo miri test --target mips-unknown-linux-gnu
111
112  fuzz:
113    name: Fuzz
114    needs: pre_ci
115    if: needs.pre_ci.outputs.continue
116    runs-on: ubuntu-latest
117    timeout-minutes: 45
118    steps:
119      - uses: actions/checkout@v4
120      - uses: dtolnay/rust-toolchain@nightly
121      - uses: dtolnay/install@cargo-fuzz
122      - run: cargo fuzz check
123
124  outdated:
125    name: Outdated
126    runs-on: ubuntu-latest
127    if: github.event_name != 'pull_request'
128    timeout-minutes: 45
129    steps:
130      - uses: actions/checkout@v4
131      - uses: dtolnay/install@cargo-outdated
132      - run: cargo outdated --workspace --exit-code 1
133      - run: cargo outdated --manifest-path fuzz/Cargo.toml --exit-code 1
134