feat: support template interceptor #161
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" | |
jobs: | |
sqlness: | |
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: sqlness-${{ runner.os }}-${{ hashFiles('Cargo.toml') }} | |
restore-keys: | | |
sqlness-${{ runner.os }}- | |
- 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 | |
- name: Run good examples | |
run: | | |
make good-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 | |
sqlness-cli: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
# Service containers to run with `container-job` | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres | |
# Provide the password for postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5432:5432 | |
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 | |
./cli/target | |
key: cli-${{ runner.os }}-${{ hashFiles('cli/Cargo.toml') }} | |
restore-keys: | | |
cli-${{ runner.os }}- | |
- uses: shogo82148/actions-setup-mysql@v1 | |
with: | |
mysql-version: '8.0' | |
root-password: 1a2b3c | |
- name: Run Tests | |
run: | | |
mysql -uroot -p1a2b3c -h127.0.0.1 -e 'create database if not exists public;' | |
make cli-test |