Debian Codegraph @

.cargo/vendor/bytes/.github/workflows/ci.yml

raw
1 name: CI
2
3 on:
4 pull_request:
5 branches:
6 - master
7 push:
8 branches:
9 - master
10 schedule:
11 - cron: '0 2 * * 0'
12
13 env:
14 RUSTFLAGS: -Dwarnings
15 RUST_BACKTRACE: 1
16 nightly: nightly-2024-09-15
17
18 defaults:
19 run:
20 shell: bash
21
22 jobs:
23 # Check formatting
24 rustfmt:
25 name: rustfmt
26 runs-on: ubuntu-latest
27 steps:
28 - uses: actions/checkout@v4
29 - name: Install Rust
30 run: rustup update stable
31 - name: Check formatting
32 run: cargo fmt --all --check
33
34 # TODO
35 # # Apply clippy lints
36 # clippy:
37 # name: clippy
38 # runs-on: ubuntu-latest
39 # steps:
40 # - uses: actions/checkout@v4
41 # - name: Apply clippy lints
42 # run: cargo clippy --all-features
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 cargo-hack
55 uses: taiki-e/install-action@cargo-hack
56 - name: Check
57 run: cargo hack check --feature-powerset --optional-deps --rust-version
58
59 # Stable
60 stable:
61 name: stable
62 strategy:
63 matrix:
64 os:
65 - ubuntu-latest
66 - ubuntu-22.04-arm # TODO: update to 24.04 when https://github.com/rust-lang/rust/issues/135867 solved
67 - macos-latest
68 - windows-latest
69 runs-on: ${{ matrix.os }}
70 steps:
71 - uses: actions/checkout@v4
72 - name: Install Rust
73 # --no-self-update is necessary because the windows environment cannot self-update rustup.exe.
74 run: rustup update stable --no-self-update
75 - name: Install cargo-hack
76 uses: taiki-e/install-action@cargo-hack
77 - name: Test
78 run: ci/test-stable.sh test
79
80 # Nightly
81 nightly:
82 name: nightly
83 runs-on: ubuntu-latest
84 steps:
85 - uses: actions/checkout@v4
86 - name: Install Rust
87 run: rustup update $nightly && rustup default $nightly
88 - name: Install cargo-hack
89 uses: taiki-e/install-action@cargo-hack
90 - name: Test
91 run: ci/test-stable.sh test
92
93 panic-abort:
94 name: panic=abort tests
95 runs-on: ubuntu-latest
96 steps:
97 - uses: actions/checkout@v4
98 - name: Install Rust
99 run: rustup update $nightly && rustup default $nightly
100 - name: Run tests with -Cpanic=abort
101 run: ci/panic-abort.sh
102
103 # Run tests on some extra platforms
104 cross:
105 name: cross
106 strategy:
107 matrix:
108 include:
109 - target: i686-unknown-linux-gnu
110 os: ubuntu-latest
111 - target: armv7-unknown-linux-gnueabihf
112 os: ubuntu-22.04-arm # TODO: update to 24.04 when https://github.com/rust-lang/rust/issues/135867 solved
113 - target: powerpc-unknown-linux-gnu
114 os: ubuntu-latest
115 - target: powerpc64-unknown-linux-gnu
116 os: ubuntu-latest
117 - target: wasm32-wasip1
118 os: ubuntu-latest
119 runs-on: ${{ matrix.os }}
120 steps:
121 - uses: actions/checkout@v4
122 - name: Install Rust
123 run: rustup update stable
124 - uses: taiki-e/setup-cross-toolchain-action@v1
125 with:
126 target: ${{ matrix.target }}
127 - name: Test
128 run: cargo test --target ${{ matrix.target }}
129
130 # Build for no_std environment.
131 no-std:
132 runs-on: ubuntu-latest
133 steps:
134 - uses: actions/checkout@v4
135 - name: Install Rust
136 run: rustup update stable
137 - name: Install cargo-hack
138 uses: taiki-e/install-action@cargo-hack
139 # thumbv6m-none-eabi supports atomic, but not atomic CAS.
140 # thumbv7m-none-eabi supports atomic CAS.
141 - run: rustup target add thumbv6m-none-eabi thumbv7m-none-eabi
142 # * --optional-deps is needed for serde feature
143 # * --no-dev-deps is needed to avoid https://github.com/rust-lang/cargo/issues/4866
144 - run: cargo hack build --target thumbv7m-none-eabi --feature-powerset --skip std,default --optional-deps --no-dev-deps
145 # A sound way to provide atomic CAS on platforms without native atomic CAS is system-dependent.
146 # portable-atomic provides major ways via cfgs and accepts user-defined implementations via critical-section feature.
147 - run: cargo hack build --target thumbv6m-none-eabi --feature-powerset --skip std,default --optional-deps --no-dev-deps --features extra-platforms,extra-platforms/critical-section
148
149 # Sanitizers
150 tsan:
151 name: tsan
152 runs-on: ubuntu-latest
153 steps:
154 - uses: actions/checkout@v4
155 - name: Install Rust
156 run: rustup update $nightly && rustup default $nightly
157 - name: Install rust-src
158 run: rustup component add rust-src
159 - name: ASAN / TSAN
160 run: ci/tsan.sh
161
162 miri:
163 name: miri
164 runs-on: ubuntu-latest
165 steps:
166 - uses: actions/checkout@v4
167 - name: Install Rust
168 run: rustup update $nightly && rustup default $nightly
169 - name: Miri
170 run: ci/miri.sh
171
172 # Loom
173 loom:
174 name: loom
175 runs-on: ubuntu-latest
176 steps:
177 - uses: actions/checkout@v4
178 - name: Install Rust
179 run: rustup update $nightly && rustup default $nightly
180 - name: Loom tests
181 run: RUSTFLAGS="--cfg loom -Dwarnings" cargo test --lib
182
183 publish_docs:
184 name: Publish Documentation
185 needs:
186 - rustfmt
187 # - clippy
188 - stable
189 - nightly
190 - minrust
191 - cross
192 - tsan
193 - miri
194 - loom
195 runs-on: ubuntu-latest
196 steps:
197 - uses: actions/checkout@v4
198 - name: Install Rust
199 run: rustup update $nightly && rustup default $nightly
200 - name: Build documentation
201 run: cargo doc --no-deps --all-features
202 env:
203 RUSTDOCFLAGS: --cfg docsrs
204 - name: Publish documentation
205 run: |
206 cd target/doc
207 git init
208 git add .
209 git -c user.name='ci' -c user.email='ci' commit -m 'Deploy Bytes API documentation'
210 git push -f -q https://git:${{ secrets.github_token }}@github.com/${{ github.repository }} HEAD:gh-pages
211 if: github.event_name == 'push' && github.event.ref == 'refs/heads/master' && github.repository == 'tokio-rs/bytes'