mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-11-10 17:26:10 +08:00
2f83aa9302
* Switched to v2 go.mod Also set GO111MODULE=on in build stuff to always use Go modules even when in GOPATH. * Ensure go.mod, go.sum, and vendor are up to date * Attempt to fix Azure pipelines * Add set -e to properly fail on exit (it didn't seem to be propagating properly before). * Set workingDirectory for GoFmt and GoGen (this might be why it fails unlike compile and unitests). * Another attempt to fix Azure Pipelines * Use the Go env template for all go-related jobs. * Completely fixed Azure Pipelines * Added a display name to GoFmt for consistency. * Fixed diffs for GoFmt and GoGen. * Show git status for checks. * Drop GOPATH for tests TODO: Do the same for integration tests. * Drop GOPATH for integration tests * Show more diffs * Regenerate provider support matrix This wasn't done in #590...
43 lines
No EOL
954 B
PowerShell
43 lines
No EOL
954 B
PowerShell
param (
|
|
[string]$SHA = ""
|
|
)
|
|
|
|
if ($SHA -eq ""){
|
|
$SHA = (git rev-parse HEAD) | Out-String
|
|
$SHA = $SHA.Replace([System.Environment]::NewLine,"")
|
|
}
|
|
|
|
|
|
$PKG = "github.com/StackExchange/dnscontrol"
|
|
$DATE = [int][double]::Parse((Get-Date -UFormat %s))
|
|
$FLAGS="-mod=readonly -s -w -X main.SHA=$SHA -X main.BuildTime=$DATE"
|
|
Write-Host $FLAGS
|
|
|
|
$OrigGOOS = $env:GOOS
|
|
|
|
$env:GO111MODULE = "on"
|
|
|
|
Write-Host 'Building Linux'
|
|
$env:GOOS = "linux"
|
|
go build -o dnscontrol-Linux -ldflags "$FLAGS" $PKG
|
|
|
|
Write-Host 'Building Windows'
|
|
$env:GOOS = "windows"
|
|
go build -o dnscontrol.exe -ldflags "$FLAGS" $PKG
|
|
|
|
Write-Host 'Building Darwin'
|
|
$env:GOOS = "darwin"
|
|
go build -o dnscontrol-Darwin -ldflags "$FLAGS" $PKG
|
|
|
|
$env:GOOS = $OrigGOOS
|
|
|
|
#No compression if building on windows
|
|
<#
|
|
if [ "$COMPRESS" = "1" ]
|
|
then
|
|
echo 'Compressing executables'
|
|
upx dnscontrol.exe
|
|
upx dnscontrol-Linux
|
|
upx dnscontrol-Darwin
|
|
fi
|
|
#> |