1
1
# Variables
2
- PKG := github.com/habedi/graphina
3
- BINARY_NAME := $(or $(PROJ_BINARY ) , $(notdir $(PKG ) ) )
2
+ REPO := github.com/habedi/graphina
3
+ BINARY_NAME := $(or $(PROJ_BINARY ) , $(notdir $(REPO ) ) )
4
4
BINARY := target/release/$(BINARY_NAME )
5
5
PATH := /snap/bin:$(PATH )
6
6
DEBUG_GRAPHINA := 1
@@ -9,6 +9,8 @@ RUST_BACKTRACE := full
9
9
WHEEL_DIR := dist
10
10
PYGRAPHINA_DIR := pygraphina
11
11
TEST_DATA_DIR := tests/testdata
12
+ SHELL := /bin/bash
13
+ MSRV := 1.83
12
14
13
15
# Find the latest built Python wheel file
14
16
WHEEL_FILE := $(shell ls $(PYGRAPHINA_DIR ) /$(WHEEL_DIR ) /pygraphina-* .whl 2>/dev/null | head -n 1)
@@ -17,7 +19,7 @@ WHEEL_FILE := $(shell ls $(PYGRAPHINA_DIR)/$(WHEEL_DIR)/pygraphina-*.whl 2>/dev/
17
19
.DEFAULT_GOAL := help
18
20
19
21
.PHONY : help
20
- help : # # Show the list of available targets with their descriptions
22
+ help : # # Show the help message for each target
21
23
@grep -E ' ^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST ) | \
22
24
awk ' BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
23
25
@@ -33,7 +35,8 @@ format: ## Format Rust files
33
35
.PHONY : test
34
36
test : format # # Run the tests
35
37
@echo " Running tests..."
36
- @DEBUG_GRAPHINA=$(DEBUG_GRAPHINA ) RUST_LOG=debug RUST_BACKTRACE=$(RUST_BACKTRACE ) cargo test -- --nocapture
38
+ @DEBUG_GRAPHINA=$(DEBUG_GRAPHINA ) RUST_LOG=debug RUST_BACKTRACE=$(RUST_BACKTRACE ) cargo test --all-targets \
39
+ --workspace -- --nocapture
37
40
38
41
.PHONY : coverage
39
42
coverage : format # # Generate test coverage report
@@ -98,23 +101,44 @@ doc: format ## Generate the documentation
98
101
@cargo doc --no-deps --document-private-items
99
102
100
103
.PHONY : fix-lint
101
- fix_lint : # # Fix the linter warnings
104
+ fix-lint : # # Fix the linter warnings
102
105
@echo " Fixing linter warnings..."
103
- @cargo clippy --fix --allow-dirty --allow-staged
106
+ @cargo clippy --fix --allow-dirty --all-targets --workspace --all-features -- -D warnings
104
107
105
108
.PHONY : nextest
106
109
nextest : # # Run tests using nextest
107
110
@echo " Running tests using nextest..."
108
111
@DEBUG_GRAPHINA=$(DEBUG_GRAPHINA ) RUST_BACKTRACE=$(RUST_BACKTRACE ) cargo nextest run
109
112
113
+ .PHONY : testdata
114
+ testdata : # # Download the datasets used in tests
115
+ @echo " Downloading test data..."
116
+ @$(SHELL ) $(TEST_DATA_DIR ) /download_datasets.sh $(TEST_DATA_DIR )
117
+
118
+ .PHONY : install-msrv
119
+ install-msrv : # # Install the minimum supported Rust version (MSRV) for development
120
+ @echo " Installing the minimum supported Rust version..."
121
+ @rustup toolchain install $(MSRV )
122
+ @rustup default $(MSRV )
123
+
124
+ .PHONY : run-examples
125
+ run-examples : # # Run all the scripts in the examples directory one by one
126
+ @echo " Running all example scripts..."
127
+ @for example in examples/* .rs; do \
128
+ example_name=$$(basename $$example .rs) ; \
129
+ echo " Running example: $$ example_name" ; \
130
+ cargo run --example $$ example_name; \
131
+ done
132
+
110
133
# #######################################################################################
111
134
# # Python targets
112
135
# #######################################################################################
113
136
114
- .PHONY : develop_py
115
- develop_py : # # Build and install PyGraphina in the current Python environment
137
+ .PHONY : develop-py
138
+ develop-py : # # Build and install PyGraphina in the current Python environment
116
139
@echo " Building and installing PyGraphina..."
117
- @ (cd $( PYGRAPHINA_DIR) && maturin develop)
140
+ # Note: Maturin does not work when CONDA_PREFIX and VIRTUAL_ENV are both set
141
+ @ (cd $( PYGRAPHINA_DIR) && unset CONDA_PREFIX && maturin develop)
118
142
119
143
.PHONY : wheel
120
144
wheel : # # Build the wheel file for PyGraphina
@@ -126,12 +150,13 @@ wheel-manylinux: ## Build the manylinux wheel file for PyGraphina (using Zig)
126
150
@echo " Building the manylinux PyGraphina wheel..."
127
151
@ (cd $( PYGRAPHINA_DIR) && maturin build --release --out $( WHEEL_DIR) --auditwheel check --zig)
128
152
129
- .PHONY : test_py
130
- test_py : develop_py # # Run Python tests
153
+ .PHONY : test-py
154
+ test-py : develop-py # # Run Python tests
131
155
@echo " Running Python tests..."
132
156
@poetry run pytest $(PYGRAPHINA_DIR ) /tests
133
157
134
- publish_py : wheel # # Publish the PyGraphina wheel to PyPI (requires PYPI_TOKEN to be set)
158
+ .PHONY : publish-py
159
+ publish-py : wheel-manylinux # # Publish the PyGraphina wheel to PyPI (requires PYPI_TOKEN to be set)
135
160
@echo " Publishing PyGraphina to PyPI..."
136
161
@if [ -z " $( WHEEL_FILE) " ]; then \
137
162
echo " Error: No wheel file found. Please run 'make wheel' first." ; \
@@ -140,7 +165,7 @@ publish_py: wheel ## Publish the PyGraphina wheel to PyPI (requires PYPI_TOKEN t
140
165
@echo " Found wheel file: $( WHEEL_FILE) "
141
166
@twine upload -u __token__ -p $(PYPI_TOKEN ) $(WHEEL_FILE )
142
167
143
- .PHONY : generate_ci
144
- generate_ci : # # Generate CI configuration files (GitHub Actions workflow)
168
+ .PHONY : generate-ci
169
+ generate-ci : # # Generate CI configuration files (GitHub Actions workflow)
145
170
@echo " Generating CI configuration files..."
146
171
@ (cd $( PYGRAPHINA_DIR) && maturin generate-ci --zig --pytest --platform all -o ../.github/workflows/ci.yml github)
0 commit comments