Debian Codegraph @

.github/workflows/ci.yml

raw
1 name: CI
2
3 on:
4 push:
5 # Ignore bors branches, since they are covered by `clippy_bors.yml`
6 branches:
7 - main
8 # Don't run Clippy tests, when only textfiles were modified
9 paths-ignore:
10 - 'README'
11 - 'COPYRIGHT'
12 - 'LICENSE-*'
13 - '**.md'
14 - '**.txt'
15 pull_request:
16 # Don't run Clippy tests, when only textfiles were modified
17 paths-ignore:
18 - 'README'
19 - 'COPYRIGHT'
20 - 'LICENSE-*'
21 - '**.md'
22 - '**.txt'
23 workflow_dispatch:
24 schedule: [cron: "0 1 */7 * *"]
25
26 env:
27 CARGO_TERM_COLOR: always
28 RUSTFLAGS: -Dwarnings
29 RUST_BACKTRACE: 1
30 nightly: nightly
31
32 jobs:
33 # Check formatting
34 rustfmt:
35 name: rustfmt
36 runs-on: ubuntu-latest
37 steps:
38 - uses: actions/checkout@v4
39 - name: Install Rust
40 run: rustup update stable && rustup default stable
41 - name: Check formatting
42 run: rustfmt --check --edition 2021 $(git ls-files '*.rs')
43
44 # This represents the minimum Rust version supported by
45 # Bytes. Updating this should be done in a dedicated PR.
46 #
47 # Tests are not run as tests may require newer versions of
48 # rust.
49 minrust:
50 name: minrust
51 runs-on: ubuntu-latest
52 steps:
53 - uses: actions/checkout@v4
54 - name: Install Rust
55 run: rustup update 1.75.0 && rustup default 1.75.0
56 - name: Check
57 run: cargo check
58
59 # Apply clippy lints
60 clippy:
61 name: clippy
62 runs-on: ubuntu-latest
63 steps:
64 - uses: actions/checkout@v4
65 - name: Apply clippy lints
66 run: cargo clippy --all-features
67
68 unit-tests:
69 name: unit tests
70 runs-on: ${{ matrix.os }}
71 strategy:
72 matrix:
73 rust:
74 - nightly
75 os:
76 - macos-latest
77 - windows-latest
78 - ubuntu-latest
79 steps:
80 - uses: actions/checkout@v4
81 - name: Install latest nightly
82 uses: actions-rs/toolchain@v1
83 with:
84 toolchain: ${{ matrix.rust }}
85 override: true
86 components: rustfmt, clippy
87
88 - uses: Swatinem/rust-cache@v1
89 - uses: actions/cache@v4
90 with:
91 path: |
92 ~/.cargo/registry
93 ~/.cargo/git
94 target
95 key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
96
97 - name: test all features
98 # Run sequentially to avoid race condition around file system size
99 run: cargo test --all-features -- --test-threads 1
100 docs:
101 name: docs
102 runs-on: ubuntu-latest
103 steps:
104 - uses: actions/checkout@v4
105 - name: Cache cargo build and registry
106 uses: actions/cache@v4
107 with:
108 path: |
109 ~/.cargo/registry
110 ~/.cargo/git
111 target
112 key: ubuntu-latest-docs-${{ hashFiles('**/Cargo.lock') }}
113 restore-keys: |
114 ubuntu-latest-docs-
115 - uses: actions-rs/toolchain@v1
116 with:
117 toolchain: ${{ env.nightly }}
118 override: true
119 - name: "doc --lib --all-features"
120 run: cargo doc --lib --no-deps --all-features
121 env:
122 RUSTFLAGS: --cfg docsrs
123 RUSTDOCFLAGS: --cfg docsrs -Dwarnings
124
125 coverage:
126 name: cargo tarpaulin
127 runs-on: ubuntu-latest
128 needs:
129 - unit-tests
130 - clippy
131 - rustfmt
132 - minrust
133 steps:
134 - uses: actions/checkout@v4
135 - name: Install latest nightly
136 uses: actions-rs/toolchain@v1
137 with:
138 toolchain: nightly
139 override: true
140 - uses: actions-rs/[email protected]
141 with:
142 crate: cargo-tarpaulin
143 version: latest
144 - name: Cache ~/.cargo
145 uses: actions/cache@v4
146 with:
147 path: ~/.cargo
148 key: ${{ runner.os }}-coverage-dotcargo
149 - name: Cache cargo build
150 uses: actions/cache@v4
151 with:
152 path: target
153 key: ${{ runner.os }}-coverage-cargo-build-target
154 - name: Run tarpaulin
155 uses: actions-rs/cargo@v1
156 with:
157 command: tarpaulin
158 args: --all-features --run-types tests --run-types doctests --workspace --out xml
159 - name: Upload to codecov.io
160 uses: codecov/codecov-action@v4
161 with:
162 token: ${{ secrets.CODECOV_TOKEN }}
163 fail_ci_if_error: true
164 slug: al8n/fs4-rs