Skip to content

Commit

Permalink
chore(ci): code coverage reporting (#58)
Browse files Browse the repository at this point in the history
Post test coverage to Coveralls

Also enabled --all-features when running tests in ci, just to be sure
  • Loading branch information
timonv authored Jun 20, 2024
1 parent f4341ba commit 7dde8a0
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 8 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

<!-- PROJECT LOGO -->
<br />
Expand Down
8 changes: 4 additions & 4 deletions swiftide/tests/ingestion_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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())
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 7dde8a0

Please sign in to comment.