-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
145 lines (126 loc) · 3.92 KB
/
justfile
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# List available commands
default:
just --list
# Auto format code
lint-fix:
cargo fmt
black .
ruff check --fix .
[private]
ci-lint-rustfmt:
cargo fmt --check
[private]
ci-lint-black:
black --check .
[private]
ci-lint-ruff:
ruff check .
# Lint code
lint-rust:
cd kadmin-sys && cargo clippy --features client
cd kadmin-sys && cargo clippy --no-default-features --features server
cd kadmin && cargo clippy
cd kadmin && cargo clippy --features python
cd kadmin && cargo clippy --no-default-features --features local
cd kadmin && cargo clippy --no-default-features --features local,python
[private]
ci-lint-clippy: ci-build-deps
RUSTFLAGS="-Dwarnings" just lint-rust
# Mypy types checking
lint-mypy: install-python
stubtest kadmin kadmin_local
[private]
ci-lint-mypy: ci-build-deps lint-mypy
alias l := lint
# Lint and auto format
lint: lint-fix lint-rust
alias la := lint-all
# Common lint plus mypy types checking
lint-all: lint lint-mypy
alias b := build-rust
# Build all rust crates
build-rust:
cd kadmin-sys && cargo build --features client
cd kadmin-sys && cargo build --no-default-features --features server
cd kadmin && cargo build
cd kadmin && cargo build --features python
cd kadmin && cargo build --no-default-features --features local
cd kadmin && cargo build --no-default-features --features local,python
[private]
ci-build-deps:
sudo apt-get update
sudo apt-get install -y --no-install-recommends libkrb5-dev krb5-multidev
[private]
ci-build-rust: ci-build-deps
RUSTFLAGS="-Dwarnings" just build-rust
# Build python wheel
build-python:
python -m build
[private]
ci-build-python: ci-build-deps build-python
[private]
ci-build-python-sdist:
python -m build --sdist
# Build rust crates and python wheel
build: build-rust build-python
# Test kadmin-sys crate
test-kadmin-sys:
cd kadmin-sys && cargo test --features client
cd kadmin-sys && cargo test --no-default-features --features server
# Test kadmin crate
test-kadmin:
cd kadmin && cargo test
cd kadmin && cargo test --no-default-features --features local
alias t := test-rust
# Test all rust crates
test-rust: test-kadmin-sys test-kadmin
[private]
ci-test-deps:
sudo apt-get install -y --no-install-recommends valgrind
[private]
ci-test-deps-mit: ci-build-deps ci-test-deps
sudo apt-get install -y --no-install-recommends krb5-kdc krb5-user krb5-admin-server
[private]
ci-test-rust: ci-test-deps-mit
RUSTFLAGS="-Dwarnings" just test-rust
alias ts := test-sanity
# Test kadmin with valgrind for memory leaks
test-sanity:
cd kadmin && \
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="valgrind --error-exitcode=1 --suppressions=tests/valgrind.supp -s --leak-check=full" \
cargo test
cd kadmin && \
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="valgrind --error-exitcode=1 --suppressions=tests/valgrind.supp -s --leak-check=full" \
cargo test --no-default-features --features local
[private]
ci-test-sanity: ci-test-deps-mit
just test-sanity
_test-python:
python -m unittest python/tests/test_*.py
# Test python bindings
test-python: install-python _test-python
[private]
ci-test-deps-h5l: ci-test-deps
sudo apt-get install -y --no-install-recommends libkrb5-3 libkadm5clnt-mit12 libkadm5srv-mit12 heimdal-dev heimdal-servers heimdal-kdc
[private]
ci-test-python-mit: ci-test-deps-mit _install-python _test-python
ci-test-python-h5l: ci-test-deps-h5l _install-python _test-python
# Test rust crates and python bindings
test-all: test-rust test-sanity test-python
alias ta := test-all
_install-python:
pip install --force-reinstall dist/python_kadmin_rs-*.whl
# Build and install wheel
install-python: clean-python build-python _install-python
# Generate the Python docs
docs-python:
cd python/docs && sphinx-build -M html . _build
# Cleanup rust build directory
clean-rust:
rm -rf target
# Cleanup python wheel builds
clean-python:
pip uninstall -y python-kadmin-rs
rm -rf dist wheelhouse
# Cleanup all
clean: clean-rust clean-python