Skip to content

Commit

Permalink
Optimise ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
rushmorem committed Apr 12, 2023
1 parent 6d2f325 commit 73a55f9
Show file tree
Hide file tree
Showing 4 changed files with 302 additions and 170 deletions.
163 changes: 148 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,86 @@ defaults:

jobs:

format:
name: Format
runs-on: ubuntu-20.04
steps:

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

- name: Checkout sources
uses: actions/checkout@v3

- name: Run cargo fmt
run: cargo fmt --all -- --check

check:
name: Check workspace
runs-on: ubuntu-20.04
steps:

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable

- name: Checkout sources
uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install protobuf-compiler libprotobuf-dev
- name: Run cargo check
run: cargo check --locked --workspace

check-wasm:
name: Check Wasm
runs-on: ubuntu-20.04
steps:

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown

- name: Checkout sources
uses: actions/checkout@v3

- name: Run cargo check
run: cargo check --locked --package surrealdb --features protocol-ws,protocol-http,kv-mem,kv-indxdb --target wasm32-unknown-unknown

clippy:
name: Clippy
runs-on: ubuntu-20.04
steps:

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy

- name: Checkout sources
uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install protobuf-compiler libprotobuf-dev
- name: Run cargo clippy
run: cargo clippy --no-deps -- -W warnings

test:
name: Test
name: Test workspace
runs-on: ubuntu-20.04
steps:

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable

- name: Checkout sources
uses: actions/checkout@v3

Expand All @@ -26,20 +102,39 @@ jobs:
sudo apt-get -y update
sudo apt-get -y install protobuf-compiler libprotobuf-dev
- name: Run cargo test
run: cargo test --locked --no-default-features --features storage-mem --workspace -- --skip api_integration

ws-engine:
name: WebSocket engine
runs-on: ubuntu-20.04
steps:

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable

- name: Checkout sources
uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install protobuf-compiler libprotobuf-dev
- name: Run cargo test
run: |
cargo build --locked --no-default-features --features storage-mem
(&>/dev/null ./target/debug/surreal start --log trace --user root --pass root memory &)
cargo test --locked --workspace --features protocol-ws,protocol-http,kv-rocksdb
cargo test --locked --package surrealdb --no-default-features --features protocol-ws --test api api_integration::ws
lint:
name: Lint
http-engine:
name: HTTP engine
runs-on: ubuntu-20.04
steps:

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable

- name: Checkout sources
uses: actions/checkout@v3

Expand All @@ -48,20 +143,58 @@ jobs:
sudo apt-get -y update
sudo apt-get -y install protobuf-compiler libprotobuf-dev
- name: Run cargo test
run: |
cargo build --locked --no-default-features --features storage-mem
(&>/dev/null ./target/debug/surreal start --log trace --user root --pass root memory &)
cargo test --locked --package surrealdb --no-default-features --features protocol-http --test api api_integration::http
mem-engine:
name: Memory engine
runs-on: ubuntu-20.04
steps:

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
components: rustfmt, clippy

- name: Run cargo check
run: cargo check --workspace
- name: Checkout sources
uses: actions/checkout@v3

- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Run cargo test
run: cargo test --locked --package surrealdb --no-default-features --features kv-mem --test api api_integration::mem

- name: Run cargo clippy
run: cargo clippy -- -W warnings
file-engine:
name: File engine
runs-on: ubuntu-20.04
steps:

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable

- name: Checkout sources
uses: actions/checkout@v3

- name: Run cargo test
run: cargo test --locked --package surrealdb --no-default-features --features kv-rocksdb --test api api_integration::file

any-engine:
name: Any engine
runs-on: ubuntu-20.04
steps:

- name: Run WebAssembly check
run: cargo check --features kv-mem,kv-indxdb,protocol-ws,protocol-http --target wasm32-unknown-unknown --package surrealdb
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable

- name: Checkout sources
uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install protobuf-compiler libprotobuf-dev
- name: Run cargo test
run: |
cargo build --locked --no-default-features --features storage-mem
(&>/dev/null ./target/debug/surreal start --log trace --user root --pass root memory &)
cargo test --locked --package surrealdb --no-default-features --features protocol-http --test api api_integration::any
4 changes: 1 addition & 3 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Nix

on:
- pull_request
- push
on: push

# Setting the shell option, it will run 'bash --noprofile --norc -eo pipefail {0}'
defaults:
Expand Down
4 changes: 2 additions & 2 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ resolver = "2"
default = ["protocol-ws", "rustls"]
protocol-http = ["dep:reqwest", "dep:tokio-util"]
protocol-ws = ["dep:tokio-tungstenite", "dep:tokio-stream", "tokio/time"]
kv-mem = ["dep:echodb"]
kv-mem = ["dep:echodb", "tokio/time"]
kv-indxdb = ["dep:indxdb"]
kv-rocksdb = ["dep:rocksdb"]
kv-rocksdb = ["dep:rocksdb", "tokio/time"]
kv-tikv = ["dep:tikv"]
kv-fdb-5_1 = ["foundationdb/fdb-5_1", "kv-fdb"]
kv-fdb-5_2 = ["foundationdb/fdb-5_2", "kv-fdb"]
Expand Down

0 comments on commit 73a55f9

Please sign in to comment.