Skip to content

Commit

Permalink
add makefile
Browse files Browse the repository at this point in the history
Signed-off-by: tabokie <[email protected]>
  • Loading branch information
tabokie committed Aug 2, 2022
1 parent 7ab1af2 commit 3faee0e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ jobs:
- name: Clippy
run: make clippy
- name: Run tests
run: make test_nightly
run: make test
env:
RUST_BACKTRACE: 1
EXTRA_CARGO_ARGS: '--verbose'
- name: Run asan tests
if: ${{ matrix.os == 'ubuntu-latest' }}
run: make test_nightly
run: make test
env:
RUST_BACKTRACE: 1
RUSTFLAGS: '-Zsanitizer=address'
Expand All @@ -68,11 +68,14 @@ jobs:
sharedKey: ${{ matrix.os }}-stable
- name: Clippy
run: make clippy
env:
WITH_STABLE_TOOLCHAIN: 'true'
- name: Run tests
run: make test
env:
RUST_BACKTRACE: 1
EXTRA_CARGO_ARGS: '--verbose'
WITH_STABLE_TOOLCHAIN: 'true'
coverage:
runs-on: ubuntu-latest
needs: nightly
Expand All @@ -95,7 +98,7 @@ jobs:
- name: Run tests
run: |
make test
make test_nightly
env WITH_STABLE_TOOLCHAIN=true make test
env:
RUSTFLAGS: '-Zinstrument-coverage'
LLVM_PROFILE_FILE: '%p-%m.profraw'
Expand Down
34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Makefile

## Additionaly arguments passed to cargo.
EXTRA_CARGO_ARGS ?=
## Whether to disable nightly-only feature. [true/false]
WITH_STABLE_TOOLCHAIN ?=

.PHONY: format clippy test

all: format clippy test

## Format code in-place using rustfmt.
format:
cargo fmt --all

## Run clippy.
ifeq ($(WITH_STABLE_TOOLCHAIN), true)
clippy:
cargo clippy --all --features all_stable --all-targets -- -D clippy::all
else
clippy:
cargo clippy --all --all-features --all-targets -- -D clippy::all
endif

## Run tests.
ifeq ($(WITH_STABLE_TOOLCHAIN), true)
test:
cargo test --all --features all_stable_except_failpoints ${EXTRA_CARGO_ARGS} -- --nocapture
cargo test --test failpoints --features all_stable ${EXTRA_CARGO_ARGS} -- --test-threads 1 --nocapture
else
test:
cargo test --all --features all_except_failpoints ${EXTRA_CARGO_ARGS} -- --nocapture
cargo test --test failpoints --all-features ${EXTRA_CARGO_ARGS} -- --test-threads 1 --nocapture
endif
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ Contributions are always welcome! Here are a few tips for making a PR:
```
# rustup default nightly
make
# rustup default stable
env WITH_STABLE_TOOLCHAIN=true make
# filter a specific test case
env EXTRA_CARGO_ARGS=<testname> make test_nightly
env EXTRA_CARGO_ARGS=<testname> make test
```

- For changes that might induce performance effects, please quote the targeted benchmark results in the PR description. In addition to micro-benchmarks, there is a standalone [stress test tool](https://github.com/tikv/raft-engine/tree/master/stress) which you can use to demonstrate the system performance.
Expand Down

0 comments on commit 3faee0e

Please sign in to comment.