-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
100 lines (83 loc) · 2.91 KB
/
Makefile
File metadata and controls
100 lines (83 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
.PHONY: install build run test format clean help docker-build
# Docker image name
IMAGE_NAME := rustcrawler
DOCKER_RUN := docker run --rm -it -v $(PWD):/app -w /app $(IMAGE_NAME)
# Default target
all: build
# Install - Build the Docker image with the latest Rust version
install:
@echo "Building Docker image with latest Rust..."
docker build -t $(IMAGE_NAME) .
@echo "Docker image '$(IMAGE_NAME)' built successfully!"
@echo "Rust is now available in the Docker container."
# Add dependancies to the project
add:
@echo "Building rusttest in Docker..."
$(DOCKER_RUN) cargo add uuid
# Build the project
build:
@echo "Building RustCrawler in Docker..."
$(DOCKER_RUN) cargo build
# Build in release mode
build-release:
@echo "Building RustCrawler in release mode in Docker..."
$(DOCKER_RUN) cargo build --release
# Run the project
run:
@echo "Running RustCrawler in Docker..."
$(DOCKER_RUN) cargo run
# Run in release mode
run-release:
@echo "Running RustCrawler in release mode in Docker..."
$(DOCKER_RUN) cargo run --release
# Run tests
test:
@echo "Running tests in Docker..."
$(DOCKER_RUN) cargo test
# Run tests with verbose output
test-verbose:
@echo "Running tests (verbose) in Docker..."
$(DOCKER_RUN) cargo test -- --nocapture
# Format code with rustfmt
format:
@echo "Formatting code in Docker..."
$(DOCKER_RUN) cargo fmt
# Check formatting without modifying files
format-check:
@echo "Checking code formatting in Docker..."
$(DOCKER_RUN) cargo fmt -- --check
# Run clippy linter
lint:
@echo "Running clippy linter in Docker..."
$(DOCKER_RUN) cargo clippy -- -D warnings
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
$(DOCKER_RUN) cargo clean
@echo "Removing Docker image..."
docker rmi $(IMAGE_NAME) 2>/dev/null || true
# Check if code compiles without building
check:
@echo "Checking code in Docker..."
$(DOCKER_RUN) cargo check
# Open a shell in the Docker container
shell:
@echo "Opening shell in Docker container..."
docker run --rm -it -v $(PWD):/app -w /app $(IMAGE_NAME) /bin/bash
# Display help information
help:
@echo "RustCrawler Makefile targets (all commands run in Docker):"
@echo " make install - Build Docker image with latest Rust (required first time)"
@echo " make build - Build the project"
@echo " make build-release - Build in release mode"
@echo " make run - Run the project"
@echo " make run-release - Run in release mode"
@echo " make test - Run tests"
@echo " make test-verbose - Run tests with verbose output"
@echo " make format - Format code with rustfmt"
@echo " make format-check - Check code formatting"
@echo " make lint - Run clippy linter"
@echo " make clean - Clean build artifacts and Docker image"
@echo " make check - Check if code compiles"
@echo " make shell - Open a shell in the Docker container"
@echo " make help - Display this help message"