Skip to content

Merge pull request #112 #290

Merge pull request #112

Merge pull request #112 #290

Workflow file for this run

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