tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81414 Definiciones

⎇ 88803395f6d3acf6d5d65ee6c87d020240fde79f .github/workflows/ci.yml YAML · 296 líneas · 10.1 KB Historia crudo

Clippy (June 2025) (#852) 88803395f · Nico Burns ·

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-all:
79    name: "Test Suite [all features]"
80    runs-on: ubuntu-latest
81    steps:
82      - uses: actions/checkout@v4
83      - uses: dtolnay/rust-toolchain@stable
84      - run: cargo build --all-features
85      - run: cargo test --tests --all-features
86
87  # The main reason for this target is to test compilation on 32bit targets
88  test-features-android-32bit:
89    name: "Test Suite [all features (i686-linux-android)]"
90    runs-on: ubuntu-latest
91    steps:
92      - uses: actions/checkout@v4
93      - uses: dtolnay/rust-toolchain@stable
94        with:
95          targets: i686-linux-android
96      - run: cargo build --all-features --target i686-linux-android
97      # TODO: enable tests (currently running into linking errors)
98      # - run: cargo test --tests --all-features --target i686-linux-android
99
100  test-features-default-with-serde:
101    name: "Test Suite [default + serde]"
102    runs-on: ubuntu-latest
103    steps:
104      - uses: actions/checkout@v4
105      - uses: dtolnay/rust-toolchain@stable
106      - run: cargo build --features serde
107      - run: cargo test --tests --features serde
108
109  test-features-default-except-content-size:
110    name: "Test Suite [default except content_size]"
111    runs-on: ubuntu-latest
112    steps:
113      - uses: actions/checkout@v4
114      - uses: dtolnay/rust-toolchain@stable
115      - run: cargo build --no-default-features --features std,taffy_tree,grid,flexbox,block_layout
116      - run: cargo test --tests --no-default-features --features std,taffy_tree,grid,flexbox,block_layout,calc
117
118  test-features-default-except-calc:
119    name: "Test Suite [default except calc]"
120    runs-on: ubuntu-latest
121    steps:
122      - uses: actions/checkout@v4
123      - uses: dtolnay/rust-toolchain@stable
124      - run: cargo build --no-default-features --features std,taffy_tree,grid,flexbox,block_layout
125      - run: cargo test --tests --no-default-features --features std,taffy_tree,grid,flexbox,block_layout
126
127  test-features-no-grid-nor-flexbox:
128    name: "Test Suite [std (no algorithms)]"
129    runs-on: ubuntu-latest
130    steps:
131      - uses: actions/checkout@v4
132      - uses: dtolnay/rust-toolchain@stable
133      - run: cargo build --no-default-features --features std
134      - run: cargo build --no-default-features --features std,taffy_tree
135      - run: cargo test --tests --no-default-features --features std,taffy_tree,calc
136
137  # With std feature
138  test-features-flexbox:
139    name: "Test Suite [std + flexbox]"
140    runs-on: ubuntu-latest
141    steps:
142      - uses: actions/checkout@v4
143      - uses: dtolnay/rust-toolchain@stable
144      - run: cargo build --no-default-features --features flexbox,std
145      - run: cargo build --no-default-features --features flexbox,std,taffy_tree
146      - run: cargo test --tests --no-default-features --features flexbox,std,taffy_tree
147
148  test-features-grid:
149    name: "Test Suite [std + grid]"
150    runs-on: ubuntu-latest
151    steps:
152      - uses: actions/checkout@v4
153      - uses: dtolnay/rust-toolchain@stable
154      - run: cargo build --no-default-features --features grid,std
155      - run: cargo build --no-default-features --features grid,std,taffy_tree
156      - run: cargo test --tests --no-default-features --features grid,std,taffy_tree
157
158  test-features-block:
159    name: "Test Suite [std + block)]"
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 block_layout,std
165      - run: cargo build --no-default-features --features block_layout,std,taffy_tree
166      - run: cargo test --tests --no-default-features --features block_layout,std,taffy_tree
167
168  # With detailed layout info
169  test-features-grid-detailed-info:
170    name: "Test Suite [std + grid + detailed_layout_info]"
171    runs-on: ubuntu-latest
172    steps:
173      - uses: actions/checkout@v4
174      - uses: dtolnay/rust-toolchain@stable
175      - run: cargo build --no-default-features --features grid,detailed_layout_info,std
176      - run: cargo build --no-default-features --features grid,detailed_layout_info,std,taffy_tree
177      - run: cargo test --tests --no-default-features --features grid,detailed_layout_info,std,taffy_tree
178
179  # With detailed layout info
180  test-features-flex-detailed-info:
181    name: "Test Suite [std + flexbox + detailed_layout_info]"
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 flexbox,detailed_layout_info,std
187      - run: cargo build --no-default-features --features flexbox,detailed_layout_info,std,taffy_tree
188      - run: cargo test --tests --no-default-features --features flexbox,detailed_layout_info,std,taffy_tree
189
190  # With alloc feature
191
192  test-features-grid-with-alloc:
193    name: "Test Suite [alloc + no algorithms]"
194    runs-on: ubuntu-latest
195    steps:
196      - uses: actions/checkout@v4
197      - uses: dtolnay/rust-toolchain@stable
198      - run: cargo build --no-default-features --features alloc
199      - run: cargo build --no-default-features --features alloc,taffy_tree
200      - run: cargo test --tests --no-default-features --features alloc,taffy_tree
201
202  test-features-alloc:
203    name: "Test Suite [alloc + all algorithms]"
204    runs-on: ubuntu-latest
205    steps:
206      - uses: actions/checkout@v4
207      - uses: dtolnay/rust-toolchain@stable
208      - run: cargo build --no-default-features --features alloc,grid,flexbox,block_layout
209      - run: cargo build --no-default-features --features alloc,grid,flexbox,block_layout,taffy_tree
210      - run: cargo test --tests  --no-default-features --features alloc,grid,flexbox,block_layout,taffy_tree
211
212  fmt:
213    name: Rustfmt
214    runs-on: ubuntu-latest
215    steps:
216      - uses: actions/checkout@v4
217      - uses: dtolnay/rust-toolchain@master
218        with:
219          toolchain: stable
220          components: rustfmt
221      - run: cargo fmt --all -- --check
222
223  clippy:
224    name: Clippy
225    runs-on: ubuntu-latest
226    steps:
227      - uses: actions/checkout@v4
228      - uses: dtolnay/rust-toolchain@master
229        with:
230          toolchain: stable
231          components: clippy
232      - run: cargo clippy --workspace -- -D warnings
233
234  # Run rustdoc with the `docsrs` cfg to ensure that the documentation is compatible with docs.rs.
235  # This enables the doc_auto_cfg feature, which requires the nightly toolchain.
236  # Also checks that the examples can be scraped.
237  doc:
238    name: Documentation
239    runs-on: ubuntu-latest
240    env:
241      RUSTDOCFLAGS: "--cfg docsrs"
242    steps:
243      - uses: actions/checkout@v4
244      - uses: dtolnay/rust-toolchain@master
245        with:
246          toolchain: nightly
247          components: clippy
248      - run: cargo +nightly doc -Zunstable-options -Zrustdoc-scrape-examples --all-features --no-deps
249
250  markdownlint:
251    name: Markdown Lint
252    runs-on: ubuntu-latest
253    steps:
254      - uses: actions/checkout@v4
255      - name: Run Markdown Lint
256        uses: DavidAnson/markdownlint-cli2-action@v20
257        with:
258          globs: "**/*.md"
259
260  fixture-format:
261    name: Test Fixture Formatting
262    runs-on: ubuntu-latest
263    steps:
264      - uses: actions/checkout@v4
265      - name: Run format script
266        run: cargo run -p format-fixtures
267      - name: Ensure no changes
268        run: |
269          if [ -z "$(git status --porcelain)" ]; then 
270            echo "Fixtures formatted correctly"
271          else 
272            git status && echo -e "\nTest fixtures are not formatted correctly. Please run 'cargo format-fixtures'"
273            exit 1
274          fi
275
276  benchmarks:
277    name: Build Benchmarks
278    runs-on: ubuntu-latest
279    steps:
280      - uses: actions/checkout@v4
281      - uses: dtolnay/rust-toolchain@stable
282      - run: cargo bench -p taffy_benchmarks --no-run
283        name: Build benchmarks
284        env:
285          RUSTFLAGS: "-C opt-level=0"
286
287  benchmarks-with-yoga:
288    name: Build Benchmarks (w/ yoga)
289    runs-on: ubuntu-latest
290    steps:
291      - uses: actions/checkout@v4
292      - uses: dtolnay/rust-toolchain@stable
293      - run: cargo bench -p taffy_benchmarks --no-run --features yoga
294        name: Build benchmarks (w/yoga)
295        env:
296          RUSTFLAGS: "-C opt-level=0"