diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000..52fd102d --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,34 @@ +name: CI + +on: + pull_request: + push: + branches: + - master + +jobs: + test: + name: coverage + runs-on: ubuntu-latest + services: + qdrant: + image: qdrant/qdrant:v1.9.2 + ports: + - 6334:6334 + env: + RUST_LOG: DEBUG + RUST_BACKTRACE: 1 + QDRANT_URL: http://qdrant:6334 + container: + image: xd009642/tarpaulin:develop-nightly + options: --security-opt seccomp=unconfined + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Generate code coverage + run: | + cargo +nightly tarpaulin --verbose --all-features --workspace --timeout 120 --out xml + + - name: Coveralls + uses: coverallsapp/github-action@v2 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aa6048f0..d3f35dbd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,15 +28,15 @@ jobs: RUST_BACKTRACE: 1 steps: - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy,rustfmt - run: rustup toolchain install stable --component clippy --component rustfmt --profile minimal - uses: Swatinem/rust-cache@v2 - with: - workspaces: | - fluyt - uses: r7kamura/rust-problem-matchers@v1 - name: "Clippy" run: cargo clippy - name: "Rustfmt" run: cargo fmt --all --check - name: "Test" - run: cargo test --verbose --workspace + run: cargo test --verbose --workspace --all-features diff --git a/README.md b/README.md index a1740c84..31859115 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ [![Issues][issues-shield]][issues-url] [![MIT License][license-shield]][license-url] [![LinkedIn][linkedin-shield]][linkedin-url] +[![Coverage Status](https://coveralls.io/repos/github/bosun-ai/swiftide/badge.svg)](https://coveralls.io/github/bosun-ai/swiftide)
diff --git a/swiftide/tests/ingestion_pipeline.rs b/swiftide/tests/ingestion_pipeline.rs index b57d867b..9be0c2f2 100644 --- a/swiftide/tests/ingestion_pipeline.rs +++ b/swiftide/tests/ingestion_pipeline.rs @@ -124,10 +124,10 @@ async fn test_ingestion_pipeline() { // host = qdrant.get_host().await.unwrap(), // port = qdrant.get_host_port_ipv4(6334).await.unwrap() // ); - let qdrant_url = "http://localhost:6334"; + let qdrant_url = std::env::var("QDRANT_URL").unwrap_or("http://localhost:6334".to_string()); // Cleanup the collection before running the pipeline - let qdrant = QdrantClient::from_url(qdrant_url).build().unwrap(); + let qdrant = QdrantClient::from_url(&qdrant_url).build().unwrap(); let _ = qdrant.delete_collection("swiftide-test").await; let result = @@ -139,7 +139,7 @@ async fn test_ingestion_pipeline() { ) .then_in_batch(1, transformers::OpenAIEmbed::new(openai_client.clone())) .then_store_with( - integrations::qdrant::Qdrant::try_from_url(qdrant_url) + integrations::qdrant::Qdrant::try_from_url(&qdrant_url) .unwrap() .vector_size(1536) .collection_name("swiftide-test".to_string()) @@ -174,7 +174,7 @@ async fn test_ingestion_pipeline() { }; use qdrant_client::prelude::*; - let search_result = qdrant_client::client::QdrantClient::from_url(qdrant_url) + let search_result = qdrant_client::client::QdrantClient::from_url(&qdrant_url) .build() .unwrap() .search_points(&SearchPoints {