Move cosmic-text example to it's own crate (#754)
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
86
87 test-features-no-grid-nor-flexbox:
88 name: "Test Suite [std (no algorithms)]"
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
94 - run: cargo build --no-default-features --features std,taffy_tree
95 - run: cargo test --tests --no-default-features --features std,taffy_tree
96
97 # With std feature
98 test-features-flexbox:
99 name: "Test Suite [std + flexbox]"
100 runs-on: ubuntu-latest
101 steps:
102 - uses: actions/checkout@v4
103 - uses: dtolnay/rust-toolchain@stable
104 - run: cargo build --no-default-features --features flexbox,std
105 - run: cargo build --no-default-features --features flexbox,std,taffy_tree
106 - run: cargo test --tests --no-default-features --features flexbox,std,taffy_tree
107
108 test-features-grid:
109 name: "Test Suite [std + grid]"
110 runs-on: ubuntu-latest
111 steps:
112 - uses: actions/checkout@v4
113 - uses: dtolnay/rust-toolchain@stable
114 - run: cargo build --no-default-features --features grid,std
115 - run: cargo build --no-default-features --features grid,std,taffy_tree
116 - run: cargo test --tests --no-default-features --features grid,std,taffy_tree
117
118 test-features-block:
119 name: "Test Suite [std + block)]"
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 block_layout,std
125 - run: cargo build --no-default-features --features block_layout,std,taffy_tree
126 - run: cargo test --tests --no-default-features --features block_layout,std,taffy_tree
127
128 # With alloc feature
129
130 test-features-grid-with-alloc:
131 name: "Test Suite [alloc + no algorithms]"
132 runs-on: ubuntu-latest
133 steps:
134 - uses: actions/checkout@v4
135 - uses: dtolnay/rust-toolchain@stable
136 - run: cargo build --no-default-features --features alloc
137 - run: cargo build --no-default-features --features alloc,taffy_tree
138 - run: cargo test --tests --no-default-features --features alloc,taffy_tree
139
140 test-features-alloc:
141 name: "Test Suite [alloc + all algorithms]"
142 runs-on: ubuntu-latest
143 steps:
144 - uses: actions/checkout@v4
145 - uses: dtolnay/rust-toolchain@stable
146 - run: cargo build --no-default-features --features alloc,grid,flexbox,block_layout
147 - run: cargo build --no-default-features --features alloc,grid,flexbox,block_layout,taffy_tree
148 - run: cargo test --tests --no-default-features --features alloc,grid,flexbox,block_layout,taffy_tree
149
150 fmt:
151 name: Rustfmt
152 runs-on: ubuntu-latest
153 steps:
154 - uses: actions/checkout@v4
155 - uses: dtolnay/rust-toolchain@master
156 with:
157 toolchain: stable
158 components: rustfmt
159 - run: cargo fmt --all -- --check
160
161 clippy:
162 name: Clippy
163 runs-on: ubuntu-latest
164 steps:
165 - uses: actions/checkout@v4
166 - uses: dtolnay/rust-toolchain@master
167 with:
168 toolchain: nightly
169 components: clippy
170 - run: cargo +nightly clippy --workspace -- -D warnings
171
172 # Run rustdoc with the `docsrs` cfg to ensure that the documentation is compatible with docs.rs.
173 # This enables the doc_auto_cfg feature, which requires the nightly toolchain.
174 # Also checks that the examples can be scraped.
175 doc:
176 name: Documentation
177 runs-on: ubuntu-latest
178 env:
179 RUSTDOCFLAGS: "--cfg docsrs"
180 steps:
181 - uses: actions/checkout@v4
182 - uses: dtolnay/rust-toolchain@master
183 with:
184 toolchain: nightly
185 components: clippy
186 - run: cargo +nightly doc -Zunstable-options -Zrustdoc-scrape-examples --all-features --no-deps
187
188 markdownlint:
189 name: Markdown Lint
190 runs-on: ubuntu-latest
191 steps:
192 - uses: actions/checkout@v4
193 - name: Run Markdown Lint
194 uses: DavidAnson/markdownlint-cli2-action@v18
195 with:
196 globs: "**/*.md"
197
198 fixture-format:
199 name: Test Fixture Formatting
200 runs-on: ubuntu-latest
201 steps:
202 - uses: actions/checkout@v4
203 - name: Run format script
204 run: cargo run -p format-fixtures
205 - name: Ensure no changes
206 run: |
207 if [ -z "$(git status --porcelain)" ]; then
208 echo "Fixtures formatted correctly"
209 else
210 git status && echo -e "\nTest fixtures are not formatted correctly. Please run 'cargo format-fixtures'"
211 exit 1
212 fi
213
214 benchmarks:
215 name: Build Benchmarks
216 runs-on: ubuntu-latest
217 steps:
218 - uses: actions/checkout@v4
219 - uses: dtolnay/rust-toolchain@stable
220 - run: cargo bench -p taffy_benchmarks --no-run
221 name: Build benchmarks
222 env:
223 RUSTFLAGS: "-C opt-level=0"
224
225 benchmarks-with-yoga:
226 name: Build Benchmarks (w/ yoga)
227 runs-on: ubuntu-latest
228 steps:
229 - uses: actions/checkout@v4
230 - uses: dtolnay/rust-toolchain@stable
231 - run: cargo bench -p taffy_benchmarks --no-run --features yoga
232 name: Build benchmarks (w/yoga)
233 env:
234 RUSTFLAGS: "-C opt-level=0"