-
Notifications
You must be signed in to change notification settings - Fork 106
/
Rakefile
43 lines (38 loc) · 1.25 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
desc "Builds ultralist for release"
Envs = [
{ goos: "darwin", arch: "386" },
{ goos: "darwin", arch: "amd64" },
{ goos: "linux", arch: "arm" },
{ goos: "linux", arch: "arm64" },
{ goos: "linux", arch: "386" },
{ goos: "linux", arch: "amd64" },
{ goos: "windows", arch: "386" },
{ goos: "windows", arch: "amd64" }
].freeze
Version = "1.7.0".freeze
task :build do
`rm -rf dist/#{Version}`
Envs.each do |env|
ENV["GOOS"] = env[:goos]
ENV["GOARCH"] = env[:arch]
puts "Building #{env[:goos]} #{env[:arch]}"
`GOOS=#{env[:goos]} GOARCH=#{env[:arch]} CGO_ENABLED=0 go build -v -o dist/#{Version}/ultralist`
if env[:goos] == "windows"
puts "Creating windows executable"
`mv dist/#{Version}/ultralist dist/#{Version}/ultralist.exe`
`cd dist/#{Version} && zip ultralist_win.zip ultralist.exe`
puts "Removing windows executable"
`rm -rf dist/#{Version}/ultralist.exe`
else
puts "Tarring #{env[:goos]} #{env[:arch]}"
`cd dist/#{Version} && tar -czvf ultralist#{env[:goos]}_#{env[:arch]}.tar.gz ultralist`
puts "Removing dist/#{Version}/ultralist"
`rm -rf dist/#{Version}/ultralist`
end
end
end
desc "Tests all the things"
task :test do
system "go test ./..."
end
task default: :test