surrealkv 0.21.3

A low-level, versioned, embedded, ACID-compliant, key-value database for Rust
Documentation
name: CI

run-name: "CI run '${{ github.head_ref || github.ref_name }}'"

permissions:
  contents: read

on:
  workflow_dispatch:
  push:
    branches:
      - main
  pull_request:

defaults:
  run:
    shell: bash

jobs:
  build-test:
    strategy:
      matrix:
        target: [ 'x86_64-unknown-linux-gnu', 'aarch64-unknown-linux-gnu', 'x86_64-pc-windows-msvc', 'x86_64-apple-darwin', 'aarch64-apple-darwin' ]
        include:
          - target: x86_64-unknown-linux-gnu
            os: ubuntu-latest
          - target: aarch64-unknown-linux-gnu
            os: ubuntu-latest
          - target: x86_64-pc-windows-msvc
            os: windows-latest
          - target: x86_64-apple-darwin
            os: macos-latest
          - target: aarch64-apple-darwin
            os: macos-latest


    runs-on: ${{ matrix.os }}

    steps:
      - name: Checkout sources
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

      - name: Setup cache
        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
        with:
          save-if: ${{ github.ref == 'refs/heads/main' }}

      - uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # stable
        with:
          toolchain: stable
          targets: ${{ matrix.target }}
          components: rustfmt, clippy

      - name: Build
        run: cargo build --target=${{ matrix.target }}

      - name: Run tests
        if: ${{ !contains(matrix.os, 'windows') }}
        # Skip tests on Windows as compaction tests and some file system operations are not supported
        run: make test

  ci:
    runs-on: ubuntu-latest
    env:
      RUSTFLAGS: --deny warnings

    steps:
      - name: Checkout sources
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

      - name: Setup cache
        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
        with:
          save-if: ${{ github.ref == 'refs/heads/main' }}

      - uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # stable
        with:
          toolchain: stable
          components: rustfmt, clippy

      - name: Install cargo-deny
        run: which cargo-deny || cargo install --debug --locked cargo-deny@0.14.24

      - name: License check
        run: cargo deny --all-features check licenses

      - name: Clippy
        run: cargo clippy -- -Dwarnings
      - name: Build WASM
        run: |
          rustup target add wasm32-unknown-unknown
          RUSTFLAGS="-A warnings --cfg getrandom_backend=\"wasm_js\"" cargo build --target wasm32-unknown-unknown
  
  format:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout sources
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

      - uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # nightly
        with:
          toolchain: nightly
          components: rustfmt

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