Upgrade cosmic-text to 0.13 (#815)
1on:
2 pull_request:
3 push:
4 branches:
5 - main
6 - 0.2.x
7 - 0.3.x
8
9name: CI
10
11env:
12 RUSTDOCFLAGS: "-D warnings"
13 CARGO_REGISTRIES_CRATES_IO_PROTOCOL: "sparse"
14
15jobs:
16 # MSRV check.
17 # Taffy only guarantees "latest stable". However we have this check here to ensure that we advertise
18 # our MSRV. We also make an effort not to increase MSRV in patch versions of Taffy.
19 #
20 # We only run `cargo build` (not `cargo test`) so as to avoid requiring dev-dependencies to build with the MSRV
21 # version. Building is likely sufficient as runtime errors varying between rust versions is very unlikely.
22 build-features-msrv:
23 name: "MSRV Build [Rust 1.65]"
24 runs-on: ubuntu-latest
25 steps:
26 - uses: actions/checkout@v4
27 - uses: dtolnay/rust-toolchain@master
28 with:
29 toolchain: 1.65
30 - run: cargo build
31
32 build-features-debug:
33 name: "Build [debug feature]"
34 runs-on: ubuntu-latest
35 steps:
36 - uses: actions/checkout@v4
37 - uses: dtolnay/rust-toolchain@stable
38 - run: cargo build --features debug
39
40 build-examples:
41 name: "Build Examples"
42 runs-on: ubuntu-latest
43 steps:
44 - uses: actions/checkout@v4
45 - uses: dtolnay/rust-toolchain@stable
46 - run: cargo build --examples
47
48 # cosmic_text example is excluded from the workspace as it breaks compilation of all crates
49 # in the workspace with our MSRV compiler
50 build-cosmic-text-example:
51 name: "Build cosmic-text example"
52 runs-on: ubuntu-latest
53 steps:
54 - uses: actions/checkout@v4
55 - uses: dtolnay/rust-toolchain@stable
56 - run: cd examples/cosmic_text && cargo build
57
58 # No features
59 test-features-none:
60 name: "Test Suite [no features]"
61 runs-on: ubuntu-latest
62 steps:
63 - uses: actions/checkout@v4
64 - uses: dtolnay/rust-toolchain@stable
65 - run: cargo build --no-default-features
66 - run: cargo test --tests --no-default-features --features taffy_tree
67
68 # Default
69 test-features-default:
70 name: "Test Suite [default features]"
71 runs-on: ubuntu-latest
72 steps:
73 - uses: actions/checkout@v4
74 - uses: dtolnay/rust-toolchain@stable
75 - run: cargo build
76 - run: cargo test --tests
77
78 test-features-default-with-serde:
79 name: "Test Suite [default + serde]"
80 runs-on: ubuntu-latest
81 steps:
82 - uses: actions/checkout@v4
83 - uses: dtolnay/rust-toolchain@stable
84 - run: cargo build --features serde
85 - run: cargo test --tests --features serde
86
87 test-features-default-except-content-size:
88 name: "Test Suite [default except content_size]"
89 runs-on: ubuntu-latest
90 steps:
91 - uses: actions/checkout@v4
92 - uses: dtolnay/rust-toolchain@stable
93 - run: cargo build --no-default-features --features std,taffy_tree,grid,flexbox,block_layout
94 - run: cargo test --tests --no-default-features --features std,taffy_tree,grid,flexbox,block_layout,calc
95
96 test-features-default-except-calc:
97 name: "Test Suite [default except calc]"
98 runs-on: ubuntu-latest
99 steps:
100 - uses: actions/checkout@v4
101 - uses: dtolnay/rust-toolchain@stable
102 - run: cargo build --no-default-features --features std,taffy_tree,grid,flexbox,block_layout
103 - run: cargo test --tests --no-default-features --features std,taffy_tree,grid,flexbox,block_layout
104
105 test-features-no-grid-nor-flexbox:
106 name: "Test Suite [std (no algorithms)]"
107 runs-on: ubuntu-latest
108 steps:
109 - uses: actions/checkout@v4
110 - uses: dtolnay/rust-toolchain@stable
111 - run: cargo build --no-default-features --features std
112 - run: cargo build --no-default-features --features std,taffy_tree
113 - run: cargo test --tests --no-default-features --features std,taffy_tree,calc
114
115 # With std feature
116 test-features-flexbox:
117 name: "Test Suite [std + flexbox]"
118 runs-on: ubuntu-latest
119 steps:
120 - uses: actions/checkout@v4
121 - uses: dtolnay/rust-toolchain@stable
122 - run: cargo build --no-default-features --features flexbox,std
123 - run: cargo build --no-default-features --features flexbox,std,taffy_tree
124 - run: cargo test --tests --no-default-features --features flexbox,std,taffy_tree
125
126 test-features-grid:
127 name: "Test Suite [std + grid]"
128 runs-on: ubuntu-latest
129 steps:
130 - uses: actions/checkout@v4
131 - uses: dtolnay/rust-toolchain@stable
132 - run: cargo build --no-default-features --features grid,std
133 - run: cargo build --no-default-features --features grid,std,taffy_tree
134 - run: cargo test --tests --no-default-features --features grid,std,taffy_tree
135
136 test-features-block:
137 name: "Test Suite [std + block)]"
138 runs-on: ubuntu-latest
139 steps:
140 - uses: actions/checkout@v4
141 - uses: dtolnay/rust-toolchain@stable
142 - run: cargo build --no-default-features --features block_layout,std
143 - run: cargo build --no-default-features --features block_layout,std,taffy_tree
144 - run: cargo test --tests --no-default-features --features block_layout,std,taffy_tree
145
146 # With detailed layout info
147 test-features-grid-detailed-info:
148 name: "Test Suite [std + grid + detailed_layout_info]"
149 runs-on: ubuntu-latest
150 steps:
151 - uses: actions/checkout@v4
152 - uses: dtolnay/rust-toolchain@stable
153 - run: cargo build --no-default-features --features grid,detailed_layout_info,std
154 - run: cargo build --no-default-features --features grid,detailed_layout_info,std,taffy_tree
155 - run: cargo test --tests --no-default-features --features grid,detailed_layout_info,std,taffy_tree
156
157 # With detailed layout info
158 test-features-flex-detailed-info:
159 name: "Test Suite [std + flexbox + detailed_layout_info]"
160 runs-on: ubuntu-latest
161 steps:
162 - uses: actions/checkout@v4
163 - uses: dtolnay/rust-toolchain@stable
164 - run: cargo build --no-default-features --features flexbox,detailed_layout_info,std
165 - run: cargo build --no-default-features --features flexbox,detailed_layout_info,std,taffy_tree
166 - run: cargo test --tests --no-default-features --features flexbox,detailed_layout_info,std,taffy_tree
167
168 # With alloc feature
169
170 test-features-grid-with-alloc:
171 name: "Test Suite [alloc + no algorithms]"
172 runs-on: ubuntu-latest
173 steps:
174 - uses: actions/checkout@v4
175 - uses: dtolnay/rust-toolchain@stable
176 - run: cargo build --no-default-features --features alloc
177 - run: cargo build --no-default-features --features alloc,taffy_tree
178 - run: cargo test --tests --no-default-features --features alloc,taffy_tree
179
180 test-features-alloc:
181 name: "Test Suite [alloc + all algorithms]"
182 runs-on: ubuntu-latest
183 steps:
184 - uses: actions/checkout@v4
185 - uses: dtolnay/rust-toolchain@stable
186 - run: cargo build --no-default-features --features alloc,grid,flexbox,block_layout
187 - run: cargo build --no-default-features --features alloc,grid,flexbox,block_layout,taffy_tree
188 - run: cargo test --tests --no-default-features --features alloc,grid,flexbox,block_layout,taffy_tree
189
190 fmt:
191 name: Rustfmt
192 runs-on: ubuntu-latest
193 steps:
194 - uses: actions/checkout@v4
195 - uses: dtolnay/rust-toolchain@master
196 with:
197 toolchain: stable
198 components: rustfmt
199 - run: cargo fmt --all -- --check
200
201 clippy:
202 name: Clippy
203 runs-on: ubuntu-latest
204 steps:
205 - uses: actions/checkout@v4
206 - uses: dtolnay/rust-toolchain@master
207 with:
208 toolchain: nightly
209 components: clippy
210 - run: cargo +nightly clippy --workspace -- -D warnings
211
212 # Run rustdoc with the `docsrs` cfg to ensure that the documentation is compatible with docs.rs.
213 # This enables the doc_auto_cfg feature, which requires the nightly toolchain.
214 # Also checks that the examples can be scraped.
215 doc:
216 name: Documentation
217 runs-on: ubuntu-latest
218 env:
219 RUSTDOCFLAGS: "--cfg docsrs"
220 steps:
221 - uses: actions/checkout@v4
222 - uses: dtolnay/rust-toolchain@master
223 with:
224 toolchain: nightly
225 components: clippy
226 - run: cargo +nightly doc -Zunstable-options -Zrustdoc-scrape-examples --all-features --no-deps
227
228 markdownlint:
229 name: Markdown Lint
230 runs-on: ubuntu-latest
231 steps:
232 - uses: actions/checkout@v4
233 - name: Run Markdown Lint
234 uses: DavidAnson/markdownlint-cli2-action@v19
235 with:
236 globs: "**/*.md"
237
238 fixture-format:
239 name: Test Fixture Formatting
240 runs-on: ubuntu-latest
241 steps:
242 - uses: actions/checkout@v4
243 - name: Run format script
244 run: cargo run -p format-fixtures
245 - name: Ensure no changes
246 run: |
247 if [ -z "$(git status --porcelain)" ]; then
248 echo "Fixtures formatted correctly"
249 else
250 git status && echo -e "\nTest fixtures are not formatted correctly. Please run 'cargo format-fixtures'"
251 exit 1
252 fi
253
254 benchmarks:
255 name: Build Benchmarks
256 runs-on: ubuntu-latest
257 steps:
258 - uses: actions/checkout@v4
259 - uses: dtolnay/rust-toolchain@stable
260 - run: cargo bench -p taffy_benchmarks --no-run
261 name: Build benchmarks
262 env:
263 RUSTFLAGS: "-C opt-level=0"
264
265 benchmarks-with-yoga:
266 name: Build Benchmarks (w/ yoga)
267 runs-on: ubuntu-latest
268 steps:
269 - uses: actions/checkout@v4
270 - uses: dtolnay/rust-toolchain@stable
271 - run: cargo bench -p taffy_benchmarks --no-run --features yoga
272 name: Build benchmarks (w/yoga)
273 env:
274 RUSTFLAGS: "-C opt-level=0"