-
Notifications
You must be signed in to change notification settings - Fork 148
Expand file tree
/
Copy pathTaskfile.yml
More file actions
128 lines (111 loc) · 4.27 KB
/
Taskfile.yml
File metadata and controls
128 lines (111 loc) · 4.27 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
124
125
126
127
128
version: "3"
vars:
TEST_FILTER: '{{default "" .TEST_FILTER}}'
CARGO_TEST_ARGS: '{{default "" .CARGO_TEST_ARGS}}'
EXTRA_TEST_BINARY_ARGS: '{{default "" .EXTRA_TEST_BINARY_ARGS}}'
NO_CAPTURE: '{{default "false" .NO_CAPTURE}}'
TEST_BINARY_ARGS:
sh: |
args=""
if [ "{{.NO_CAPTURE}}" = "true" ]; then
args="--nocapture"
fi
if [ -n "{{.EXTRA_TEST_BINARY_ARGS}}" ]; then
args="$args {{.EXTRA_TEST_BINARY_ARGS}}"
fi
printf '%s' "$args"
TEST_THREADS:
sh: |
n=$(nproc 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu)
[ "$n" -gt 12 ] && echo 12 || echo "$n"
tasks:
dev:
desc: |
Install a git-ai debug build for local dev on the system so that all git commands will route through it.
Installs to the same location as real release builds, so it overrides system-wide. It also runs `git-ai install`
and restarts the daemon to ensure all latest code changes are fully installed and propagated system-wide.
Use this for trying out changes locally -- do not use any other approaches for runing git-ai locally. They will
not work, interfere, and break things.
cmds:
- cmd: powershell -NonInteractive -NoProfile -ExecutionPolicy Bypass -File scripts/dev.ps1
platforms: [windows]
- cmd: ./scripts/dev.sh
platforms: [linux, darwin]
clean:
desc: Clean build artifacts
cmds:
- cargo clean
build:
desc: Build the project (only use this for checking that the project builds, not for running locally -- use `task dev` instead)
cmds:
- cargo build
test:base:
internal: true
cmds:
- cargo test {{.CARGO_TEST_ARGS}} {{.TEST_FILTER}} -- --test-threads {{.TEST_THREADS}} {{.TEST_BINARY_ARGS}}
env:
GIT_AI_TEST_GIT_MODE: "{{.GIT_AI_TEST_GIT_MODE}}"
GIT_AI_TEST_SHARED_DAEMON_POOL_SIZE: "{{.TEST_THREADS}}"
test:
desc: Run unit tests (daemon mode by default)
cmds:
- task: test:base
vars:
GIT_AI_TEST_GIT_MODE: daemon
test:wrapper-daemon:
desc: |
Run unit tests in wrapper-daemon mode. Wrapper-daemon mode is where we simulate `git` pointing to the git-ai-wrapped git, but
all git-ai processing is still done in the shared daemon with some extra context from the wrapper that is passed over the control
socket. Do not use this test mode unless explicitly requested, use `task test` for normal testing purposes.
cmds:
- task: test:base
vars:
GIT_AI_TEST_GIT_MODE: wrapper-daemon
test:wrapper:
desc: Run unit tests in wrapper mode (DEPRECATED - DO NOT USE THIS UNLESS EXPLICITLY REQUESTED BY THE USER FOR TESTING PURPOSES; WILL BE REMOVED SOON)
cmds:
- task: test:base
vars:
GIT_AI_TEST_GIT_MODE: wrapper
test:bats:
desc: Run the bats-based tests with debug build (DEPRECATED - DO NOT USE THIS UNLESS EXPLICITLY REQUESTED BY THE USER FOR TESTING PURPOSES; WILL BE REMOVED SOON)
deps: [build]
cmds:
- bats tests/e2e/user-scenarios.bats
lint:
desc: Run cargo check and clippy with warnings as errors
cmds:
- cargo clippy --all-targets -- -D warnings
doc:
desc: Build documentation with warnings as errors
cmds:
- cargo doc --no-deps
env:
RUSTDOCFLAGS: "-D warnings"
format:
desc: Format code with rustfmt
aliases: [fmt]
cmds:
- cargo fmt
format:check:
desc: Check code formatting (CI)
cmds:
- cargo fmt -- --check
coverage:
desc: Run tests with coverage and show summary
cmds:
- cargo llvm-cov test --ignore-filename-regex='tests/.*|benches/.*|examples/.*'
coverage:html:
desc: Generate HTML coverage report and open in browser
cmds:
- cargo llvm-cov test --ignore-filename-regex='tests/.*|benches/.*|examples/.*' --html --open
coverage:lcov:
desc: Generate LCOV coverage report
cmds:
- cargo llvm-cov test --ignore-filename-regex='tests/.*|benches/.*|examples/.*' --lcov --output-path lcov.info
coverage:check:
desc: Run coverage and fail if below threshold
cmds:
- cargo llvm-cov test --ignore-filename-regex='tests/.*|benches/.*|examples/.*' --fail-under-lines {{.COVERAGE_THRESHOLD}}
vars:
COVERAGE_THRESHOLD: '{{.COVERAGE_THRESHOLD | default "50"}}'