-
Notifications
You must be signed in to change notification settings - Fork 10
/
Rakefile
50 lines (43 loc) · 1.05 KB
/
Rakefile
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
task :default => :menu
desc 'Print the menu of targets'
task :menu do
sh 'rake', '-T'
end
desc 'Check for prerequisite software'
task :prereqs do
chdir 'rust'
sh 'cargo', '--version'
sh 'cargo', 'nextest', '--version'
sh 'cargo', 'audit', '--version'
sh 'cargo', 'clippy', '--version'
sh 'cargo', 'machete', '--version'
sh 'jq', '--version'
sh 'check-jsonschema', '--version'
end
desc 'Clean the directory tree of build artifacts'
task :clean do
rm_f 'result'
chdir 'rust'
sh 'cargo', 'clean'
end
desc 'Build the Rust code'
task :build do
chdir 'rust'
sh 'cargo', 'build', '--offline', '--release'
end
desc 'Verify that the Rust code is correctly formatted'
task :check_format do
old = chdir 'rust'
sh 'cargo', 'fmt', '--all', '--check'
end
desc 'Perform Rust-based unit tests'
task :test_unit do
chdir 'rust'
sh 'cargo', 'nextest', 'run', '--release'
end
desc 'Lint all code'
task :lint => :check_format do
formatted_flake = `nixfmt < flake.nix`
flake = File.read('flake.nix')
flake == formatted_flake || abort('rbb')
end