diff --git a/.gitignore b/.gitignore index eccd7b4a..e8da9172 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target/ **/*.rs.bk +perf.* diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..23b9a17a --- /dev/null +++ b/Makefile @@ -0,0 +1,54 @@ +FAKTORY_HOST=127.0.0.1 +FAKTORY_PORT=7419 +FAKTORY_PORT_UI=7420 + +.PHONY: check +check: + cargo fmt --check + cargo clippy + cargo d --no-deps --all-features + +.PHONY: doc +doc: + RUSTDOCFLAGS='--cfg docsrs' cargo +nightly d --all-features --open + +.PHONY: faktory +faktory: + docker run --rm -d \ + -v faktory-data:/var/lib/faktory \ + -p ${FAKTORY_HOST}:${FAKTORY_PORT}:7419 \ + -p ${FAKTORY_HOST}:${FAKTORY_PORT_UI}:7420 \ + --name faktory \ + contribsys/faktory:latest \ + /faktory -b :7419 -w :7420 + +.PHONY: faktory/kill +faktory/kill: + docker stop faktory + +README.md: README.tpl src/lib.rs + cargo readme > README.md + +.PHONY: test +test: + cargo t --locked --all-features --all-targets + +.PHONY: test/doc +test/doc: + cargo test --locked --all-features --doc + +.PHONY: test/e2e +test/e2e: + FAKTORY_URL=tcp://${FAKTORY_HOST}:${FAKTORY_PORT} cargo test --locked --all-features --all-targets + +.PHONY: test/load +test/load: + cargo run --release --features binaries + +.PHONY: test/perf +test/perf: + CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph -o perf.flamegraph.svg -f binaries -b loadtest + +.PHONY: test/perf/clean +test/perf/clean: + rm perf.* diff --git a/README.md b/README.md index 299f924d..75ab8eb8 100644 --- a/README.md +++ b/README.md @@ -74,3 +74,7 @@ After that run the tests: FAKTORY_URL=tcp://127.0.0.1:7419 cargo test --all-features --locked --all-targets ``` Please note that setting "FAKTORY_URL" environment variable is required for e2e tests to not be skipped. + +Provided you have [make](https://www.gnu.org/software/make/#download) installed and `docker` daemon running, +you can launch a `Faktory` container with `make faktory` command. After that, hit `make test/e2e` to run the end-to-end test suite. +Remove the container with `make faktory/kill`, if it's no longer needed. diff --git a/README.tpl b/README.tpl index f1ec8085..4a74e9d1 100644 --- a/README.tpl +++ b/README.tpl @@ -19,3 +19,7 @@ After that run the tests: FAKTORY_URL=tcp://127.0.0.1:7419 cargo test --all-features --locked --all-targets ``` Please note that setting "FAKTORY_URL" environment variable is required for e2e tests to not be skipped. + +Provided you have [make](https://www.gnu.org/software/make/#download) installed and `docker` daemon running, +you can launch a `Faktory` container with `make faktory` command. After that, hit `make test/e2e` to run the end-to-end test suite. +Remove the container with `make faktory/kill`, if it's no longer needed.