-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjustfile
105 lines (82 loc) · 2.73 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
#!/usr/bin/env just --justfile
DEFAULT_TARGETS := '
arm-unknown-linux-musleabi
arm-unknown-linux-musleabihf
armv7-unknown-linux-musleabihf
i686-unknown-linux-musl
x86_64-unknown-linux-musl
x86_64-unknown-netbsd
x86_64-apple-darwin
'
BINARY_NAME := 'superkeyloader'
ARTIFACTS_DIRECTORY := `pwd` + '/raaaandomstuff-artifacts'
SOURCE_DIRECTORY := `pwd`
CARGO_TOKEN := "test"
###########################
# Development Environment #
###########################
install-dev-deps:
@echo '> Will install `convco`, `grcov`, and `rusty-hook` globally'
cargo install convco grcov rusty-hook
@echo '> Development dependencies installed'
#
@echo '> Will install rust nightly toolchain (required by `grcov`)'
rustup toolchain install nightly
@echo '> Nightly toolchain installed'
#
@echo '> Installing clippy and rustfmt'
rustup component add clippy
rustup component add rustfmt
@echo '> Clippy and rustfmt tinstalled'
install-hooks:
@echo '> Installing git hooks'
rusty-hook init
@echo '> Git hooks installed'
setup-dev-env:
just install-dev-deps
just install-hooks
#####################
# Development Tools #
#####################
check:
@echo '> Check code formatting and linting'
cargo fmt -- --check
cargo clippy --all-targets --all-features -- -D warnings
@echo '> Wow! Everything is correctly formated and lint'
test:
@echo '> Test everything!'
cargo test
build:
@echo '> Build on default target'
cargo build
coverage TYPE='html' OUTPUT='./target/debug/coverage/':
# This will also build and test on nightly
@echo '> Setting up Rust environment variables for `grcov`'
export CARGO_INCREMENTAL=0
export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 \
-Clink-dead-code -Coverflow-checks=off -Zno-landing-pads"
@echo '> Building and testing with nightly'
# rustup run nightly cargo build
rustup run nightly cargo test
@echo '> Generating HTML code coverage report'
grcov ./target/debug/ -s . -t {{TYPE}} --llvm --branch --ignore-not-existing -o {{OUTPUT}} --ignore "/*" --ignore "../*"
@echo '> View report at `./target/debug/coverage/index.html`'
#############
# Git Hooks #
#############
pre-commit:
@echo '> Check formatting, lint code'
# Check code for correct formatting (doesn't autoformat)
# and lint code in the most pedantic way
just check
commit-msg:
# TODO: After solving non-rust dependencies problem with `commitlint`
pre-push:
@echo '> Test code and verify commit messages'
# Checks if your commit messages meet the conventional commit format (see https://www.conventionalcommits.org/en/v1.0.0/)
# Keep the remote repo clean
# TODO: Move to `commit-msg` after finding a good solution
convco check
# Code on remote repo must work, so let's test it before pushing it
just test
# vim: set ft=make :