Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github actions #14

Merged
merged 12 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/actions-rs/grcov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
output-type: lcov
output-file: ./lcov.info
40 changes: 40 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
on: push

name: Coverage

jobs:
coverage:
name: Codecov
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install minimal nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true

- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --no-fail-fast
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'

- name: Gather coverage information
id: coverage
uses: actions-rs/[email protected]

- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ${{ steps.coverage.outputs.report }}
verbose: true
fail_ci_if_error: true
31 changes: 31 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on: push

name: Lint

jobs:
lint:
name: Clippy + rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install minimal nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
components: rustfmt, clippy
override: true

- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on: push

name: Test

jobs:
test:
name: Check + test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install minimal nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true

- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check

- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
2 changes: 1 addition & 1 deletion fa-compression/src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static PREFIXES: [&str; 3] = ["EC:", "GO:", "IPR:IPR"];
/// # Examples
///
/// ```
/// use fa_compression::decode::decode;
/// use fa_compression::decode;
///
/// let input = &[ 44, 44, 44, 189, 17, 26, 56, 173, 18, 116, 117, 225, 67, 116, 110, 17, 153, 39 ];
/// let result = decode(input);
Expand Down
2 changes: 1 addition & 1 deletion fa-compression/src/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{
/// # Examples
///
/// ```
/// use fa_compression::encode::encode;
/// use fa_compression::encode;
///
/// let input = "IPR:IPR016364;EC:1.1.1.-;GO:0009279";
/// let encoded = encode(input);
Expand Down
18 changes: 18 additions & 0 deletions fa-compression/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,22 @@ mod tests {
}
}
}

#[test]
#[should_panic]
fn test_encode_invalid() {
CharacterSet::encode(b'A');
}

#[test]
#[should_panic]
fn test_decode_invalid() {
CharacterSet::decode(15);
}

#[test]
#[should_panic]
fn test_decode_pair_invalid() {
CharacterSet::decode_pair(0b11111111);
}
}
Loading