meterstore 0.2.0

Hot/cold tiered store for metering time series — PostgreSQL for the recent window, Apache Iceberg for history.
Documentation
name: CI

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

env:
  CARGO_TERM_COLOR: always
  RUSTFLAGS: -D warnings

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

      # This graph is DataFusion + Arrow + Iceberg + sqlx + tonic + axum, and a
      # debug build of it is tens of gigabytes of artifacts. A hosted runner has
      # ~14 GB free, and running out does not fail tidily: `rust-lld` takes a
      # **bus error** writing an output it cannot extend, which reads as a
      # linker bug rather than as a full disk. Reclaiming the preinstalled
      # toolchains this job never uses buys ~20 GB.
      - name: Free runner disk
        run: |
          before=$(df -m --output=avail / | tail -1)
          sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc \
                      /usr/local/share/boost "$AGENT_TOOLSDIRECTORY" || true
          after=$(df -m --output=avail / | tail -1)
          echo "reclaimed $(( (after - before) / 1024 )) GiB; $(( after / 1024 )) GiB free"

      - uses: dtolnay/rust-toolchain@stable
        with: { components: rustfmt, clippy }
      - uses: Swatinem/rust-cache@v2

      - name: Format
        run: cargo fmt --all -- --check

      - name: Clippy
        run: cargo clippy --all-targets --all-features -- -D warnings

      # Every integration test starts its own PostgreSQL container, so the
      # limit is Docker's rather than the CPU's. `cargo test` defaults to one
      # thread per core; unbounded, the suite exhausts container slots and fails
      # with `PortNotExposed` or a create timeout — which looks like a broken
      # test and is not.
      - name: Test
        run: cargo test --all-features -- --test-threads=4

      - name: Docs
        run: cargo doc --no-deps --all-features
        env:
          RUSTDOCFLAGS: -D warnings

  # Two DataFusion majors in one graph give mutually incompatible
  # `TableProvider` types. This already happened once via
  # `datafusion-table-providers`, so it is a hard gate, not a lint.
  single-sourced-deps:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - name: No duplicate datafusion / arrow / iceberg
        run: |
          # `cargo tree -d` also lists a package twice when it is built for both
          # host and target (build-dependencies), at the *same* version. That is
          # not a conflict. Only differing versions of a single-sourced crate are.
          conflicts=$(cargo tree -d --edges normal 2>/dev/null \
            | grep -oE '^(datafusion|arrow|iceberg|parquet|metering|time|rust_decimal) v[0-9.]+' \
            | sort -u \
            | awk '{ seen[$1]++ } END { for (n in seen) if (seen[n] > 1) print n }')
          if [ -n "$conflicts" ]; then
            echo "::error::multiple versions of a single-sourced dependency: $conflicts"
            cargo tree -d --edges normal
            exit 1
          fi
          echo "single-sourced dependencies OK"


  # A declared MSRV that nothing checks is a guess. This makes it a fact.
  msrv:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - id: msrv
        run: |
          v=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].rust_version')
          echo "version=$v" >> "$GITHUB_OUTPUT"
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ steps.msrv.outputs.version }}
      - uses: Swatinem/rust-cache@v2
      - run: cargo check --all-features --all-targets

  deny:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: EmbarkStudios/cargo-deny-action@v2