-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjustfile
More file actions
98 lines (81 loc) · 3.17 KB
/
Copy pathjustfile
File metadata and controls
98 lines (81 loc) · 3.17 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
# Default recipe (runs when you type just `just`)
default: list
################################################################################
# Config
################################################################################
# Docker image name
image_name := "dotfiles-test"
container_name := "dotfiles-test"
test_path := "/home/testuser/.tests/"
testresult_path := "/home/testuser/.test_results/"
# Set environment for Docker CLI
export DOCKER_CLI_HINTS := "false"
export DOCKER_BUILDKIT := "1"
################################################################################
# Tests
################################################################################
# Run all tests
test: build
#!/usr/bin/env bash
echo "Running tests..."
mkdir -p .test_results
docker rm -f {{container_name}} 2>/dev/null || true
docker run --name {{container_name}} \
{{image_name}} bash -c \
"pytest -v --junitxml={{testresult_path}}/unit-test-result.xml"
EXIT_CODE=$?
docker cp "{{container_name}}:{{testresult_path}}." .test_results/ 2>/dev/null || true
docker rm {{container_name}} 2>/dev/null || true
exit $EXIT_CODE
# Run tests in debug mode (drops to shell on failure)
test-debug: build
@echo "Running tests in debug mode..."
@mkdir -p .test_results
docker run --name {{container_name}} -it \
-v {{justfile_directory()}}/.test_results:{{testresult_path}} \
--rm {{image_name}} bash -c \
"pytest -vv -s --tb=short || bash"
# Run specific test marker
test-marker marker: build
@echo "Running tests with marker: {{marker}}"
docker run -it --rm {{image_name}} pytest -m {{marker}} -v
################################################################################
# Docs
################################################################################
# Regenerate keymapping tables in README.md using Claude (skips if configs unchanged)
gen-keymapping:
@bash .dotfileassets/gen_keymapping_md_table.sh
################################################################################
# Lint
################################################################################
# Lint markdown files
lint-md:
@echo "Linting markdown..."
docker run --rm -v {{justfile_directory()}}:/workdir davidanson/markdownlint-cli2 "README.md"
# Lint Python files
lint-py:
@echo "Linting Python files..."
@uvx run ruff check .
################################################################################
# Common
################################################################################
# List all available recipes
list:
@just --list
# Clean up Docker resources and test results
clean:
@echo "Cleaning up..."
@rm -rf .test_results
@docker rm -fv {{container_name}} 2>/dev/null || true
@docker rmi -f {{image_name}} 2>/dev/null || true
# Open interactive shell in the container
shell: build
@echo "Opening shell in container..."
docker run -it --rm {{image_name}} bash
# Build the Docker image
build:
#!/usr/bin/env bash
echo "Building Docker image..."
docker build \
${GITHUB_TOKEN:+--secret id=github_token,env=GITHUB_TOKEN} \
-t {{image_name}} -f .Dockerfile .