-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from mojoX911/github-action
Added CI and Code Coverage toolings
- Loading branch information
Showing
5 changed files
with
117 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 @@ | ||
on: [push, pull_request] | ||
|
||
name: Continuous Integration | ||
|
||
jobs: | ||
|
||
build_and_test: | ||
name: Build and Test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
rust: | ||
- stable | ||
- nightly | ||
features: | ||
- default | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
- name: Generate cache key | ||
run: echo "${{ matrix.rust }} ${{ matrix.features }}" | tee .cache_key | ||
- name: cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
target | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} | ||
- name: Set default toolchain | ||
run: rustup default ${{ matrix.rust }} | ||
- name: Set profile | ||
run: rustup set profile minimal | ||
- name: Add clippy | ||
run: rustup component add clippy | ||
- name: Update toolchain | ||
run: rustup update | ||
- name: Build | ||
run: cargo build --features ${{ matrix.features }} --no-default-features | ||
# Uncomment clippy check after failures are removed | ||
# - name: Clippy | ||
# run: cargo clippy --all-targets --features ${{ matrix.features }} --no-default-features -- -D warnings | ||
- name: Test | ||
run: cargo test --features ${{ matrix.features }} --no-default-features |
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,32 @@ | ||
on: [push, pull_request] | ||
|
||
name: Code Coverage | ||
|
||
jobs: | ||
Code-coverage: | ||
name: Code coverage report | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set default toolchain | ||
run: rustup default nightly | ||
- name: Set profile | ||
run: rustup set profile minimal | ||
|
||
- name: Run cargo test | ||
env: | ||
CARGO_INCREMENTAL: '0' | ||
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off' | ||
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off' | ||
run: cargo test | ||
- id: coverage | ||
name: Generate coverage | ||
uses: actions-rs/[email protected] | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
file: ${{ steps.coverage.outputs.report }} | ||
directory: ./coverage/reports/ |
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,23 @@ | ||
|
||
on: [push, pull_request] | ||
|
||
name: Lint Checking | ||
|
||
jobs: | ||
|
||
fmt: | ||
name: Rust fmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set default toolchain | ||
run: rustup default stable | ||
- name: Set profile | ||
run: rustup set profile minimal | ||
- name: Add rustfmt | ||
run: rustup component add rustfmt | ||
- name: Update toolchain | ||
run: rustup update | ||
- name: Check fmt | ||
run: cargo fmt --all -- --check |
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
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,13 @@ | ||
coverage: | ||
status: | ||
project: | ||
default: | ||
target: auto | ||
threshold: 1% | ||
base: auto | ||
informational: false | ||
patch: | ||
default: | ||
target: auto | ||
threshold: 100% | ||
base: auto |