Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (45 loc) · 2.2 KB
/
Copy pathMakefile
File metadata and controls
56 lines (45 loc) · 2.2 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
.PHONY: sync test lint fmt fix check doc update-equivalent-checks-cases check-equivalent-checks-cases
# openfga/language commit to copy the shared equivalent-checks cases from
LANGUAGE_REF ?= 41f78349717678d97aade591cf12c78541fae77f
# Install/update dependencies
sync:
uv sync
# Run tests with coverage (excludes integration tests)
# Usage: make test
# To run a specific test: make test TEST=test_file.py::test_function
test:
uv run pytest -m "not integration" --cov-report term-missing --cov=openfga_sdk $(if $(TEST),$(TEST),test/)
test-integration:
uv run pytest -m integration --cov-report term-missing --cov=openfga_sdk $(if $(TEST),$(TEST),test/)
# Run linter
lint:
uv run ruff check .
# Format code
fmt:
uv run ruff format .
# Fix fixable linting and formatting issues
fix:
uv run ruff check --fix .
uv run ruff format .
# Copy the shared equivalent-checks cases from openfga/language
# Usage: make update-equivalent-checks-cases LANGUAGE_REF=<commit>
update-equivalent-checks-cases:
curl -fsSL https://raw.githubusercontent.com/openfga/language/$(LANGUAGE_REF)/tests/data/equivalent-checks-cases.json -o test/data/equivalent-checks-cases.json
# Check that the committed equivalent-checks cases match openfga/language at LANGUAGE_REF
check-equivalent-checks-cases:
curl -fsSL https://raw.githubusercontent.com/openfga/language/$(LANGUAGE_REF)/tests/data/equivalent-checks-cases.json | diff -q - test/data/equivalent-checks-cases.json
# Run checks (lint + test)
check: lint fmt test
# Show help
doc:
@echo "Available targets:"
@echo " sync - Install/update dependencies"
@echo " test - Run tests with coverage (excludes integration tests, use TEST=path.to.test to run specific tests)"
@echo " test-integration - Run integration tests with coverage"
@echo " lint - Run linter checks"
@echo " fmt - Format code"
@echo " fix - Fix fixable linting and formatting issues"
@echo " check - Run both linting and tests"
@echo " update-equivalent-checks-cases - Copy the shared equivalent-checks cases from openfga/language (LANGUAGE_REF=<commit>)"
@echo " check-equivalent-checks-cases - Check the committed cases match openfga/language at LANGUAGE_REF"
@echo " doc - Show this help message"