vimlrs 0.2.1

Faithful Rust port of the Vimscript (VimL) interpreter, from the Neovim C eval engine
Documentation
name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
  workflow_dispatch:

permissions:
  contents: read
  actions: write

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always

jobs:
  check:
    name: Check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy
      - uses: Swatinem/rust-cache@v2
      - run: cargo fmt --all --check
      - run: cargo clippy --all-targets --locked -- -D warnings
      - run: cargo check --all-targets --locked

  test:
    name: Test
    runs-on: ${{ matrix.os }}
    env:
      RUST_BACKTRACE: 1
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      # No-op on macOS via runner.os guard inside the composite action.
      - uses: Swatinem/rust-cache@v2
      # Runs the lib unit tests, the drift gate (tests/ported_fn_names_match_c.rs,
      # which derives the legal-name set straight from the vendored vendor/ tree so
      # a fresh checkout passes), and the example self-tests (tests/examples.rs
      # runs every examples/*.vim, each of which asserts its own results with the
      # built-in assert_* framework and exits non-zero on a regression).
      - run: cargo test --locked --no-fail-fast

  # fmt + clippy (deny warnings) run in the `check` job above. The `doc` gate
  # stays without `-D warnings`: the ported tree carries faithful-to-C doc
  # comments whose [bracket] snippets trip rustdoc's intra-doc-link lint, so
  # cosmetic doc warnings are advisory (hard doc errors still fail the build).

  doc:
    name: Doc
    runs-on: ubuntu-latest
    timeout-minutes: 20
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      # No `-D warnings`: the ported tree carries many faithful-to-C doc
      # comments whose `[bracket]` snippets trip rustdoc's intra-doc-link
      # lint. Hard doc errors still fail the build; cosmetic warnings do not.
      - run: cargo doc --no-deps --locked

  examples:
    name: Example scripts
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - run: cargo build --release --locked
      # Run every examples/*.vim through the real binary. Each example is a
      # self-test: it asserts its results with the built-in assert_* framework
      # and `throw`s (non-zero exit) on a failed assertion, so a behaviour
      # regression in a ported builtin fails this job. The interactive example
      # gets its canned stdin from tests/fixtures/interactive.in.
      - name: Run example scripts
        run: sh scripts/run_examples.sh
        env:
          VIMLRS: ${{ github.workspace }}/target/release/viml

  release-build:
    name: Release Build
    needs: [check, test, doc, examples]
    runs-on: ${{ matrix.os }}
    timeout-minutes: 60
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
          - os: macos-latest
            target: x86_64-apple-darwin
          - os: macos-latest
            target: aarch64-apple-darwin
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}
      # No-op on macOS via runner.os guard in the composite action.
      - uses: Swatinem/rust-cache@v2
      - run: cargo build --release --locked --target ${{ matrix.target }}
      - uses: actions/upload-artifact@v4
        with:
          name: viml-${{ matrix.target }}
          path: target/${{ matrix.target }}/release/viml