-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
64 lines (55 loc) · 1.77 KB
/
Copy pathjustfile
File metadata and controls
64 lines (55 loc) · 1.77 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
@_default:
just --list --unsorted
# Run all build-related recipes in the justfile
run-all: install-deps format-python check-python check-spelling check-commits test
# Install the pre-commit hooks
install-precommit:
# Install pre-commit hooks
uvx pre-commit install
# Run pre-commit hooks on all files
uvx pre-commit run --all-files
# Update versions of pre-commit hooks
uvx pre-commit autoupdate
# Install Python package dependencies
install-deps:
uv sync --upgrade --dev --all-extras
# Check Python code with the linter for any errors that need manual attention
check-python:
uv run ruff check .
# Reformat Python code to match coding style and general structure
format-python:
uv run ruff check --fix .
uv run ruff format .
# Run checks on commits with non-main branches
check-commits:
#!/bin/zsh
branch_name=$(git rev-parse --abbrev-ref HEAD)
number_of_commits=$(git rev-list --count HEAD ^$branch_name)
if [[ ${branch_name} != "main" && ${number_of_commits} -gt 0 ]]
then
uv run cz check --rev-range main..HEAD
else
echo "Not on main or haven't committed yet."
fi
# Check for spelling errors in files
check-spelling:
uv run typos
test:
#!/bin/zsh
temp_dir="_temp/test-data-package"
rm -rf $temp_dir
mkdir -p $temp_dir
# vcs-ref means the current commit/head, not a tag.
# `.` means the current directory contains the template.
uvx copier copy --vcs-ref=HEAD . $temp_dir \
--defaults \
--data package_abbrev= "test-data-package" \
--data package_github="first-last/test-data-package" \
--data author_given_name="First" \
--data author_family_name="Last" \
--data author_email="first.last@example.com"
# TODO: Other checks/tests?
cleanup:
#!/bin/zsh
temp_dir=$("_temp/test-data-package"))
rm -rf $temp_dir