diff --git a/.editorconfig b/.editorconfig
index 86a14cae5..033f8a6da 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -6,3 +6,6 @@ indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
+
+[*.yml]
+indent_size = 2
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index ab13eb023..38806ce4e 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -1,30 +1,160 @@
-name: tests
+name: aquadoggo
on: push
env:
CARGO_TERM_COLOR: always
+ cache_path: |
+ target
+ ~/.cargo
+ cargo_manifest: aquadoggo/Cargo.toml
jobs:
- test:
- name: build and test
-
+ rust-test-sqlite:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Setup Rust toolchain
+ uses: actions-rs/toolchain@v1
+ with:
+ profile: minimal
+ toolchain: stable
+ override: true
- - name: Cargo caching
- uses: actions/cache@v2
+ - name: Restore from cargo cache
+ uses: actions/cache@v3
with:
- path: |
- ~/.cargo/registry
- ~/.cargo/git
- target
- key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
+ path: ${{ env.cache_path }}
+ key: ${{ runner.os }}-test-${{ hashFiles('**/Cargo.lock') }}
- - name: Build
- run: cargo build --verbose
+ - name: Build binary
+ uses: actions-rs/cargo@v1
+ with:
+ command: build
+ args: >-
+ --verbose
+ --manifest-path ${{ env.cargo_manifest }}
- name: Run tests
- run: cargo test --verbose
+ uses: actions-rs/cargo@v1
+ with:
+ command: test
+ args: --manifest-path ${{ env.cargo_manifest }}
+ # Ensure debug output is also tested
+ env:
+ RUST_LOG: debug
+
+ rust-check:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Setup Rust toolchain
+ uses: actions-rs/toolchain@v1
+ with:
+ profile: minimal
+ toolchain: stable
+ override: true
+
+ - name: Restore from cargo cache
+ uses: actions/cache@v3
+ with:
+ path: ${{ env.cache_path }}
+ key: ${{ runner.os }}-check-${{ hashFiles('**/Cargo.lock') }}
+
+ - name: Check project and dependencies
+ uses: actions-rs/cargo@v1
+ with:
+ command: check
+ args: --manifest-path ${{ env.cargo_manifest }}
+
+ rust-fmt:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Setup Rust toolchain
+ uses: actions-rs/toolchain@v1
+ with:
+ profile: minimal
+ toolchain: stable
+ components: rustfmt
+ override: true
+
+ - name: Restore from cargo cache
+ uses: actions/cache@v3
+ with:
+ path: ${{ env.cache_path }}
+ key: ${{ runner.os }}-fmt-${{ hashFiles('**/Cargo.lock') }}
+
+ - name: Check formatting
+ uses: actions-rs/cargo@v1
+ with:
+ command: fmt
+ args: --manifest-path ${{ env.cargo_manifest }} -- --check
+
+ rust-clippy:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Setup Rust toolchain
+ uses: actions-rs/toolchain@v1
+ with:
+ profile: minimal
+ toolchain: stable
+ components: clippy
+ override: true
+
+ - name: Restore from cargo cache
+ uses: actions/cache@v3
+ with:
+ path: ${{ env.cache_path }}
+ key: ${{ runner.os }}-clippy-${{ hashFiles('**/Cargo.lock') }}
+
+ - name: Check code with clippy
+ uses: actions-rs/cargo@v1
+ with:
+ command: clippy
+ args: --manifest-path ${{ env.cargo_manifest }} -- -D warnings --no-deps
+
+ rust-coverage:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Setup Rust toolchain
+ uses: actions-rs/toolchain@v1
+ with:
+ profile: minimal
+ toolchain: stable
+ override: true
+
+ - name: Restore from cargo cache
+ uses: actions/cache@v3
+ with:
+ path: ${{ env.cache_path }}
+ key: ${{ runner.os }}-tarpaulin-${{ hashFiles('**/Cargo.lock') }}
+
+ - name: Run cargo-tarpaulin
+ uses: actions-rs/tarpaulin@v0.1
+ with:
+ # Force cleaning via `--force-clean` flag to prevent buggy code coverage
+ args: --manifest-path ${{ env.cargo_manifest }} --locked --force-clean
+ # Ensure debug output is also tested
+ env:
+ RUST_LOG: debug
+
+ - name: Upload to codecov.io
+ uses: codecov/codecov-action@v2
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 21c7fd052..7b98249e8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Move to `tokio` async runtime [#75](https://github.com/p2panda/aquadoggo/pull/75)
+- Improve CI, track test coverage [#139](https://github.com/p2panda/aquadoggo/pull/139)
## [0.2.0]
diff --git a/README.md b/README.md
index ba4c721e2..180e94fad 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,10 @@
+
+
+
+
diff --git a/aquadoggo/src/db/models/entry.rs b/aquadoggo/src/db/models/entry.rs
index 06db6bd89..d0199f301 100644
--- a/aquadoggo/src/db/models/entry.rs
+++ b/aquadoggo/src/db/models/entry.rs
@@ -85,6 +85,7 @@ pub struct Entry {
}
impl Entry {
+ #[allow(clippy::too_many_arguments)]
pub async fn insert(
pool: &Pool,
author: &Author,
diff --git a/aquadoggo/src/db/models/log.rs b/aquadoggo/src/db/models/log.rs
index 71ce8f6d0..907bfbdad 100644
--- a/aquadoggo/src/db/models/log.rs
+++ b/aquadoggo/src/db/models/log.rs
@@ -16,6 +16,7 @@ use crate::errors::Result;
/// We store the u64 integer values of `log_id` as a string here since not all database backends
/// support large numbers.
#[derive(FromRow, Debug)]
+#[allow(dead_code)]
pub struct Log {
/// Public key of the author.
author: String,
diff --git a/aquadoggo/src/worker.rs b/aquadoggo/src/worker.rs
index 352a087de..f450a1381 100644
--- a/aquadoggo/src/worker.rs
+++ b/aquadoggo/src/worker.rs
@@ -94,6 +94,7 @@ pub struct Task(WorkerName, IN);
impl Task {
/// Returns a new task.
+ #[allow(dead_code)]
pub fn new(worker_name: &str, input: IN) -> Self {
Self(worker_name.into(), input)
}
@@ -107,9 +108,11 @@ pub type TaskResult = Result