Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/knut

.github/workflows/ci.yml

name: CI

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

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1

jobs:
  build-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

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

      - name: Cache cargo
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: ${{ runner.os }}-cargo-

      # Default features only: the heavy/opt-in features (knut-pipelines `grpc`
      # runs protoc, `gui`/`live` pulls the native GUI stack; knut-bifrost
      # `spark`/`wasm`/`flight` etc.) stay off so CI is network- and protoc-free.
      # The wasm32 guest crate is excluded from the native workspace by design.
      # Features whose tests must still run get an explicit lane below —
      # default-only is a build policy, never a licence to skip tests.
      - name: Build workspace
        run: cargo build --workspace --verbose

      - name: Test workspace
        run: cargo test --workspace --verbose

      # --- Feature-gated test lanes -------------------------------------
      # The step above is default-features-only, and a test file carrying a
      # crate-level `#![cfg(feature = "X")]` for an off-by-default X compiles
      # to ZERO tests and still reports "ok" — silence that reads as success.
      # knut-thund's `native` lane is exactly that shape: 50 integration tests
      # across five files (streaming_microbatch, native_file_sink,
      # native_union_append, native_projection_pushdown, native_file_source)
      # plus 13 in-crate unit tests, none of them `#[ignore]`d, all of them
      # pure Rust + DataFusion with no container, network or external infra.
      # They ran to 0 for as long as this workflow was default-only.
      #
      # `native` deliberately stays OFF by default (it pulls the DataFusion
      # tree — see crates/knut-thund/Cargo.toml — and knut-thund is published
      # as a dependency-light IR/builder core), so the lane is re-invoked
      # EXPLICITLY here rather than folded into `default`. This step names the
      # feature, so the lane can never silently drop back to zero: if `native`
      # is renamed or removed, this step fails loudly instead of going quiet.
      #
      # Do NOT rely on workspace feature unification to cover this. `xtask`
      # carries a dev-dependency on `knut-thund` with `features = ["native"]`,
      # which does turn `native` on in a `--workspace` resolve today, but that
      # is invisible, incidental coupling — dropping the bench that needs it
      # would take these 50 tests dark again with no diff that mentions them.
      - name: Test knut-thund native (DataFusion) lane
        run: cargo test -p knut-thund --features native --verbose

      # Same shape, same reasoning: `tests/sql_frontend.rs` carries
      # `#![cfg(feature = "sql")]`, so a default-only run compiles it to ZERO
      # tests and reports "ok". `dsl` is named alongside `sql` because the
      # SQL -> IR -> RON -> IR equivalence test is additionally `dsl`-gated —
      # without it that one silently disappears while the file still looks
      # covered. No workspace crate turns `sql` on incidentally, so this step
      # is the ONLY thing keeping the lane alive.
      - name: Test knut-thund sql (authoring) lane
        run: cargo test -p knut-thund --features sql,dsl --verbose

  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

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

      # Informational: the workspace is not fully fmt/clippy-clean yet, so these
      # do not fail the build (no `-D warnings`).
      - name: Clippy
        run: cargo clippy --workspace --all-targets
        continue-on-error: true

      - name: Rustfmt
        run: cargo fmt --all -- --check
        continue-on-error: true