Skip to content

Commit

Permalink
Added pipeline files for repo
Browse files Browse the repository at this point in the history
Added three different pipeline files:
    Cargo clippy and fmt workflow
    Cargo check and test workflow
    And full on tests with coverage and upload to codecov.
  • Loading branch information
junniest committed Nov 16, 2023
1 parent 03b8c9f commit c06b32d
Show file tree
Hide file tree
Showing 3 changed files with 190 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: rustfmt and clippy with annotations

on:
push:
branches:
- "**"
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
fmt_lib:
name: rustfmt on parsimony lib
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1.0.6
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path ./parsimony/Cargo.toml --all -- --check

clippy_check_lib:
name: clippy on parsimony lib
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup component add clippy
- uses: actions-rs/clippy-check@v1.0.7
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path ./parsimony/Cargo.toml --all-features -- -D warnings

fmt_bin:
name: rustfmt on indelMaP bin
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1.0.6
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path ./indelMaP/Cargo.toml --all -- --check

clippy_check_bin:
name: clippy on indelMaP bin
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup component add clippy
- uses: actions-rs/clippy-check@v1.0.7
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path ./indelMaP/Cargo.toml --all-features -- -D warnings
40 changes: 40 additions & 0 deletions .github/workflows/test_coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: library tests with coverage

on:
pull_request:
branches: [ "main" ]
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
test:
name: tests with coverage
runs-on: ubuntu-latest
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: -Cinstrument-coverage -Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort
RUSTDOCFLAGS: -Cinstrument-coverage -Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1.0.6
with:
toolchain: nightly
override: true
- name: Generate test results and coverage report
run: |
cargo install cargo2junit grcov;
rustup component add llvm-tools-preview;
cargo test --manifest-path ./parsimony/Cargo.toml -- -Z unstable-options --format json | cargo2junit > results.xml;
grcov . -s . --binary-path ./parsimony/target/debug/deps -t lcov --branch --ignore "**/*tests.rs" -o lcov.info;
- name: publish test results to github
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
files: results.xml
- name: upload coverage report to Codecov
uses: codecov/codecov-action@v3
with:
files: lcov.info
85 changes: 85 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: tests on stable

on:
push:
branches:
- "**"
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
check_lib:
name: cargo check lib
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1.0.6
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
args: --manifest-path ./parsimony/Cargo.toml

test_lib:
name: cargo test lib
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1.0.6
with:
toolchain: nightly
override: true
- name: install cargo2junit
run: |
cargo install cargo2junit
- name: tests with cargo2junit
run: |
cargo test --manifest-path ./parsimony/Cargo.toml -- -Z unstable-options --format json --report-time | cargo2junit > results.xml
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
files: results.xml

check_bin:
name: cargo check bin
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1.0.6
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
args: --manifest-path ./indelMaP/Cargo.toml

test_bin:
name: cargo test bin
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1.0.6
with:
toolchain: nightly
override: true
- name: install cargo2junit
run: |
cargo install cargo2junit
- name: tests with cargo2junit
run: |
cargo test --manifest-path ./indelMaP/Cargo.toml -- -Z unstable-options --format json --report-time | cargo2junit > results.xml
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
files: results.xml

0 comments on commit c06b32d

Please sign in to comment.