surrealpatch/.github/workflows/ci.yml
2022-12-30 08:23:19 +00:00

93 lines
2.5 KiB
YAML

name: Continuous integration
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
name: Test
runs-on: ubuntu-20.04
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
large-packages: false
swap-storage: false
- name: Checkout sources
uses: actions/checkout@v3
- name: Cache cargo assets
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-20.04-test-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run cargo test
run: |
(&>/dev/null cargo run -- start --log trace --user root --pass root memory &)
cargo test --workspace --features protocol-ws,protocol-http,kv-rocksdb
lint:
name: Lint
runs-on: ubuntu-20.04
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Cache cargo assets
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-20.04-lint-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
components: rustfmt, clippy
- name: Run cargo check --package surrealdb
run: cargo check --no-default-features --package surrealdb
- name: Run cargo check --workspace
run: cargo check --workspace
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Run cargo clippy
run: cargo clippy -- -W warnings
- name: Run native cargo check --package surrealdb
run: cargo check --no-default-features --package surrealdb
- name: Run Wasm cargo check --package surrealdb
run: cargo check --features protocol-ws,protocol-http,kv-mem --target wasm32-unknown-unknown --package surrealdb
- name: Check IndxDB
run: cargo check --no-default-features --features kv-indxdb --target wasm32-unknown-unknown --package surrealdb
- name: Run cargo check --workspace
run: cargo check --workspace