sqlness 0.2.0

SQL integration test harness
Documentation
# Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0.

name: CI

on:
  workflow_dispatch:
  push:
    branches:
      - main
    paths-ignore:
      - '**.md'
  pull_request:
    branches:
      - main
    paths-ignore:
      - '**.md'

# Common environment variables
env:
  RUSTFLAGS: "-C debuginfo=1"
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: "1"
  LOCK_FILE: Cargo.lock

jobs:
  linux-ci:
    name: linux-ci
    runs-on: ubuntu-latest
    timeout-minutes: 60
    strategy:
      matrix:
        rust: [stable]
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true
      - run: |
          rustup set auto-self-update disable
          rustup toolchain install ${{ matrix.rust }} --profile minimal
      - name: Cache Rust Dependencies
        uses: actions/cache@v3
        with:
          path: |
            ~/.cargo
            ./target
          key: debug-${{ runner.os }}-${{ hashFiles('rust-toolchain') }}-${{ hashFiles('Cargo.lock') }}
          restore-keys: |
            debug-${{ runner.os }}-${{ hashFiles('rust-toolchain') }}-
            debug-${{ runner.os }}-
            debug-${{ runner.os }}
      - name: Backup Lock File
        run: |
          cp ${LOCK_FILE} ${LOCK_FILE}.bak
      - name: Install cargo-sort
        run: |
          cargo install cargo-sort
      - name: Run Style Check
        run: |
          make check-license
          make clippy
          make fmt
          make check-cargo-toml
      - name: Run Unit Tests
        run: |
          make test
          echo "Checking if ${LOCK_FILE} has changed..."
      - name: Run basic example
        run: |
          make basic-example
      - name: Run bad example
        run: |
          if make bad-example; then
            echo "Cannot reach here, this example should fail"
            exit 1
          else
            echo "Expected, this example should fail"
          fi

          if [ -f "/tmp/sqlness-bad-example.lock" ]; then
            echo "Lock file should be deleted after run."
            exit 1
          else
            echo "Expected, lock file is deleted."
          fi
      - name: Check Lock File
        run: |
          diff ${LOCK_FILE} ${LOCK_FILE}.bak