-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTaskfile.yml
More file actions
123 lines (108 loc) · 4.02 KB
/
Copy pathTaskfile.yml
File metadata and controls
123 lines (108 loc) · 4.02 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
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: |
if [ -n "$NUMBER_OF_PROCESSORS" ]; then
n=$(powershell -NoProfile -NonInteractive -Command "[Environment]::ProcessorCount")
elif command -v nproc >/dev/null 2>&1; then
n=$(nproc)
elif command -v getconf >/dev/null 2>&1; then
n=$(getconf _NPROCESSORS_ONLN)
else
n=$(sysctl -n hw.ncpu)
fi
[ "$n" -gt 12 ] && echo 12 || echo "$n"
tasks:
dev:
desc: |
Install a autter 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 `autter 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 autter 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:
AUTTER_TEST_GIT_MODE: "{{.AUTTER_TEST_GIT_MODE}}"
AUTTER_TEST_SHARED_DAEMON_POOL_SIZE: "{{.TEST_THREADS}}"
test:
desc: Run unit tests (daemon mode by default)
cmds:
- task: test:base
vars:
AUTTER_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 autter-wrapped git, but
all autter 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:
AUTTER_TEST_GIT_MODE: wrapper-daemon
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"}}'