kataan 0.0.7

A high-performance JavaScript engine written in pure Rust. Library, C FFI, and CLI.
Documentation
name: CI

on:
  push:
    branches: [master]
  pull_request:
  schedule:
    # Nightly full Test262 conformance run (07:17 UTC — off the busy top of hour).
    - cron: "17 7 * * *"
  workflow_dispatch:

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: Test & lint (${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
    steps:
      - uses: actions/checkout@v6

      - name: Fetch the intl crate (path-dependency sibling)
        run: git clone --depth 1 https://github.com/KarpelesLab/intlrs.git ../unicoders

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy

      - name: Cache
        uses: Swatinem/rust-cache@v2
        with:
          key: ${{ matrix.os }}

      - name: Format
        if: runner.os == 'Linux' # formatting is platform-independent
        # Scope to our own package: the `intl` path dependency (`../unicoders`) is
        # an upstream checkout whose formatting we do not gate on.
        run: cargo fmt --check -p kataan

      - name: Clippy (all features, warnings denied)
        run: cargo clippy --all-targets --all-features -- -D warnings

      - name: Test (all features)
        run: cargo test --all-features

  core_builds:
    name: Core / no_std builds
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - name: Fetch the intl crate (path-dependency sibling)
        run: git clone --depth 1 https://github.com/KarpelesLab/intlrs.git ../unicoders

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Cache
        uses: Swatinem/rust-cache@v2

      # The pure language core must build with only `alloc` — no std, no host.
      - name: Build language core (alloc only)
        run: cargo build --no-default-features --features alloc

      - name: Build with regex but no host
        run: cargo build --no-default-features --features alloc,regex,intl

  c_abi:
    name: C ABI smoke test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - name: Fetch the intl crate (path-dependency sibling)
        run: git clone --depth 1 https://github.com/KarpelesLab/intlrs.git ../unicoders

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Cache
        uses: Swatinem/rust-cache@v2

      - name: Build the C library (static + shared)
        run: |
          cargo rustc --lib --release --features ffi --crate-type staticlib
          cargo rustc --lib --release --features ffi --crate-type cdylib

      - name: Compile and run the C smoke test
        run: |
          cc tests/ffi_smoke.c -I include target/release/libkataan.a \
             -lpthread -ldl -lm -o ffi_smoke
          ./ffi_smoke

  docs:
    name: Docs build (warnings denied)
    runs-on: ubuntu-latest
    env:
      RUSTDOCFLAGS: -D warnings -D rustdoc::broken-intra-doc-links
    steps:
      - uses: actions/checkout@v6

      - name: Fetch the intl crate (path-dependency sibling)
        run: git clone --depth 1 https://github.com/KarpelesLab/intlrs.git ../unicoders

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Cache
        uses: Swatinem/rust-cache@v2

      - name: cargo doc --no-deps --all-features
        run: cargo doc --no-deps --all-features

  test262_official:
    name: Test262 full conformance (nightly)
    # Heavy: runs the whole ~53k-test official corpus. Only on the nightly
    # schedule or a manual dispatch, never on every PR.
    if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
    runs-on: ubuntu-latest
    timeout-minutes: 45
    steps:
      - uses: actions/checkout@v6
        with:
          # Pull the pinned tc39/test262 corpus submodule (shallow).
          submodules: recursive

      - name: Fetch the intl crate (path-dependency sibling)
        run: git clone --depth 1 https://github.com/KarpelesLab/intlrs.git ../unicoders

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Cache
        uses: Swatinem/rust-cache@v2

      # Gates against tests/test262-status.txt: fails if any test regresses
      # (fails while not listed in the ledger). Prints the measured pass-rate.
      - name: Run the official Test262 corpus
        run: cargo test --release --test test262_official -- --ignored --nocapture