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
17 # MSRV check.
18 # Taffy only guarantees "latest stable". However we have this check here to ensure that we advertise
19 # our MSRV. We also make an effort not to increase MSRV in patch versions of Taffy.
20 #
21 # We only run `cargo build` (not `cargo test`) so as to avoid requiring dev-dependencies to build with the MSRV
22 # version. Building is likely sufficient as runtime errors varying between rust versions is very unlikely.
23 test-features-msrv:
24 name: "MSRV Build [Rust 1.65]"
25 runs-on: ubuntu-latest
26 steps:
27 - uses: actions/checkout@v4
28 - uses: dtolnay/rust-toolchain@master
29 with:
30 toolchain: 1.65
31 - run: cargo build
32
33 test-features-debug:
34 name: "Build [debug feature]"
35 runs-on: ubuntu-latest
36 steps:
37 - uses: actions/checkout@v4
38 - uses: dtolnay/rust-toolchain@stable
39 - run: cargo build --features debug
40
41 # No features
42 test-features-none:
43 name: "Test Suite [no features]"
44 runs-on: ubuntu-latest
45 steps:
46 - uses: actions/checkout@v4
47 - uses: dtolnay/rust-toolchain@stable
48 - run: cargo build --no-default-features
49 - run: cargo test --no-default-features --features taffy_tree
50
51 # Default
52 test-features-default:
53 name: "Test Suite [default features]"
54 runs-on: ubuntu-latest
55 steps:
56 - uses: actions/checkout@v4
57 - uses: dtolnay/rust-toolchain@stable
58 - run: cargo build
59 - run: cargo test
60
61 test-features-default-with-serde:
62 name: "Test Suite [default + serde]"
63 runs-on: ubuntu-latest
64 steps:
65 - uses: actions/checkout@v4
66 - uses: dtolnay/rust-toolchain@stable
67 - run: cargo build --features serde
68 - run: cargo test --features serde
69
70 test-features-default-except-content-size:
71 name: "Test Suite [default except content_size]"
72 runs-on: ubuntu-latest
73 steps:
74 - uses: actions/checkout@v4
75 - uses: dtolnay/rust-toolchain@stable
76 - run: cargo build --no-default-features --features std,taffy_tree,grid,flexbox,block_layout
77 - run: cargo test --no-default-features --features std,taffy_tree,grid,flexbox,block_layout
78
79 test-features-no-grid-nor-flexbox:
80 name: "Test Suite [std (no algorithms)]"
81 runs-on: ubuntu-latest
82 steps:
83 - uses: actions/checkout@v4
84 - uses: dtolnay/rust-toolchain@stable
85 - run: cargo build --no-default-features --features std
86 - run: cargo build --no-default-features --features std,taffy_tree
87 - run: cargo test --no-default-features --features std,taffy_tree
88
89 # With std feature
90 test-features-flexbox:
91 name: "Test Suite [std + flexbox]"
92 runs-on: ubuntu-latest
93 steps:
94 - uses: actions/checkout@v4
95 - uses: dtolnay/rust-toolchain@stable
96 - run: cargo build --no-default-features --features flexbox,std
97 - run: cargo build --no-default-features --features flexbox,std,taffy_tree
98 - run: cargo test --no-default-features --features flexbox,std,taffy_tree
99
100 test-features-grid:
101 name: "Test Suite [std + grid]"
102 runs-on: ubuntu-latest
103 steps:
104 - uses: actions/checkout@v4
105 - uses: dtolnay/rust-toolchain@stable
106 - run: cargo build --no-default-features --features grid,std
107 - run: cargo build --no-default-features --features grid,std,taffy_tree
108 - run: cargo test --no-default-features --features grid,std,taffy_tree
109
110 test-features-block:
111 name: "Test Suite [std + block)]"
112 runs-on: ubuntu-latest
113 steps:
114 - uses: actions/checkout@v4
115 - uses: dtolnay/rust-toolchain@stable
116 - run: cargo build --no-default-features --features block_layout,std
117 - run: cargo build --no-default-features --features block_layout,std,taffy_tree
118 - run: cargo test --no-default-features --features block_layout,std,taffy_tree
119
120 # With alloc feature
121
122 test-features-grid-with-alloc:
123 name: "Test Suite [alloc + no algorithms]"
124 runs-on: ubuntu-latest
125 steps:
126 - uses: actions/checkout@v4
127 - uses: dtolnay/rust-toolchain@stable
128 - run: cargo build --no-default-features --features alloc
129 - run: cargo build --no-default-features --features alloc,taffy_tree
130 - run: cargo test --no-default-features --features alloc,taffy_tree
131
132 test-features-alloc:
133 name: "Test Suite [alloc + all algorithms]"
134 runs-on: ubuntu-latest
135 steps:
136 - uses: actions/checkout@v4
137 - uses: dtolnay/rust-toolchain@stable
138 - run: cargo build --no-default-features --features alloc,grid,flexbox,block_layout
139 - run: cargo build --no-default-features --features alloc,grid,flexbox,block_layout,taffy_tree
140 - run: cargo test --no-default-features --features alloc,grid,flexbox,block_layout,taffy_tree
141
142 fmt:
143 name: Rustfmt
144 runs-on: ubuntu-latest
145 steps:
146 - uses: actions/checkout@v4
147 - uses: dtolnay/rust-toolchain@master
148 with:
149 toolchain: stable
150 components: rustfmt
151 - run: cargo fmt --all -- --check
152
153 clippy:
154 name: Clippy
155 runs-on: ubuntu-latest
156 steps:
157 - uses: actions/checkout@v4
158 - uses: dtolnay/rust-toolchain@master
159 with:
160 toolchain: nightly
161 components: clippy
162 - run: cargo +nightly clippy --workspace -- -D warnings
163
164 doc:
165 name: Documentation
166 runs-on: ubuntu-latest
167 steps:
168 - uses: actions/checkout@v4
169 - uses: dtolnay/rust-toolchain@master
170 with:
171 toolchain: stable
172 components: clippy
173 - run: cargo doc
174
175 markdownlint:
176 name: Markdown Lint
177 runs-on: ubuntu-latest
178 steps:
179 - uses: actions/checkout@v4
180 - name: Run Markdown Lint
181 uses: DavidAnson/markdownlint-cli2-action@v15
182 with:
183 globs: '**/*.md'
184
185 fixture-format:
186 name: Test Fixture Formatting
187 runs-on: ubuntu-latest
188 steps:
189 - uses: actions/checkout@v4
190 - name: Run format script
191 run: cargo format-fixtures
192 - name: Ensure no changes
193 run: |
194 if [ -z "$(git status --porcelain)" ]; then
195 echo "Fixtures formatted correctly"
196 else
197 git status && echo -e "\nTest fixtures are not formatted correctly. Please run 'cargo format-fixtures'"
198 exit 1
199 fi
200
201 benchmarks:
202 name: Build Benchmarks
203 runs-on: ubuntu-latest
204 steps:
205 - uses: actions/checkout@v4
206 - uses: dtolnay/rust-toolchain@stable
207 - run: cargo xbench --no-run
208 name: Build benchmarks
209 env:
210 RUSTFLAGS: "-C opt-level=0"
211
212 benchmarks-with-yoga:
213 name: Build Benchmarks (w/ yoga)
214 runs-on: ubuntu-latest
215 steps:
216 - uses: actions/checkout@v4
217 - uses: dtolnay/rust-toolchain@stable
218 - run: cargo xbench --no-run --features yoga
219 name: Build benchmarks (w/yoga)
220 env:
221 RUSTFLAGS: "-C opt-level=0"