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 -p chartlet-wasm --target wasm32-unknown-unknown -- -D warnings
- name: Test
run: cargo test
- 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
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
- name: npm package and Astro integration
working-directory: packages/chartlet
run: |
npm ci
npm run build:wasm
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