-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8cdf673
Showing
6 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Main | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
actions: write | ||
contents: read | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest-16-cores | ||
|
||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/[email protected] | ||
|
||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
|
||
- name: Install cargo-llvm-cov | ||
uses: taiki-e/install-action@cargo-llvm-cov | ||
|
||
- name: cargo build | ||
run: cargo build --workspace --verbose | ||
|
||
- name: cargo test | ||
run: cargo llvm-cov --all-features --workspace --lcov --output-path target/lcov.info | ||
|
||
- name: Download and install qlty CLI | ||
run: curl -fsSL https://tinyurl.com/qlty-beta-install | bash | ||
|
||
- name: qlty init | ||
run: ~/.qlty/bin/qlty init --no | ||
|
||
- name: Upload coverage to qlty | ||
run: PROJECT_ID=e02159bf-9c4b-411f-afe2-d824ee3ff475 ~/.qlty/bin/qlty coverage ./target/lcov.info --verbose --upload --tag rust-example-coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[package] | ||
name = "rust_example" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Qlty Rust coverage setup example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
fn add(a: i32, b: i32) -> i32 { | ||
a + b | ||
} | ||
|
||
fn subtract(a: i32, b: i32) -> i32 { | ||
a - b | ||
} | ||
|
||
fn multiply(a: i32, b: i32) -> i32 { | ||
a * b | ||
} | ||
|
||
fn main() { | ||
println!("Hello, world!"); | ||
|
||
println!("3 + 2 = {}", add(3, 2)); | ||
println!("5 - 3 = {}", subtract(5, 3)); | ||
println!("4 * 3 = {}", multiply(4, 3)); | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn test_add() { | ||
assert_eq!(add(2, 2), 4); | ||
} | ||
|
||
#[test] | ||
fn test_subtract() { | ||
assert_eq!(subtract(5, 3), 2); | ||
} | ||
} |