adya 0.1.0

Black-box transactional isolation checker: finds G0, G1, G-single, G2 and friends in database histories. A native, JVM-free take on Jepsen's Elle.
Documentation
name: ci

on:
  push:
    branches: [main]
  pull_request:

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy
      - uses: Swatinem/rust-cache@v2
      - run: cargo fmt --check
        if: matrix.os == 'ubuntu-latest'
      - run: cargo clippy --all-targets -- -D warnings
        if: matrix.os == 'ubuntu-latest'
      - run: cargo test
      - run: cargo build --no-default-features
      - name: exec driver with the Python example client
        if: matrix.os == 'ubuntu-latest'
        run: |
          cargo run --release -- run exec --url "python3 examples/exec_sqlite.py /tmp/exec.db" -n 1000 -c strict-serializable
          cargo run --release -- run exec -m rw-register --url "python3 examples/exec_sqlite.py /tmp/exec-rw.db rw-register" -n 1000 -c strict-serializable

  # adya against Jepsen's Elle: Elle's own expected results, then random
  # histories checked by both.
  elle:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - uses: actions/setup-java@v4
        with:
          distribution: temurin
          java-version: "21"
      - run: cargo build --release
      - name: Fetch elle-cli
        run: |
          git clone --depth 1 https://github.com/ligurio/elle-cli /tmp/elle-cli
          gh release download 0.1.11 -R ligurio/elle-cli -p '*.zip' -D /tmp
          unzip -q /tmp/elle-cli-bin-0.1.11.zip -d /tmp/elle-bin
        env:
          GH_TOKEN: ${{ github.token }}
      - name: Elle's expected results
        run: python3 scripts/compare_elle_results.py /tmp/elle-cli/test/test-data target/release/adya
      - name: Random histories, both checkers
        run: python3 scripts/differential.py target/release/adya /tmp/elle-bin/target/elle-cli-0.1.11-standalone.jar 40
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: differential-histories
          path: out/differential/

  databases:
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:17
        env:
          POSTGRES_PASSWORD: adya
        ports: ["5432:5432"]
        options: --health-cmd pg_isready --health-interval 2s --health-timeout 5s --health-retries 20
      mysql:
        image: mysql:8.4
        env:
          MYSQL_ROOT_PASSWORD: adya
          MYSQL_DATABASE: adya
        ports: ["3306:3306"]
        options: --health-cmd "mysqladmin ping -padya" --health-interval 2s --health-timeout 5s --health-retries 30
    env:
      PG: postgres://postgres:adya@localhost:5432/postgres
      MY: mysql://root:adya@localhost:3306/adya
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - run: cargo build --release
      - name: Postgres
        run: bash scripts/databases.sh postgres "$PG"
      - name: MySQL
        run: bash scripts/databases.sh mysql "$MY"
      - name: Postgres SERIALIZABLE while being restarted
        run: |
          pg=$(docker ps -q --filter ancestor=postgres:17)
          target/release/adya run postgres --url "$PG" -i serializable -n 6000 -p 10 --keys 6             --fault "docker restart -t 0 $pg" --heal "true" --fault-every 3 --fault-for 1             -c strict-serializable -o out/postgres-restarts.jsonl | head -20
          test "${PIPESTATUS[0]}" -eq 0
          echo "faults: $(grep -c start-fault out/postgres-restarts.jsonl), indeterminate: $(grep -c '"type":"info","f":"txn"' out/postgres-restarts.jsonl)"
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: histories
          path: out/