mirror of
https://github.com/tursodatabase/libsql.git
synced 2025-05-23 21:16:07 +00:00
142 lines
3.7 KiB
YAML
142 lines
3.7 KiB
YAML
name: Rust
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
pull_request:
|
|
merge_group:
|
|
branches: [ "main" ]
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
PROTOC_VERSION: 3.23.4
|
|
# FIXME: There are some warnings depending on certain feature flags that
|
|
# we need to fix before we can enable this.
|
|
# RUSTFLAGS: "-D warnings"
|
|
|
|
jobs:
|
|
checks:
|
|
runs-on: ubuntu-latest
|
|
name: Run Checks
|
|
env:
|
|
RUSTFLAGS: -D warnings
|
|
steps:
|
|
- uses: hecrj/setup-rust-action@v1
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Set up cargo cache
|
|
uses: actions/cache@v3
|
|
continue-on-error: false
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
target/
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: ${{ runner.os }}-cargo-
|
|
|
|
- name: Cargo fmt
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: fmt
|
|
args: --check
|
|
|
|
- name: Cargo check
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
args: --all-targets --all-features
|
|
|
|
- name: Test openssl
|
|
shell: bash {0}
|
|
run: cargo tree -p sqld -i openssl; [ $? = 101 ]
|
|
|
|
# Disabled because we vendor rusqlite which does not use
|
|
# clippy so it warns.
|
|
# - name: Clippy
|
|
# uses: actions-rs/clippy-check@v1
|
|
# with:
|
|
# token: ${{ secrets.GITHUB_TOKEN }}
|
|
# args: --all-targets --all-features -- -D warnings
|
|
|
|
|
|
features:
|
|
name: Check features and unused dependencies
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: dtolnay/rust-toolchain@nightly
|
|
- uses: taiki-e/install-action@cargo-hack
|
|
- uses: taiki-e/install-action@cargo-udeps
|
|
- uses: Swatinem/rust-cache@v2
|
|
- run: cargo +nightly hack udeps -p libsql --each-feature
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
name: Run Tests
|
|
env:
|
|
RUSTFLAGS: -D warnings
|
|
services:
|
|
minio:
|
|
image: lazybit/minio
|
|
ports:
|
|
- 9000:9000
|
|
- 9090:9090
|
|
env:
|
|
MINIO_ACCESS_KEY: minioadmin
|
|
MINIO_SECRET_KEY: minioadmin
|
|
volumes:
|
|
- /data
|
|
options: --name=minio --health-cmd "curl http://localhost:9000/minio/health/live"
|
|
steps:
|
|
- uses: hecrj/setup-rust-action@v1
|
|
|
|
# needed because we run out of disk space during tests
|
|
- name: Free Disk Space (Ubuntu)
|
|
uses: jlumbroso/free-disk-space@main
|
|
with:
|
|
# this might remove tools that are actually needed,
|
|
# when set to "true" but frees about 6 GB
|
|
tool-cache: true
|
|
|
|
- name: Install deps
|
|
run: sudo apt update && sudo apt install -y libclang-dev
|
|
|
|
- name: Install protoc
|
|
uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: protoc@${{ env.PROTOC_VERSION }}
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Set up cargo cache
|
|
uses: actions/cache@v3
|
|
continue-on-error: false
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
target/
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: ${{ runner.os }}-cargo-
|
|
|
|
- name: Run tests
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|
|
args: --verbose
|
|
env:
|
|
LIBSQL_BOTTOMLESS_AWS_ACCESS_KEY_ID: minioadmin
|
|
LIBSQL_BOTTOMLESS_AWS_SECRET_ACCESS_KEY: minioadmin
|
|
LIBSQL_BOTTOMLESS_AWS_DEFAULT_REGION: eu-central-2
|
|
LIBSQL_BOTTOMLESS_BUCKET: bottomless
|
|
LIBSQL_BOTTOMLESS_ENDPOINT: http://localhost:9000
|