From bbb04ed88de0a928ba3c759c63c2dcc16b547b7d Mon Sep 17 00:00:00 2001 From: Timon Vonk Date: Thu, 20 Jun 2024 21:48:03 +0200 Subject: [PATCH 1/5] feat(ci): add coveralls --- .github/workflows/coverage.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000..3e4119b2 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,21 @@ +name: CI + +on: [push, pull_request] + +jobs: + test: + name: coverage + runs-on: ubuntu-latest + container: + image: xd009642/tarpaulin:develop-nightly + options: --security-opt seccomp=unconfined + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Generate code coverage + run: | + cargo +nightly tarpaulin --verbose --all-features --workspace --timeout 120 --out xml + + - name: Coveralls + uses: coverallsapp/github-action@v2 From f8685763218c1e2ce922d589a5b7ee982200d029 Mon Sep 17 00:00:00 2001 From: Timon Vonk Date: Thu, 20 Jun 2024 21:51:13 +0200 Subject: [PATCH 2/5] docs: add coverage status to readme --- README.md | 1 + 1 file changed, 1 insertion(+) 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)
From fb1e328dcb14aa05d952890aeecd5d5e47464fca Mon Sep 17 00:00:00 2001 From: Timon Vonk Date: Thu, 20 Jun 2024 21:51:53 +0200 Subject: [PATCH 3/5] fix(ci): always run tests with all features --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aa6048f0..b79c3c10 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,4 +39,4 @@ jobs: - name: "Rustfmt" run: cargo fmt --all --check - name: "Test" - run: cargo test --verbose --workspace + run: cargo test --verbose --workspace --all-features From a52a898537095e3186d6927c592b5ab2e82de214 Mon Sep 17 00:00:00 2001 From: Timon Vonk Date: Thu, 20 Jun 2024 22:07:17 +0200 Subject: [PATCH 4/5] fix(ci): small fixes and improvements --- .github/workflows/coverage.yml | 16 ++++++++++++++-- .github/workflows/test.yml | 6 +++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 3e4119b2..ce204069 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,17 +1,29 @@ name: CI -on: [push, pull_request] +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 container: image: xd009642/tarpaulin:develop-nightly options: --security-opt seccomp=unconfined steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Generate code coverage run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b79c3c10..d3f35dbd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,11 +28,11 @@ 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 From b359faac502c0f368acf320de2d8c9c235cca513 Mon Sep 17 00:00:00 2001 From: Timon Vonk Date: Thu, 20 Jun 2024 23:27:03 +0200 Subject: [PATCH 5/5] fix(ci): overwrite qdrant url in coverage ci --- .github/workflows/coverage.yml | 1 + swiftide/tests/ingestion_pipeline.rs | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index ce204069..52fd102d 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -18,6 +18,7 @@ jobs: env: RUST_LOG: DEBUG RUST_BACKTRACE: 1 + QDRANT_URL: http://qdrant:6334 container: image: xd009642/tarpaulin:develop-nightly options: --security-opt seccomp=unconfined 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 {