Skip to content

Add a test for aggregate functions with aliases #414

Add a test for aggregate functions with aliases

Add a test for aggregate functions with aliases #414

---
# Main "useful" actions config file
# Cache config comes from https://github.com/actions/cache/blob/main/examples.md#rust---cargo
# actions-rs/toolchain configures rustup
# actions-rs/cargo actually runs cargo
on:
push:
branches:
- main
pull_request:
name: Rust Validation
env:
# RUSTDOCFLAGS: -D warnings
# RUSTFLAGS: -D warnings -C debuginfo=1
RUST_BACKTRACE: 1
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
jobs:
clippy:
name: "Clippy (cargo clippy)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: rustup default 1.78.0 && rustup component add clippy && rustup update
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-features --all-targets
- run: cargo clippy --no-default-features --all-targets
msrv:
name: "Check MSRV"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: rustup default 1.65.0 && rustup update
- uses: Swatinem/rust-cache@v2
- run: cargo check --all-features -p udf
- run: cargo check --no-default-features -p udf
test:
strategy:
fail-fast: true
matrix:
include:
- build: linux
os: ubuntu-latest
target: x86_64-unknown-linux-musl
extension: ''
# - build: macos
# os: macos-latest
# target: x86_64-apple-darwin
# extension: ''
- build: windows-msvc
os: windows-latest
target: x86_64-pc-windows-msvc
name: "Test on ${{ matrix.os }} (cargo test)"
runs-on: ${{ matrix.os }}
env:
MYSQLCLIENT_LIB_DIR: 'C:\Program Files\MySQL\MySQL Server 8.0\lib'
# will be accepted by a later Diesel version
MYSQLCLIENT_LIB_DIR_X86_64_PC_WINDOWS_MSVC: 'C:\Program Files\MySQL\MySQL Server 8.0\lib'
steps:
- uses: actions/checkout@v2
# use a version later than MSRV for trybuild consistency
- run: rustup default 1.70 && rustup update
- run: rustc -vV
- uses: Swatinem/rust-cache@v2
- run: cargo test -vvv
integration:
name: "Integration testing (docker)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: rustup default stable && rustup update
- uses: Swatinem/rust-cache@v2
- name: Cache Docker layers
uses: actions/cache@v2
id: cache-docker
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Enable logging-debug-calls
run: |
perl -0777 -i -pe 's/(udf =.*features = \[)/\1"logging-debug-calls",\3/g' udf-examples/Cargo.toml
cat udf-examples/Cargo.toml
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build Image
uses: docker/build-push-action@v3
with:
load: true
tags: mdb-example-so:latest
file: Dockerfile.examples
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
context: .
- # Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Start docker
run: >
docker run --rm -d
-p 12300:3306
-e MARIADB_ROOT_PASSWORD=example
-e RUST_LIB_BACKTRACE=1
--name mdb-example-container
mdb-example-so
&& sleep 4
# verify we started successfully
- run: mysql -uroot -pexample -h0.0.0.0 -P12300 --protocol=tcp -e 'show databases'
- name: Run integration testing
# Run only integration tests with `--test '*'`
run: cargo test -p udf-examples --test '*' --features backend
- name: Print docker logs
if: always()
run: |
docker logs mdb-example-container
# If any critical / debug options were printed, error out
docker logs mdb-example-container 2>&1 | grep -E '\[(Critical|Error)\]' || exit 0 && exit 1;
docker stop mdb-example-container
miri:
name: Miri
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: rustup default nightly && rustup component add miri && rustup update
- uses: Swatinem/rust-cache@v2
- name: Run Miri
env:
# Can't use chrono for time in isolation
MIRIFLAGS: -Zmiri-disable-isolation
run: cargo miri test
fmt:
name: "Format (cargo fmt)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: rustup default nightly && rustup component add rustfmt && rustup update
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
- uses: actions/setup-python@v3
- name: Validate pre-commit
uses: pre-commit/action@v3.0.0
doc:
name: "Docs (cargo doc)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: rustup default nightly && rustup update
- uses: Swatinem/rust-cache@v2
- run: cargo doc
outdated:
name: Outdated
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: dtolnay/install@cargo-outdated
- uses: Swatinem/rust-cache@v2
- run: cargo outdated --workspace --exit-code 1 --ignore lipsum
security_audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: rustsec/audit-check@v1.4.1
with:
token: ${{ secrets.GITHUB_TOKEN }}