redb 1.0.0

Rust Embedded DataBase
Documentation
name: CI

on:
  pull_request:
  push: # required for actions/cache to work
    branches:
      - master

jobs:
  ci:
    strategy:
      matrix:
        os: ["ubuntu-20.04", "macos-latest", "windows-latest"]

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

    env:
      RUSTFLAGS: --deny warnings

    steps:
      - uses: actions/checkout@v2
      - name: Cache
        id: rust-cache
        uses: actions/cache@v3
        with:
            path: |
                ~/.cargo/bin/
                ~/.cargo/registry/index/
                ~/.cargo/registry/cache/
                ~/.cargo/git/db/
                target/
            key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-cargo-deny-0-12-2-cargo-fuzz-0-11-0-just-1-8-0

      - name: Check for forbidden words
        run: "! grep --include='*.rs' -RE 'to_be_bytes|from_be_bytes|dbg!' ."
        if: runner.os != 'Windows'

      - name: Install packages
        if: startsWith(matrix.os, 'ubuntu')
        run: |
          sudo apt update
          sudo apt install -y python3 python3-pip python3-dev python3-venv gcc-multilib libclang-dev

      - name: Install packages
        if: startsWith(matrix.os, 'macos')
        run: |
          brew install python3

      - name: Install packages
        uses: actions/setup-python@v4
        if: startsWith(matrix.os, 'windows')
        with:
          python-version: "3.10"
          architecture: "x64"

      - uses: actions-rs/toolchain@v1
        with:
          toolchain: 1.67
          components: rustfmt, clippy
          default: true

      - name: Install cargo-deny
        if: steps.rust-cache.outputs.cache-hit != 'true'
        run: cargo install --force --version 0.12.2 cargo-deny --locked

      - name: Install cargo-fuzz
        if: steps.rust-cache.outputs.cache-hit != 'true'
        run: cargo install --force --version 0.11.0 cargo-fuzz --locked

      - name: Install just
        if: steps.rust-cache.outputs.cache-hit != 'true'
        run: cargo install --force --version 1.8.0 just --locked

      - name: Compile
        run: cargo build --all-targets --all-features

      - name: Fuzzer
        run: just fuzz_ci
        if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')

      - name: Run tests
        run: just build test

      - name: Clippy
        run: cargo clippy --all --all-targets

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

      - name: Run CPython wrapper tests
        if: runner.os != 'Windows'
        run: |
          python3 -m venv venv
          source venv/bin/activate
          pip3 install --upgrade pip
          pip3 install maturin
          just test_py

      - name: Run CPython wrapper tests
        if: runner.os == 'Windows'
        run: |
          python3 -m venv venv
          venv\Scripts\activate
          pip3 install --upgrade pip
          pip3 install maturin
          just test_py

      - name: Run WASI tests
        if: startsWith(matrix.os, 'macos')
        run: |
          rustup toolchain install nightly
          rustup target add wasm32-wasi
          brew install wasmtime
          cargo install --force --version 0.1.27 cargo-wasi --locked
          just test_wasi