From 9b679fda443939777db518e015d832f6d5f5d890 Mon Sep 17 00:00:00 2001 From: Carter Himmel Date: Mon, 4 Sep 2023 15:16:51 -0600 Subject: [PATCH] chore: example test workflow --- .github/workflows/example.yml | 47 +++++++++++++++++++++++++++++++++++ docker-compose.yml | 1 + example/src/main.rs | 1 + 3 files changed, 49 insertions(+) create mode 100644 .github/workflows/example.yml diff --git a/.github/workflows/example.yml b/.github/workflows/example.yml new file mode 100644 index 0000000..8aa15ca --- /dev/null +++ b/.github/workflows/example.yml @@ -0,0 +1,47 @@ +name: Test The Example + +on: + push: + pull_request: + +concurrency: + cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + +jobs: + run: + name: Run + runs-on: ubuntu-latest + services: + scylla: + image: scylladb/scylla:5.1 + volumes: + - ./init.cql:/init.cql + ports: + - 9042:9042 + options: >- + --health-cmd "[ $$(nodetool statusgossip) = running ]" + --health-interval 5s + --health-timeout 10s + --health-retries 10 + + steps: + - uses: actions/checkout@v3 + + - name: Cache Cargo + uses: Swatinem/rust-cache@v1 + + - uses: r7kamura/rust-problem-matchers@v1 + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + + - name: Apply init.cql + run: cqlsh scylla -f /init.cql + + - name: Run Example + env: + RUST_LOG: debug + SCYLLA_NODES: scylla:9042 + SCYLLA_DEFAULT_KEYSPACE: scyllax + run: cargo run --release -p scyllax-example diff --git a/docker-compose.yml b/docker-compose.yml index 7b51483..6dd2f1e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,7 @@ services: image: scylladb/scylla:latest volumes: - scylla_storage:/var/lib/scylla + - ./init.cql:/init.cql command: - --smp 1 ports: diff --git a/example/src/main.rs b/example/src/main.rs index c91b776..b54f87a 100644 --- a/example/src/main.rs +++ b/example/src/main.rs @@ -18,6 +18,7 @@ async fn main() -> anyhow::Result<()> { let known_nodes = std::env::var("SCYLLA_NODES").unwrap_or_else(|_| String::new()); let known_nodes = known_nodes.split(',').collect::>(); let default_keyspace = std::env::var("SCYLLA_DEFAULT_KEYSPACE").ok(); + let session = create_session(known_nodes, default_keyspace).await?; let executor = Executor::with_session(session);