diff options
-rw-r--r-- | .github/workflows/tests.yml | 13 | ||||
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | ci/Makefile | 19 |
3 files changed, 35 insertions, 5 deletions
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1c025c0..bdd74ed 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,16 +16,19 @@ jobs: - uses: actions/checkout@v2 - name: Build - run: cargo build --verbose + run: make -C ci build - name: Build examples - run: cargo build --verbose --examples + run: make -C ci build-examples - name: Check fmt - run: cargo fmt --check + run: make -C ci check-fmt + + - name: Check clippy lints + run: make -C ci check-clippy - name: Run tests - run: cargo test --verbose + run: make -C ci check-test - name: Run example tests - run: cargo test --examples --verbose + run: make -C ci check-examples @@ -58,5 +58,13 @@ The [`examples/`](examples/) folder provides additional examples: - [`add.rs`](examples/add.rs) jit compile a function calling another function compiled into the example. - [`tiny_vm.rs`](examples/tiny_vm.rs) define a minimal `virtual machine (VM)` which demonstrates a simple jit compiler for translating VM guest software. +## git hook for local development + +The [`ci/`] checks can be run automatically during local development by +installing the following `pre-commit` git hook. +```sh +echo 'make -C ci' > .git/hooks/pre-commit; chmod +x .git/hooks/pre-commit +``` + ## License This project is licensed under the [MIT](LICENSE) license. diff --git a/ci/Makefile b/ci/Makefile new file mode 100644 index 0000000..69d6c97 --- /dev/null +++ b/ci/Makefile @@ -0,0 +1,19 @@ +all: build build-examples check-fmt check-clippy check-tests check-examples + +build: + cargo build + +build-examples: + cargo build --examples + +check-fmt: + cargo fmt --check + +check-clippy: + cargo clippy -- -Dwarnings -Aclippy::new_without_default + +check-tests: + cargo test + +check-examples: + cargo test --examples |