• 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: [1.56.0, stable, beta]
28    timeout-minutes: 45
29    steps:
30      - uses: actions/checkout@v3
31      - uses: dtolnay/rust-toolchain@master
32        with:
33          toolchain: ${{matrix.rust}}
34          components: rust-src
35      - run: cargo test
36      - run: cargo test --no-default-features
37      - run: cargo test --features span-locations
38      - name: RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo test
39        run: cargo test
40        env:
41          RUSTFLAGS: --cfg procmacro2_semver_exempt ${{env.RUSTFLAGS}}
42      - name: RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo test --no-default-features
43        run: cargo test --no-default-features
44        env:
45          RUSTFLAGS: --cfg procmacro2_semver_exempt ${{env.RUSTFLAGS}}
46
47  nightly:
48    name: Rust nightly
49    needs: pre_ci
50    if: needs.pre_ci.outputs.continue
51    runs-on: ubuntu-latest
52    timeout-minutes: 45
53    steps:
54      - uses: actions/checkout@v3
55      - uses: dtolnay/rust-toolchain@nightly
56        with:
57          components: rust-src
58      - name: Enable type layout randomization
59        run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zrandomize-layout >> $GITHUB_ENV
60      - run: cargo test
61      - run: cargo test --no-default-features
62      - run: cargo test --no-default-features --test features -- --ignored make_sure_no_proc_macro # run the ignored test to make sure the `proc-macro` feature is disabled
63      - run: cargo test --features span-locations
64      - run: cargo test --manifest-path tests/ui/Cargo.toml
65      - name: RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo test
66        run: cargo test
67        env:
68          RUSTFLAGS: --cfg procmacro2_semver_exempt ${{env.RUSTFLAGS}}
69      - name: RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo test --no-default-features
70        run: cargo test --no-default-features
71        env:
72          RUSTFLAGS: --cfg procmacro2_semver_exempt ${{env.RUSTFLAGS}}
73      - name: RUSTFLAGS='-Z allow-features=' cargo test
74        run: cargo test
75        env:
76          RUSTFLAGS: -Z allow-features= ${{env.RUSTFLAGS}}
77
78  minimal:
79    name: Minimal versions
80    needs: pre_ci
81    if: needs.pre_ci.outputs.continue
82    runs-on: ubuntu-latest
83    timeout-minutes: 45
84    steps:
85      - uses: actions/checkout@v3
86      - uses: dtolnay/rust-toolchain@nightly
87      - run: cargo generate-lockfile -Z minimal-versions
88      - run: cargo check --locked
89
90  webassembly:
91    name: WebAssembly
92    needs: pre_ci
93    if: needs.pre_ci.outputs.continue
94    runs-on: ubuntu-latest
95    timeout-minutes: 45
96    steps:
97      - uses: actions/checkout@v3
98      - uses: dtolnay/rust-toolchain@nightly
99        with:
100          target: wasm32-unknown-unknown
101          components: rust-src
102      - run: cargo test --target wasm32-unknown-unknown --no-run
103
104  fuzz:
105    name: Fuzz
106    needs: pre_ci
107    if: needs.pre_ci.outputs.continue
108    runs-on: ubuntu-latest
109    timeout-minutes: 45
110    steps:
111      - uses: actions/checkout@v3
112      - uses: dtolnay/rust-toolchain@nightly
113        with:
114          components: rust-src
115      - uses: dtolnay/install@cargo-fuzz
116      - run: cargo fuzz check
117      - run: cargo check --no-default-features --features afl
118        working-directory: fuzz
119      - uses: dtolnay/install@honggfuzz
120      - run: sudo apt-get install binutils-dev libunwind-dev
121        continue-on-error: true # https://github.com/dtolnay/proc-macro2/issues/387
122      - run: cargo hfuzz build --no-default-features --features honggfuzz
123        working-directory: fuzz
124        continue-on-error: true # https://github.com/dtolnay/proc-macro2/issues/387
125
126  clippy:
127    name: Clippy
128    runs-on: ubuntu-latest
129    if: github.event_name != 'pull_request'
130    timeout-minutes: 45
131    steps:
132      - uses: actions/checkout@v3
133      - uses: dtolnay/rust-toolchain@nightly
134        with:
135          components: clippy, rust-src
136      - run: cargo clippy --tests -- -Dclippy::all -Dclippy::pedantic
137      - run: cargo clippy --tests --all-features -- -Dclippy::all -Dclippy::pedantic
138
139  miri:
140    name: Miri
141    needs: pre_ci
142    if: needs.pre_ci.outputs.continue
143    runs-on: ubuntu-latest
144    timeout-minutes: 45
145    steps:
146      - uses: actions/checkout@v3
147      - uses: dtolnay/rust-toolchain@miri
148      - run: cargo miri setup
149      - run: cargo miri test
150        env:
151          MIRIFLAGS: -Zmiri-strict-provenance
152
153  outdated:
154    name: Outdated
155    runs-on: ubuntu-latest
156    if: github.event_name != 'pull_request'
157    timeout-minutes: 45
158    steps:
159      - uses: actions/checkout@v3
160      - uses: dtolnay/install@cargo-outdated
161      - run: cargo outdated --workspace --exit-code 1
162      - run: cargo outdated --manifest-path fuzz/Cargo.toml --exit-code 1
163