-
Notifications
You must be signed in to change notification settings - Fork 9
/
Rakefile
59 lines (50 loc) · 1.37 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
51
52
53
54
55
56
57
58
59
task :default => :menu
working_dir = pwd
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
desc 'Deploy Indexer'
task :deploy, [:deploy_type, :build_type, :blocks_count] => [:build] do |t, args|
chdir working_dir
args.with_defaults(deploy_type: 'prod', build_type: 'nix', blocks_count: '5000')
sh "ruby ops/ingest-blocks.rb #{args[:deploy_type]} #{args[:build_type]} #{args[:blocks_count]}"
end