CI: Use Rust cache #2594
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
name: Rust | |
on: | |
push: | |
branches: | |
- main | |
- 'branch-*' | |
pull_request: | |
branches: | |
- main | |
- 'branch-*' | |
env: | |
CARGO_TERM_COLOR: always | |
RUSTFLAGS: -Dwarnings | |
RUST_BACKTRACE: full | |
rust_min: 1.66.0 # <- Update this when bumping up MSRV | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup 3-node Scylla cluster | |
run: | | |
sudo sh -c "echo 2097152 >> /proc/sys/fs/aio-max-nr" | |
docker compose -f test/cluster/docker-compose.yml up -d --wait | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
- uses: Swatinem/rust-cache@v2 | |
- name: Format check | |
run: cargo fmt --verbose --all -- --check | |
- name: Clippy check | |
run: cargo clippy --verbose --all-targets -- -Aclippy::uninlined_format_args | |
- name: Cargo check without features | |
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features "" | |
- name: Cargo check with all serialization features | |
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features "full-serialization" | |
- name: Cargo check with secret feature | |
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features "secret" | |
- name: Cargo check with chrono feature | |
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features "chrono" | |
- name: Cargo check with time feature | |
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features "time" | |
- name: Build scylla-cql | |
run: cargo build --verbose --all-targets --manifest-path "scylla-cql/Cargo.toml" --features "full-serialization" | |
- name: Build | |
run: cargo build --verbose --all-targets --features "full-serialization" | |
- name: Run tests | |
run: SCYLLA_URI=172.42.0.2:9042 SCYLLA_URI2=172.42.0.3:9042 SCYLLA_URI3=172.42.0.4:9042 cargo test --verbose --features "full-serialization" | |
- name: Stop the cluster | |
if: ${{ always() }} | |
run: docker compose -f test/cluster/docker-compose.yml stop | |
- name: Print the cluster logs | |
if: ${{ always() }} | |
run: docker compose -f test/cluster/docker-compose.yml logs | |
- name: Remove cluster | |
run: docker compose -f test/cluster/docker-compose.yml down | |
# Tests that our current minimum supported rust version compiles everything sucessfully | |
min_rust: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust ${{ env.rust_min }} | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.rust_min }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: Print Rust version | |
run: rustc --version | |
- name: Use MSRV Cargo.lock | |
run: mv Cargo.lock.msrv Cargo.lock | |
- name: MSRV cargo check with features | |
run: cargo check --verbose --all-targets --all-features --locked | |
- name: MSRV cargo check without features | |
run: cargo check --verbose --all-targets --locked --manifest-path "scylla/Cargo.toml" | |
- name: MSRV cargo check scylla-cql | |
run: cargo check --verbose --all-targets --locked --manifest-path "scylla-cql/Cargo.toml" | |
# Tests that docstrings generate docs without warnings | |
cargo_docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
- uses: Swatinem/rust-cache@v2 | |
- name: Compile docs | |
run: RUSTDOCFLAGS=-Dwarnings cargo doc |