diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml index 267e021..1c76246 100644 --- a/.github/workflows/Test.yml +++ b/.github/workflows/Test.yml @@ -29,8 +29,11 @@ jobs: - uses: actions/checkout@v4 - uses: actions-rust-lang/setup-rust-toolchain@v1 - - name: Set up uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh + - name: Install uv + uses: astral-sh/setup-uv@v3 + with: + enable-cache: true + - name: Set up Python uses: actions/setup-python@v5 with: @@ -39,8 +42,8 @@ jobs: - name: Install tzfpy and test shell: bash run: | - uv run ruff check . - uv run pytest | tee benchmark_result.txt + make lint + make test | tee benchmark_result.txt - name: Setup benchmark file name id: gen-benchmark-file-name diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..46596da --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +export PYTHONPATH := $(shell pwd) +export UV_PYTHON_PREFERENCE=only-system +export PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 +export CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG=true + +build: + uv build + +fmt: + uv run ruff check --select I --fix . + uv run ruff format . + +lint: + uv run ruff check . + uv run ruff format --check . + +sync: + uv sync --compile + +lock: + uv lock + +upgrade: + uv lock --upgrade + +all: lock sync + make fmt + make lint + make test + +test: lint + uv run pytest -v .