chartlet 0.15.0

Compile structured data into deterministic, accessible static charts
Documentation
name: CI

on:
  push:
    branches: [main]
    tags: ["v*"]
  pull_request:

permissions:
  contents: read

jobs:
  test:
    name: ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
    steps:
      - uses: actions/checkout@v7

      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy
          targets: wasm32-unknown-unknown

      - uses: Swatinem/rust-cache@v2

      - name: Format
        run: cargo fmt --check

      - name: Lint
        run: |
          cargo clippy --all-targets -- -D warnings
          cargo clippy --all-targets --features png -- -D warnings
          cargo clippy -p chartlet-wasm --target wasm32-unknown-unknown -- -D warnings

      # The golden tests compare against the committed SVGs, so this also checks that the
      # output is byte-identical on every platform.
      - name: Test
        run: |
          cargo test
          cargo test --features png

      - name: Examples are up to date
        run: |
          cargo build
          for spec in examples/*.json; do
            base="${spec%.json}"
            ./target/debug/chartlet render "$spec" --format svg -o "$base.svg"
            ./target/debug/chartlet render "$spec" --format html -o "$base.html"
            if [ -f "$base.mobile.svg" ]; then
              ./target/debug/chartlet render "$spec" --variant mobile -o "$base.mobile.svg"
            fi
            if [ -f "$base.print.svg" ]; then
              ./target/debug/chartlet render "$spec" --variant print -o "$base.print.svg"
            fi
            if [ -f "$base.social.svg" ]; then
              ./target/debug/chartlet render "$spec" --variant social -o "$base.social.svg"
            fi
          done
          git diff --exit-code -- examples/

      - uses: actions/setup-node@v7
        with:
          node-version: 22
          cache: npm
          cache-dependency-path: packages/chartlet/package-lock.json

      # The tests render through the WebAssembly build and, with an explicit binary, the CLI.
      - name: npm package and Astro integration
        working-directory: packages/chartlet
        run: |
          npm ci
          npm run build:wasm
          npm test

      # Runs against the published @casoon/chartlet; the view test needs a browser.
      - name: MCP server
        if: matrix.os == 'ubuntu-latest'
        working-directory: packages/chartlet-mcp
        run: |
          npm ci
          npx playwright install --with-deps chromium
          npm test

      - uses: pnpm/action-setup@v6
        if: matrix.os == 'ubuntu-latest'
        with:
          version: 10

      - name: Install site browser
        if: matrix.os == 'ubuntu-latest'
        working-directory: site
        run: |
          pnpm install --frozen-lockfile
          pnpm exec playwright install --with-deps chromium

      - name: Site build and accessibility
        if: matrix.os == 'ubuntu-latest'
        working-directory: site
        run: pnpm test