Repository navigation
190 lines (170 loc) · 6.59 KB
/
Copy pathci.yml
File metadata and controls
190 lines (170 loc) · 6.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
name: CI
on:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
RUSTDOCFLAGS: "-D warnings"
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: "sparse"
jobs:
# MSRV check.
# AnyRender only guarantees "latest stable". However we have this check here to ensure that we advertise
# our MSRV. We also make an effort not to increase MSRV in patch versions of AnyRender.
#
# We only run `cargo build` (not `cargo test`) so as to avoid requiring dev-dependencies to build with the MSRV
# version. Building is likely sufficient as runtime errors varying between rust versions is very unlikely.
build-msrv:
name: "MSRV Build [Rust 1.90]"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.90
- name: Install development libraries on ubuntu
run: sudo apt-get update && sudo apt-get install -y libfontconfig1-dev libfreetype6-dev
- run: cargo build --workspace
build-features-default:
name: "Build [default features]"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install development libraries on ubuntu
run: sudo apt-get update && sudo apt-get install -y libfontconfig1-dev libfreetype6-dev
- run: cargo build --workspace
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- run: cargo fmt --all --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
- run: cargo clippy --workspace -- -D warnings
doc:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo doc --no-deps
check-wasm:
name: "Check [wasm32 + webgl]"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
components: clippy
- uses: Swatinem/rust-cache@v2
with:
key: "wasm32-unknown-unknown"
cache-all-crates: "true"
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo clippy -p anyrender --target wasm32-unknown-unknown -- -D warnings
- run: cargo clippy -p anyrender_vello --target wasm32-unknown-unknown -- -D warnings
- run: cargo clippy -p anyrender_vello_hybrid --target wasm32-unknown-unknown --features webgl -- -D warnings
# just cargo check for now
matrix_test:
runs-on: ${{ matrix.platform.os }}
env:
RUST_CARGO_COMMAND: ${{ matrix.platform.cross == true && 'cross' || 'cargo' }}
strategy:
matrix:
platform:
- {
name: windows,
target: x86_64-pc-windows-msvc,
os: windows-latest,
cross: false,
command: "test",
args: "--workspace --tests --features anyrender/serde,anyrender_skia/log_frame_times,anyrender_skia/pixels_window_renderer,anyrender_skia/softbuffer_window_renderer,pixels_window_renderer/log_frame_times,softbuffer_window_renderer/log_frame_times,anyrender_vello/log_frame_times,anyrender_vello_cpu/filters,anyrender_vello_cpu/log_frame_times,anyrender_vello_cpu/multithreading,anyrender_vello_cpu/pixels_window_renderer,anyrender_vello_cpu/softbuffer_window_renderer,anyrender_vello_hybrid/log_frame_times,anyrender_vello_hybrid/webgl,anyrender_svg/image",
setup: perl -pi.bak -e 's/opt-level = 2/opt-level = 0/g' Cargo.toml
}
- {
name: macos,
target: aarch64-apple-darwin,
os: macos-latest,
cross: false,
command: "test",
args: "--all --tests",
setup: perl -pi.bak -e 's/opt-level = 2/opt-level = 0/g' Cargo.toml
}
- {
name: linux,
target: x86_64-unknown-linux-gnu,
os: ubuntu-latest,
cross: false,
command: "test",
args: "--all --tests --all-features",
}
name: Test (${{ matrix.platform.name }})
steps:
- uses: actions/checkout@v4
- name: install stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: ${{ matrix.platform.target }}
components: rustfmt
- name: Install cross
if: ${{ matrix.platform.cross == true }}
uses: taiki-e/install-action@cross
- uses: Swatinem/rust-cache@v2
with:
key: "${{ matrix.platform.target }}"
cache-all-crates: "true"
save-if: ${{ github.ref == 'refs/heads/main' }}
cache-bin: ${{ matrix.os != 'macos-latest' }} # works around https://github.com/Swatinem/rust-cache/issues/341
- name: Install development libraries on ubuntu
if: ${{ matrix.platform.os == 'ubuntu-latest' }}
run: sudo apt-get update && sudo apt-get install -y libfontconfig1-dev libfreetype6-dev
- name: Setup
run: ${{ matrix.platform.setup }}
shell: bash
- name: test
run: |
${{ env.RUST_CARGO_COMMAND }} ${{ matrix.platform.command }} ${{ matrix.platform.args }} --target ${{ matrix.platform.target }}
# Fails if rust-skia doesn't publish a prebuilt binary matching anyrender_skia's skia-bindings
# features, which would make downstream builds silently fall back to a full Skia source build.
# Computes the binary-cache key with `cargo tree` and checks the download URL; nothing is compiled.
skia-prebuilt-guard:
name: Skia prebuilt guard
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: >-
python3 .github/scripts/check_skia_prebuilt.py
x86_64-pc-windows-msvc
aarch64-pc-windows-msvc
x86_64-unknown-linux-gnu
aarch64-unknown-linux-gnu
x86_64-apple-darwin
aarch64-apple-darwin
clippy-skia-windows:
name: "Clippy [anyrender_skia, windows]"
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- run: cargo clippy -p anyrender_skia -- -D warnings