tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 1077HTML 1008Markdown 12TOML 83209 Definitions

⎇ 8437796cc084de78ee04e2d940086954c924cb98 .github/workflows/ci.yml YAML · 265 lines · 9.0 KB History raw

Feature flag calc values (#806) 8437796cc · 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      - run: cargo build -p cosmic-text-example
48
49  # No features
50  test-features-none:
51    name: "Test Suite [no features]"
52    runs-on: ubuntu-latest
53    steps:
54      - uses: actions/checkout@v4
55      - uses: dtolnay/rust-toolchain@stable
56      - run: cargo build --no-default-features
57      - run: cargo test --tests --no-default-features --features taffy_tree
58
59  # Default
60  test-features-default:
61    name: "Test Suite [default features]"
62    runs-on: ubuntu-latest
63    steps:
64      - uses: actions/checkout@v4
65      - uses: dtolnay/rust-toolchain@stable
66      - run: cargo build
67      - run: cargo test --tests
68
69  test-features-default-with-serde:
70    name: "Test Suite [default + serde]"
71    runs-on: ubuntu-latest
72    steps:
73      - uses: actions/checkout@v4
74      - uses: dtolnay/rust-toolchain@stable
75      - run: cargo build --features serde
76      - run: cargo test --tests --features serde
77
78  test-features-default-except-content-size:
79    name: "Test Suite [default except content_size]"
80    runs-on: ubuntu-latest
81    steps:
82      - uses: actions/checkout@v4
83      - uses: dtolnay/rust-toolchain@stable
84      - run: cargo build --no-default-features --features std,taffy_tree,grid,flexbox,block_layout
85      - run: cargo test --tests --no-default-features --features std,taffy_tree,grid,flexbox,block_layout,calc
86
87  test-features-default-except-calc:
88    name: "Test Suite [default except calc]"
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
95
96  test-features-no-grid-nor-flexbox:
97    name: "Test Suite [std (no algorithms)]"
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
103      - run: cargo build --no-default-features --features std,taffy_tree
104      - run: cargo test --tests --no-default-features --features std,taffy_tree,calc
105
106  # With std feature
107  test-features-flexbox:
108    name: "Test Suite [std + flexbox]"
109    runs-on: ubuntu-latest
110    steps:
111      - uses: actions/checkout@v4
112      - uses: dtolnay/rust-toolchain@stable
113      - run: cargo build --no-default-features --features flexbox,std
114      - run: cargo build --no-default-features --features flexbox,std,taffy_tree
115      - run: cargo test --tests --no-default-features --features flexbox,std,taffy_tree
116
117  test-features-grid:
118    name: "Test Suite [std + grid]"
119    runs-on: ubuntu-latest
120    steps:
121      - uses: actions/checkout@v4
122      - uses: dtolnay/rust-toolchain@stable
123      - run: cargo build --no-default-features --features grid,std
124      - run: cargo build --no-default-features --features grid,std,taffy_tree
125      - run: cargo test --tests --no-default-features --features grid,std,taffy_tree
126
127  test-features-block:
128    name: "Test Suite [std + block)]"
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 block_layout,std
134      - run: cargo build --no-default-features --features block_layout,std,taffy_tree
135      - run: cargo test --tests --no-default-features --features block_layout,std,taffy_tree
136
137  # With detailed layout info
138  test-features-grid-detailed-info:
139    name: "Test Suite [std + grid + detailed_layout_info]"
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 grid,detailed_layout_info,std
145      - run: cargo build --no-default-features --features grid,detailed_layout_info,std,taffy_tree
146      - run: cargo test --tests --no-default-features --features grid,detailed_layout_info,std,taffy_tree
147
148  # With detailed layout info
149  test-features-flex-detailed-info:
150    name: "Test Suite [std + flexbox + detailed_layout_info]"
151    runs-on: ubuntu-latest
152    steps:
153      - uses: actions/checkout@v4
154      - uses: dtolnay/rust-toolchain@stable
155      - run: cargo build --no-default-features --features flexbox,detailed_layout_info,std
156      - run: cargo build --no-default-features --features flexbox,detailed_layout_info,std,taffy_tree
157      - run: cargo test --tests --no-default-features --features flexbox,detailed_layout_info,std,taffy_tree
158
159  # With alloc feature
160
161  test-features-grid-with-alloc:
162    name: "Test Suite [alloc + no algorithms]"
163    runs-on: ubuntu-latest
164    steps:
165      - uses: actions/checkout@v4
166      - uses: dtolnay/rust-toolchain@stable
167      - run: cargo build --no-default-features --features alloc
168      - run: cargo build --no-default-features --features alloc,taffy_tree
169      - run: cargo test --tests --no-default-features --features alloc,taffy_tree
170
171  test-features-alloc:
172    name: "Test Suite [alloc + all algorithms]"
173    runs-on: ubuntu-latest
174    steps:
175      - uses: actions/checkout@v4
176      - uses: dtolnay/rust-toolchain@stable
177      - run: cargo build --no-default-features --features alloc,grid,flexbox,block_layout
178      - run: cargo build --no-default-features --features alloc,grid,flexbox,block_layout,taffy_tree
179      - run: cargo test --tests  --no-default-features --features alloc,grid,flexbox,block_layout,taffy_tree
180
181  fmt:
182    name: Rustfmt
183    runs-on: ubuntu-latest
184    steps:
185      - uses: actions/checkout@v4
186      - uses: dtolnay/rust-toolchain@master
187        with:
188          toolchain: stable
189          components: rustfmt
190      - run: cargo fmt --all -- --check
191
192  clippy:
193    name: Clippy
194    runs-on: ubuntu-latest
195    steps:
196      - uses: actions/checkout@v4
197      - uses: dtolnay/rust-toolchain@master
198        with:
199          toolchain: nightly
200          components: clippy
201      - run: cargo +nightly clippy --workspace -- -D warnings
202
203  # Run rustdoc with the `docsrs` cfg to ensure that the documentation is compatible with docs.rs.
204  # This enables the doc_auto_cfg feature, which requires the nightly toolchain.
205  # Also checks that the examples can be scraped.
206  doc:
207    name: Documentation
208    runs-on: ubuntu-latest
209    env:
210      RUSTDOCFLAGS: "--cfg docsrs"
211    steps:
212      - uses: actions/checkout@v4
213      - uses: dtolnay/rust-toolchain@master
214        with:
215          toolchain: nightly
216          components: clippy
217      - run: cargo +nightly doc -Zunstable-options -Zrustdoc-scrape-examples --all-features --no-deps
218
219  markdownlint:
220    name: Markdown Lint
221    runs-on: ubuntu-latest
222    steps:
223      - uses: actions/checkout@v4
224      - name: Run Markdown Lint
225        uses: DavidAnson/markdownlint-cli2-action@v19
226        with:
227          globs: "**/*.md"
228
229  fixture-format:
230    name: Test Fixture Formatting
231    runs-on: ubuntu-latest
232    steps:
233      - uses: actions/checkout@v4
234      - name: Run format script
235        run: cargo run -p format-fixtures
236      - name: Ensure no changes
237        run: |
238          if [ -z "$(git status --porcelain)" ]; then 
239            echo "Fixtures formatted correctly"
240          else 
241            git status && echo -e "\nTest fixtures are not formatted correctly. Please run 'cargo format-fixtures'"
242            exit 1
243          fi
244
245  benchmarks:
246    name: Build Benchmarks
247    runs-on: ubuntu-latest
248    steps:
249      - uses: actions/checkout@v4
250      - uses: dtolnay/rust-toolchain@stable
251      - run: cargo bench -p taffy_benchmarks --no-run
252        name: Build benchmarks
253        env:
254          RUSTFLAGS: "-C opt-level=0"
255
256  benchmarks-with-yoga:
257    name: Build Benchmarks (w/ yoga)
258    runs-on: ubuntu-latest
259    steps:
260      - uses: actions/checkout@v4
261      - uses: dtolnay/rust-toolchain@stable
262      - run: cargo bench -p taffy_benchmarks --no-run --features yoga
263        name: Build benchmarks (w/yoga)
264        env:
265          RUSTFLAGS: "-C opt-level=0"