tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 1077HTML 1008Markdown 12TOML 83209 Definitions

⎇ 861a9dab7c69d4a271354134fbc2f9d4af7b7844 .github/workflows/ci.yml YAML · 256 lines · 8.6 KB History raw

Bump DavidAnson/markdownlint-cli2-action from 18 to 19 (#790) 861a9dab7 · dependabot[bot] ·

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 detailed layout info
129  test-features-grid-detailed-info:
130    name: "Test Suite [std + grid + detailed_layout_info]"
131    runs-on: ubuntu-latest
132    steps:
133      - uses: actions/checkout@v4
134      - uses: dtolnay/rust-toolchain@stable
135      - run: cargo build --no-default-features --features grid,detailed_layout_info,std
136      - run: cargo build --no-default-features --features grid,detailed_layout_info,std,taffy_tree
137      - run: cargo test --tests --no-default-features --features grid,detailed_layout_info,std,taffy_tree
138
139  # With detailed layout info
140  test-features-flex-detailed-info:
141    name: "Test Suite [std + flexbox + detailed_layout_info]"
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 flexbox,detailed_layout_info,std
147      - run: cargo build --no-default-features --features flexbox,detailed_layout_info,std,taffy_tree
148      - run: cargo test --tests --no-default-features --features flexbox,detailed_layout_info,std,taffy_tree
149
150  # With alloc feature
151
152  test-features-grid-with-alloc:
153    name: "Test Suite [alloc + no algorithms]"
154    runs-on: ubuntu-latest
155    steps:
156      - uses: actions/checkout@v4
157      - uses: dtolnay/rust-toolchain@stable
158      - run: cargo build --no-default-features --features alloc
159      - run: cargo build --no-default-features --features alloc,taffy_tree
160      - run: cargo test --tests --no-default-features --features alloc,taffy_tree
161
162  test-features-alloc:
163    name: "Test Suite [alloc + all algorithms]"
164    runs-on: ubuntu-latest
165    steps:
166      - uses: actions/checkout@v4
167      - uses: dtolnay/rust-toolchain@stable
168      - run: cargo build --no-default-features --features alloc,grid,flexbox,block_layout
169      - run: cargo build --no-default-features --features alloc,grid,flexbox,block_layout,taffy_tree
170      - run: cargo test --tests  --no-default-features --features alloc,grid,flexbox,block_layout,taffy_tree
171
172  fmt:
173    name: Rustfmt
174    runs-on: ubuntu-latest
175    steps:
176      - uses: actions/checkout@v4
177      - uses: dtolnay/rust-toolchain@master
178        with:
179          toolchain: stable
180          components: rustfmt
181      - run: cargo fmt --all -- --check
182
183  clippy:
184    name: Clippy
185    runs-on: ubuntu-latest
186    steps:
187      - uses: actions/checkout@v4
188      - uses: dtolnay/rust-toolchain@master
189        with:
190          toolchain: nightly
191          components: clippy
192      - run: cargo +nightly clippy --workspace -- -D warnings
193
194  # Run rustdoc with the `docsrs` cfg to ensure that the documentation is compatible with docs.rs.
195  # This enables the doc_auto_cfg feature, which requires the nightly toolchain.
196  # Also checks that the examples can be scraped.
197  doc:
198    name: Documentation
199    runs-on: ubuntu-latest
200    env:
201      RUSTDOCFLAGS: "--cfg docsrs"
202    steps:
203      - uses: actions/checkout@v4
204      - uses: dtolnay/rust-toolchain@master
205        with:
206          toolchain: nightly
207          components: clippy
208      - run: cargo +nightly doc -Zunstable-options -Zrustdoc-scrape-examples --all-features --no-deps
209
210  markdownlint:
211    name: Markdown Lint
212    runs-on: ubuntu-latest
213    steps:
214      - uses: actions/checkout@v4
215      - name: Run Markdown Lint
216        uses: DavidAnson/markdownlint-cli2-action@v19
217        with:
218          globs: "**/*.md"
219
220  fixture-format:
221    name: Test Fixture Formatting
222    runs-on: ubuntu-latest
223    steps:
224      - uses: actions/checkout@v4
225      - name: Run format script
226        run: cargo run -p format-fixtures
227      - name: Ensure no changes
228        run: |
229          if [ -z "$(git status --porcelain)" ]; then 
230            echo "Fixtures formatted correctly"
231          else 
232            git status && echo -e "\nTest fixtures are not formatted correctly. Please run 'cargo format-fixtures'"
233            exit 1
234          fi
235
236  benchmarks:
237    name: Build Benchmarks
238    runs-on: ubuntu-latest
239    steps:
240      - uses: actions/checkout@v4
241      - uses: dtolnay/rust-toolchain@stable
242      - run: cargo bench -p taffy_benchmarks --no-run
243        name: Build benchmarks
244        env:
245          RUSTFLAGS: "-C opt-level=0"
246
247  benchmarks-with-yoga:
248    name: Build Benchmarks (w/ yoga)
249    runs-on: ubuntu-latest
250    steps:
251      - uses: actions/checkout@v4
252      - uses: dtolnay/rust-toolchain@stable
253      - run: cargo bench -p taffy_benchmarks --no-run --features yoga
254        name: Build benchmarks (w/yoga)
255        env:
256          RUSTFLAGS: "-C opt-level=0"