-
Notifications
You must be signed in to change notification settings - Fork 2
170 lines (141 loc) · 4.4 KB
/
Copy pathci.yml
File metadata and controls
170 lines (141 loc) · 4.4 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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
permissions:
contents: read
jobs:
test:
name: Rust tests
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
rust: [stable]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy,rustfmt
- name: Install system dependencies (Skia)
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends libfontconfig1-dev libfreetype6-dev
shell: bash
- name: Cache cargo registry + git + build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Show cargo version
run: cargo --version --verbose
- name: Fetch dependencies
run: cargo fetch
- name: Build (check) workspace
run: cargo check --workspace --exclude examples
- name: Run tests
run: cargo test --no-fail-fast
- name: Run clippy (lints)
run: cargo clippy --workspace --all-features -- -D warnings
- name: Rustfmt check
run: |
if ! cargo fmt --all -- --check; then
echo "::error ::Code is not formatted. Run 'cargo fmt'";
exit 1;
fi
minimal:
name: Minimal feature build
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install system dependencies (Skia)
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends libfontconfig1-dev libfreetype6-dev
shell: bash
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-min-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-min-
- name: Build default feature set
run: cargo build --workspace
wasm:
name: Build WASM (Emscripten)
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-emscripten
- name: Add wasm32-unknown-emscripten target
run: rustup target add wasm32-unknown-emscripten
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends libfontconfig1-dev libfreetype6-dev
shell: bash
- name: Install Emscripten SDK
uses: mymindstorm/setup-emsdk@v14
with:
version: 5.0.0
- name: Verify Emscripten
run: emcc --version
- name: Cache cargo registry + git + build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-wasm-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-wasm-
- name: Build WASM via cargo xtask
run: cargo xtask emscripten --features skia-wasm --emsdk "$EMSDK"
- name: Verify build artifacts exist
run: |
test -f examples/web/dist/emscripten.js
test -f examples/web/dist/emscripten.wasm
echo "✅ WASM artifacts built successfully"
ls -lh examples/web/dist/
- name: Upload Pages artifact
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
with:
path: examples/web
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
needs: [test, wasm]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4