From 9c2d43dd39c049d22c1bd810b66c4f80892b2b39 Mon Sep 17 00:00:00 2001 From: tibvdm Date: Thu, 4 Apr 2024 01:02:15 +0200 Subject: [PATCH 01/13] add linting action --- .github/workflows/lint.yml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..11ca471 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,38 @@ +on: [ push, pull_request ] + +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 check + uses: actions-rs/cargo@v1 + with: + command: check + + - 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 + + \ No newline at end of file From e32f5603e118b703a554f00cd8d1061a4b59198a Mon Sep 17 00:00:00 2001 From: tibvdm Date: Thu, 4 Apr 2024 01:20:57 +0200 Subject: [PATCH 02/13] test action --- .github/workflows/lint.yml | 4 +--- .github/workflows/test.yml | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 11ca471..31eeda5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,4 @@ -on: [ push, pull_request ] +on: push name: Lint @@ -34,5 +34,3 @@ jobs: with: command: clippy args: -- -D warnings - - \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..15ad63e --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,37 @@ +on: push + +name: Test + +jobs: + test: + name: 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 test + uses: actions-rs/cargo@v1 + with: + command: test + args: --all-features --no-fail-fast + env: + 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/grcov@v0.1 + + - name: Upload coverage information + uses: codecov/codecov-action@v3 + with: + files: ${{ steps.cov.outputs.report }} + verbose: true From 8300286fde87302b2a1736ebef88547fdbde4a8c Mon Sep 17 00:00:00 2001 From: tibvdm Date: Thu, 4 Apr 2024 01:24:25 +0200 Subject: [PATCH 03/13] CARGO_INCREMENTAL=0 for gcov --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 15ad63e..57ab4b7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,6 +23,7 @@ jobs: 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' From 6f7973382ee989b1ad1c30b64e8c6c3f51dfbadd Mon Sep 17 00:00:00 2001 From: tibvdm Date: Thu, 4 Apr 2024 01:27:49 +0200 Subject: [PATCH 04/13] fix doctest --- fa-compression/src/decode.rs | 2 +- fa-compression/src/encode.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fa-compression/src/decode.rs b/fa-compression/src/decode.rs index 6c738e0..1568102 100644 --- a/fa-compression/src/decode.rs +++ b/fa-compression/src/decode.rs @@ -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); diff --git a/fa-compression/src/encode.rs b/fa-compression/src/encode.rs index 2b7bc12..9249b8c 100644 --- a/fa-compression/src/encode.rs +++ b/fa-compression/src/encode.rs @@ -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); From 5c58545a024f8ff2c1b8de21daa7805c0d111567 Mon Sep 17 00:00:00 2001 From: tibvdm Date: Thu, 4 Apr 2024 01:36:10 +0200 Subject: [PATCH 05/13] add coverage secret --- .github/workflows/test.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 57ab4b7..3cbbd23 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,8 +31,9 @@ jobs: id: coverage uses: actions-rs/grcov@v0.1 - - name: Upload coverage information - uses: codecov/codecov-action@v3 + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 with: - files: ${{ steps.cov.outputs.report }} - verbose: true + token: ${{ secrets.CODECOV_TOKEN }} + files: ${{ steps.coverage.outputs.report }} + slug: unipept/unipept-index From 3d609abb73cf7e4c5a11be4ff012d703f1ce9fd7 Mon Sep 17 00:00:00 2001 From: tibvdm Date: Thu, 4 Apr 2024 01:50:29 +0200 Subject: [PATCH 06/13] next try --- .github/workflows/test.yml | 4 ++-- grcov.yml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 grcov.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3cbbd23..53b9c15 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,12 +28,12 @@ jobs: 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/grcov@v0.1 - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4.0.1 with: token: ${{ secrets.CODECOV_TOKEN }} - files: ${{ steps.coverage.outputs.report }} slug: unipept/unipept-index + verbose: true + fail_ci_if_error: true diff --git a/grcov.yml b/grcov.yml new file mode 100644 index 0000000..2ef4c15 --- /dev/null +++ b/grcov.yml @@ -0,0 +1,2 @@ +output-type: lcov +output-file: ./lcov.info From 7f42438fdfae03281480a85b832df335c8a99a54 Mon Sep 17 00:00:00 2001 From: tibvdm Date: Thu, 4 Apr 2024 02:01:42 +0200 Subject: [PATCH 07/13] next try --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 53b9c15..2b658bf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,6 +28,7 @@ jobs: 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/grcov@v0.1 - name: Upload coverage reports to Codecov @@ -35,5 +36,6 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} slug: unipept/unipept-index + file: ${{ steps.coverage.outputs.report }} verbose: true fail_ci_if_error: true From e5ca7a8ca6279810ce1b4de4470d0358bcdf4c68 Mon Sep 17 00:00:00 2001 From: Tibo Vande Moortele <34175340+tibvdm@users.noreply.github.com> Date: Thu, 4 Apr 2024 02:06:51 +0200 Subject: [PATCH 08/13] Update test.yml --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2b658bf..9441a45 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,7 +35,6 @@ jobs: uses: codecov/codecov-action@v4.0.1 with: token: ${{ secrets.CODECOV_TOKEN }} - slug: unipept/unipept-index file: ${{ steps.coverage.outputs.report }} verbose: true fail_ci_if_error: true From 6a0fcca36d811604ed036f3e0683a1b61b7b8319 Mon Sep 17 00:00:00 2001 From: tibvdm Date: Thu, 4 Apr 2024 02:18:55 +0200 Subject: [PATCH 09/13] try again with config --- grcov.yml => .github/rs-actions/grcov.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename grcov.yml => .github/rs-actions/grcov.yml (100%) diff --git a/grcov.yml b/.github/rs-actions/grcov.yml similarity index 100% rename from grcov.yml rename to .github/rs-actions/grcov.yml From db52a1b6af68fd879655e312d3767277a1a7e2f3 Mon Sep 17 00:00:00 2001 From: tibvdm Date: Thu, 4 Apr 2024 02:26:02 +0200 Subject: [PATCH 10/13] fix folder name --- .github/{rs-actions => actions-rs}/grcov.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{rs-actions => actions-rs}/grcov.yml (100%) diff --git a/.github/rs-actions/grcov.yml b/.github/actions-rs/grcov.yml similarity index 100% rename from .github/rs-actions/grcov.yml rename to .github/actions-rs/grcov.yml From 33b77c7f75b80d296902f65769602b8d37a1bafc Mon Sep 17 00:00:00 2001 From: tibvdm Date: Thu, 4 Apr 2024 02:36:45 +0200 Subject: [PATCH 11/13] split tests and coverage --- .github/workflows/coverage.yml | 40 ++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 17 --------------- 2 files changed, 40 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..0cbc36d --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,40 @@ +on: push + +name: Coverage + +jobs: + coverage: + name: Coverage + 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/grcov@v0.1 + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ${{ steps.coverage.outputs.report }} + verbose: true + fail_ci_if_error: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9441a45..1fd9821 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,20 +21,3 @@ jobs: 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/grcov@v0.1 - - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4.0.1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ${{ steps.coverage.outputs.report }} - verbose: true - fail_ci_if_error: true From cb1c4f76ba8c1a56e752ae7d0e19e2a685535012 Mon Sep 17 00:00:00 2001 From: tibvdm Date: Thu, 4 Apr 2024 02:46:24 +0200 Subject: [PATCH 12/13] shuffle in workflows + panic tests --- .github/workflows/coverage.yml | 2 +- .github/workflows/lint.yml | 5 ----- .github/workflows/test.yml | 7 ++++++- fa-compression/src/lib.rs | 18 ++++++++++++++++++ 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 0cbc36d..a94936f 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -4,7 +4,7 @@ name: Coverage jobs: coverage: - name: Coverage + name: Codecov runs-on: ubuntu-latest steps: - name: Checkout repository diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 31eeda5..6df8ae4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,11 +18,6 @@ jobs: components: rustfmt, clippy override: true - - name: Run cargo check - uses: actions-rs/cargo@v1 - with: - command: check - - name: Run cargo fmt uses: actions-rs/cargo@v1 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1fd9821..35314fe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,7 @@ name: Test jobs: test: - name: Test + name: Check + test runs-on: ubuntu-latest steps: - name: Checkout repository @@ -17,6 +17,11 @@ jobs: 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: diff --git a/fa-compression/src/lib.rs b/fa-compression/src/lib.rs index 939f716..645756c 100644 --- a/fa-compression/src/lib.rs +++ b/fa-compression/src/lib.rs @@ -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); + } } From 1ed71e4af941cfe0ea2a7697176e08bfda61ef6f Mon Sep 17 00:00:00 2001 From: tibvdm Date: Thu, 4 Apr 2024 03:09:53 +0200 Subject: [PATCH 13/13] codecov config --- codecov.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 codecov.yml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..0489516 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,15 @@ +coverage: + status: + project: + default: + target: 90% #overall project/ repo coverage + fa-compression: + target: 95% + flags: + - fa-compression + +flags: + fa-compression: + paths: + - fa-compression/**/* + carryforward: false