-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathjustfile
More file actions
123 lines (96 loc) · 2.98 KB
/
justfile
File metadata and controls
123 lines (96 loc) · 2.98 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# Setup development environment (install git hooks)
setup:
#!/usr/bin/env bash
echo '#!/bin/sh' > .git/hooks/pre-commit
echo 'just check' >> .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
echo "Git pre-commit hook installed successfully"
# Run all tests
test: test-rust
# Check all code quality tools
[parallel]
check: check-rust check-python check-nix
[parallel]
fix: fix-rust fix-rust fix-nix
fix-nix: fix-fmt-nix
[parallel]
fix-rust: fix-fmt-rust fix-lint-rust
[parallel]
fix-python: fix-fmt-python fix-lint-python
# Fix formatting issues
[parallel]
fix-fmt: fix-fmt-rust fix-fmt-python fix-fmt-nix
# Fix linting issues
[parallel]
fix-lint: fix-lint-rust fix-lint-python
# Check Rust code in kdf-init
[parallel]
check-rust: check-fmt-rust check-lint-rust
# Check Rust formatting
check-fmt-rust:
cd kdf-init && cargo fmt --check
# Format Rust code
fix-fmt-rust:
cd kdf-init && cargo fmt
# Run cargo check and clippy
check-lint-rust:
cd kdf-init && cargo check --all-targets --all-features
cd kdf-init && cargo clippy --all-targets --all-features -- -D warnings
# Fix clippy warnings
fix-lint-rust:
cd kdf-init && cargo clippy --all-targets --all-features --fix --allow-dirty --allow-staged
# Run Rust tests
test-rust:
cd kdf-init && cargo test --all-features
# Check Python code in kdf-cli
[parallel]
check-python: check-fmt-python check-lint-python
# Run ruff linter and ty typechecker
[parallel]
check-lint-python: check-lint-python-ruff check-lint-python-ty
# Run ruff linter
check-lint-python-ruff:
cd kdf-cli && ruff check .
# Run ty typechecker
check-lint-python-ty:
cd kdf-cli && ty check .
# Fix ruff issues
fix-lint-python:
cd kdf-cli && ruff check --fix .
# Check ruff formatting
check-fmt-python:
cd kdf-cli && ruff format --check .
# Format Python code
fix-fmt-python:
cd kdf-cli && ruff format .
# Check Nix files
[parallel]
check-nix: check-fmt-nix
# Check Nix formatting
check-fmt-nix:
nix fmt -- --fail-on-change
# Format Nix files
fix-fmt-nix:
nix fmt
# Build kdf-init statically with musl
build-init:
cd kdf-init && cargo build --release --target x86_64-unknown-linux-musl
# Build kdf-init and run with flake kernel
run: build-init
#!/usr/bin/env bash
set -e
echo "Running kdf with flake kernel..."
mkdir -p .kdf-resources
cp kdf-init/target/x86_64-unknown-linux-musl/release/init .kdf-resources/init
echo "Building initramfs..."
kdf build initramfs .kdf-resources/init --output .kdf-resources/initramfs.cpio
export KDF_RESOURCE_DIR="$PWD/.kdf-resources"
kdf run --kernel "$KERNEL_IMG_DIR/bzImage" --nix busybox --virtiofs workdir:"$PWD":/mnt/workdir --chdir /mnt/workdir --debug
# Connect to running VM with GDB for runtime module debugging
debug:
#!/usr/bin/env bash
MODULE_DIRS=$(find modules -mindepth 1 -maxdepth 1 -type d)
python3 scripts/debug_gdb.py \
--vmlinux-dir "$KERNEL" \
--kernel-version "$KERNEL_VERSION" \
--module-dirs $MODULE_DIRS