timberfs 0.10.1

Experimental append-only, transparently compressed, write-time-indexed filesystem for log files
Documentation
name: CI

on:
  pull_request:
  push:
    branches: [main]

env:
  CARGO_TERM_COLOR: always

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

  vm-tests-matrix:
    name: vm-tests (${{ matrix.image }})
    runs-on: ubuntu-latest
    timeout-minutes: 30
    strategy:
      fail-fast: false
      matrix:
        # We ship one old-glibc .deb for every supported release, so test it on
        # the OLDEST we claim (focal — Ubuntu 20.04, systemd 245, glibc 2.31)
        # and a current one (trixie).
        image: [trixie, focal]
    steps:
      - uses: actions/checkout@v4
      # /dev/kvm exists on GitHub's standard runners but isn't accessible
      # to the runner user by default
      - name: Enable KVM for the runner user
        run: |
          echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
            | sudo tee /etc/udev/rules.d/99-kvm4all.rules
          sudo udevadm control --reload-rules
          sudo udevadm trigger --name-match=kvm
      - name: Install QEMU and ISO tooling
        run: |
          sudo apt-get update -qq
          sudo apt-get install -y -qq qemu-system-x86 qemu-utils genisoimage
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - name: Cache cloud base image
        uses: actions/cache@v4
        with:
          path: ~/.cache/timberfs-vm-tests
          key: vm-base-${{ matrix.image }}
      - uses: taiki-e/install-action@v2
        with:
          tool: cargo-deb,cargo-zigbuild
      - name: Install zig (cargo-zigbuild's cross linker)
        # Extract OUTSIDE the checkout so the working tree stays clean.
        run: |
          curl -fL --retry 3 \
            https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz \
            | tar -xJ -C "$RUNNER_TEMP"
          echo "$RUNNER_TEMP/zig-linux-x86_64-0.13.0" >> "$GITHUB_PATH"
      # Build and test exactly what we ship: the old-glibc compat .deb.
      - name: Build the compat .deb
        run: |
          cargo zigbuild --release --target x86_64-unknown-linux-gnu.2.31
          cargo deb --variant compat --no-build --target x86_64-unknown-linux-gnu
      - name: Run the VM package test suite
        env:
          TIMBERFS_VM_IMAGE: ${{ matrix.image }}
        run: tests/vm/run-vm-test.sh target/x86_64-unknown-linux-gnu/debian/timberfs_*_amd64.deb

  # Single required status check that stays green iff every matrix leg passed.
  # Branch protection requires the context `vm-tests`; the matrix legs report as
  # `vm-tests (trixie)` / `vm-tests (focal)`, so this aggregates them into that
  # one name without pinning the protection rule to specific matrix values.
  vm-tests:
    needs: vm-tests-matrix
    if: always()
    runs-on: ubuntu-latest
    steps:
      - name: Gate on the matrix result
        run: |
          if [ "${{ needs.vm-tests-matrix.result }}" != "success" ]; then
            echo "a vm-tests matrix leg did not succeed: ${{ needs.vm-tests-matrix.result }}" >&2
            exit 1
          fi