Add MSRV policy. Track in CI (#536)
1on:
2 pull_request:
3 push:
4 branches:
5 - main
6 - 0.2.x
7 - 0.3.x
8
9name: Continuous integration
10
11env:
12 RUSTDOCFLAGS: "-D warnings"
13 CARGO_REGISTRIES_CRATES_IO_PROTOCOL: "sparse"
14
15jobs:
16 # None
17 test-features-none:
18 name: "Test Suite [Features: None]"
19 runs-on: ubuntu-latest
20 steps:
21 - uses: actions/checkout@v4
22 - uses: dtolnay/rust-toolchain@stable
23 - run: cargo build --no-default-features
24 - run: cargo test --no-default-features --features taffy_tree
25
26 # MSRV check.
27 # Taffy only guarantees "latest stable". However we have this check here to ensure that we advertise
28 # our MSRV. We also make an effort not to increase MSRV in patch versions of Taffy.
29 test-features-msrv:
30 name: "Test Suite [Features: Default] (Rust 1.65)"
31 runs-on: ubuntu-latest
32 steps:
33 - uses: actions/checkout@v4
34 - uses: dtolnay/rust-toolchain@1.65
35 - run: cargo build
36 - run: cargo test
37
38 # Default
39 test-features-default:
40 name: "Test Suite [Features: Default]"
41 runs-on: ubuntu-latest
42 steps:
43 - uses: actions/checkout@v4
44 - uses: dtolnay/rust-toolchain@stable
45 - run: cargo build
46 - run: cargo test
47
48 test-features-default-with-serde:
49 name: "Test Suite [Features: Default + serde]"
50 runs-on: ubuntu-latest
51 steps:
52 - uses: actions/checkout@v4
53 - uses: dtolnay/rust-toolchain@stable
54 - run: cargo build --features serde
55 - run: cargo test --features serde
56
57 test-features-no-grid-nor-flexbox:
58 name: "Test Suite [Features: std (no grid or flexbox)]"
59 runs-on: ubuntu-latest
60 steps:
61 - uses: actions/checkout@v4
62 - uses: dtolnay/rust-toolchain@stable
63 - run: cargo build --no-default-features --features std
64 - run: cargo build --no-default-features --features std,taffy_tree
65 - run: cargo test --no-default-features --features std,taffy_tree
66
67 # Flexbox
68 test-features-flexbox:
69 name: "Test Suite [Features: flexbox + std]"
70 runs-on: ubuntu-latest
71 steps:
72 - uses: actions/checkout@v4
73 - uses: dtolnay/rust-toolchain@stable
74 - run: cargo build --no-default-features --features flexbox,std
75 - run: cargo build --no-default-features --features flexbox,std,taffy_tree
76 - run: cargo test --no-default-features --features flexbox,std,taffy_tree
77
78 # Grid
79 test-features-grid:
80 name: "Test Suite [Features: grid + std]"
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 grid,std
86 - run: cargo build --no-default-features --features grid,std,taffy_tree
87 - run: cargo test --no-default-features --features grid,std,taffy_tree
88
89 test-features-grid-with-alloc:
90 name: "Test Suite [Features: grid + alloc]"
91 runs-on: ubuntu-latest
92 steps:
93 - uses: actions/checkout@v4
94 - uses: dtolnay/rust-toolchain@stable
95 - run: cargo build --no-default-features --features alloc,grid
96 - run: cargo build --no-default-features --features alloc,grid,taffy_tree
97 - run: cargo test --no-default-features --features alloc,grid,taffy_tree
98
99 test-features-alloc:
100 name: "Test Suite [Features: alloc]"
101 runs-on: ubuntu-latest
102 steps:
103 - uses: actions/checkout@v4
104 - uses: dtolnay/rust-toolchain@stable
105 - run: cargo build --no-default-features --features alloc
106 - run: cargo build --no-default-features --features alloc,taffy_tree
107 - run: cargo test --no-default-features --features alloc,taffy_tree
108
109 test-features-default-no-grid:
110 name: "Test Suite [Features: std (no grid)]"
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
116 - run: cargo build --no-default-features --features std,taffy_tree
117 - run: cargo test --no-default-features --features std,taffy_tree
118
119 fmt:
120 name: Rustfmt
121 runs-on: ubuntu-latest
122 steps:
123 - uses: actions/checkout@v4
124 - uses: dtolnay/rust-toolchain@master
125 with:
126 toolchain: stable
127 components: rustfmt
128 - run: cargo fmt --all -- --check
129
130 clippy:
131 name: Clippy
132 runs-on: ubuntu-latest
133 steps:
134 - uses: actions/checkout@v4
135 - uses: dtolnay/rust-toolchain@master
136 with:
137 toolchain: nightly
138 components: clippy
139 - run: cargo +nightly clippy --workspace -- -D warnings
140
141 doc:
142 name: Documentation
143 runs-on: ubuntu-latest
144 steps:
145 - uses: actions/checkout@v4
146 - uses: dtolnay/rust-toolchain@master
147 with:
148 toolchain: stable
149 components: clippy
150 - run: cargo doc
151
152 markdownlint:
153 name: Markdown Lint
154 runs-on: ubuntu-latest
155 steps:
156 - uses: actions/checkout@v4
157 - name: Run Markdown Lint
158 uses: DavidAnson/markdownlint-cli2-action@v12
159 with:
160 globs: '**/*.md'
161
162 fixture-format:
163 name: Test Fixture Formatting
164 runs-on: ubuntu-latest
165 steps:
166 - uses: actions/checkout@v4
167 - name: Run format script
168 run: cargo format-fixtures
169 - name: Ensure no changes
170 run: |
171 if [ -z "$(git status --porcelain)" ]; then
172 echo "Fixtures formatted correctly"
173 else
174 git status && echo -e "\nTest fixtures are not formatted correctly. Please run 'cargo format-fixtures'"
175 exit 1
176 fi
177
178 benchmarks:
179 name: Build Benchmarks
180 runs-on: ubuntu-latest
181 steps:
182 - uses: actions/checkout@v4
183 - uses: dtolnay/rust-toolchain@stable
184 - run: cargo xbench --no-run
185 name: Build benchmarks
186 env:
187 RUSTFLAGS: "-C opt-level=0"
188
189 benchmarks-with-yoga:
190 name: Build Benchmarks (w/ yoga)
191 runs-on: ubuntu-latest
192 steps:
193 - uses: actions/checkout@v4
194 - uses: dtolnay/rust-toolchain@stable
195 - run: cargo xbench --no-run --features yoga
196 name: Build benchmarks (w/yoga)
197 env:
198 RUSTFLAGS: "-C opt-level=0"