.PHONY: test lint build install clean test-integration test-integration-build
CONTAINER_ENGINE ?= podman
INTEGRATION_IMAGE = ttyforce-integration
SUDO := $(shell if [ "$$(id -u)" != "0" ] && ! $(CONTAINER_ENGINE) info >/dev/null 2>&1; then echo sudo; fi)
build:
cargo build --release
test: lint
cargo test --lib --tests -- --skip integration
$(MAKE) test-integration
lint:
cargo check
cargo clippy -- -D warnings
install:
cargo install --path .
clean:
cargo clean
test-integration-build:
$(SUDO) $(CONTAINER_ENGINE) build --no-cache -f Containerfile.integration -t $(INTEGRATION_IMAGE) .
test-integration: test-integration-build
$(SUDO) $(CONTAINER_ENGINE) run --rm --privileged \
--tmpfs /run \
--tmpfs /tmp \
-v /dev:/dev \
$(INTEGRATION_IMAGE)