Skip to content

Commit

Permalink
ci(github-actions): add new workflow coverage: format, clippy and cov…
Browse files Browse the repository at this point in the history
…erage
  • Loading branch information
bioinformatist committed Jul 15, 2023
1 parent 6352e6d commit 39378cc
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 6 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Coveralls

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize]

jobs:
coverage:
runs-on: ubuntu-latest

services:
tdengine:
image: tdengine/tdengine:3.0.7.1
ports:
- 6030:6030

steps:
- uses: actions/checkout@v3

- name: Install taosc
run: |
curl -sO https://www.taosdata.com/assets-download/3.0/TDengine-client-3.0.7.1-Linux-x64-Lite.tar.gz
tar zxf TDengine-client-3.0.7.1-Linux-x64-Lite.tar.gz
cd TDengine-client-3.0.7.1
./install_client.sh
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt, clippy

- name: Check format
run: cargo fmt --check --all

- name: Check clippy
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Install Cargo B(inary)Install
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash

- uses: taiki-e/install-action@cargo-tarpaulin

- name: Coverage
run: cargo +nightly tarpaulin --follow-exec --post-test-delay 10 --coveralls ${{ secrets.COVERALLS_REPO_TOKEN }} -- --test-threads=1
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ members = [
"cml-core",
"cml-tdengine",
]
resolver = "2"

[workspace.dependencies]
anyhow = "1"
Expand Down
7 changes: 2 additions & 5 deletions cml-core/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ pub struct MetaData<F> {
impl<F> MetaData<F> {
pub fn get_placeholders(&self) -> (String, String) {
(
vec![
"?";
self.optional_tags.as_ref().map_or(0, |v| v.len()) + self.inherent_tag_num
]
.join(", "),
vec!["?"; self.optional_tags.as_ref().map_or(0, |v| v.len()) + self.inherent_tag_num]
.join(", "),
vec!["?"; self.optional_field_num + self.inherent_field_num].join(", "),
)
}
Expand Down
2 changes: 1 addition & 1 deletion cml-tdengine/src/models/stables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl<'a> STable<'a> {
fn field_to_stmt(fields: &[Field]) -> String {
fields
.iter()
.map(|f| format!("{}", f.sql_repr()))
.map(|f| f.sql_repr().to_string())
.collect::<Vec<String>>()
.join(",")
}
Expand Down

0 comments on commit 39378cc

Please sign in to comment.