This repository was archived by the owner on Sep 28, 2023. It is now read-only.
forked from 1dustindavis/gorilla
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappveyor.yml
More file actions
111 lines (69 loc) · 3.11 KB
/
Copy pathappveyor.yml
File metadata and controls
111 lines (69 loc) · 3.11 KB
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
105
106
107
108
109
110
111
version: gorilla-appveyor-{build}
branches:
only:
- master
clone_folder: c:\gopath\src\github.com\1dustindavis\gorilla
init:
- ps: >-
Remove-Item 'C:\go' -Recurse -Force -ErrorAction Ignore
Write-Host "Downloading Go 1.12..."
$goDistPath = "$env:TEMP\go1.12.windows-amd64.zip"
(New-Object Net.WebClient).DownloadFile('https://storage.googleapis.com/golang/go1.12.windows-amd64.zip', $goDistPath)
Write-Host "Unpacking Go 1.12..."
7z x $goDistPath -oC:\go1120-x64 | Out-Null
[IO.Directory]::Move('C:\go1120-x64\go', 'C:\go112')
Remove-Item 'C:\go1120-x64' -Recurse -Force
del $goDistPath
cmd /c mklink /J C:\go C:\go112
environment:
GOPATH: c:\gopath
GO111MODULE: on
install:
- ps: >-
# Define build variables
$APP_NAME = "gorilla"
$VERSION = git describe --tags --always --dirty
$BRANCH = $env:APPVEYOR_REPO_BRANCH
$NOW = Get-Date -format s
$REVISION = git rev-parse HEAD
$GOVERSION = (go version).Split()[2]
Set-AppveyorBuildVariable -Name "gorilla_app_name" -Value $APP_NAME
Set-AppveyorBuildVariable -Name "gorilla_version" -Value $VERSION
Set-AppveyorBuildVariable -Name "gorilla_branch" -Value $BRANCH
Set-AppveyorBuildVariable -Name "gorilla_now" -Value $NOW
Set-AppveyorBuildVariable -Name "gorilla_revision" -Value $REVISION
Set-AppveyorBuildVariable -Name "gorilla_goversion" -Value $GOVERSION
- cmd: >-
rem go get must be ran from cmd because AppVeyor uses remote Powershell sessions
rem which treat any stderr output as a NativeCommandError
go get -d ./...
build_script:
- ps: >-
$BUILD_VERSION = "-X github.com/1dustindavis/gorilla/pkg/version.appName=$env:gorilla_app_name " +
"-X github.com/1dustindavis/gorilla/pkg/version.version=$env:gorilla_version " +
"-X github.com/1dustindavis/gorilla/pkg/version.branch=$env:gorilla_branch " +
"-X github.com/1dustindavis/gorilla/pkg/version.buildDate=$env:gorilla_now " +
"-X github.com/1dustindavis/gorilla/pkg/version.revision=$env:gorilla_revision " +
"-X github.com/1dustindavis/gorilla/pkg/version.goVersion=$env:gorilla_goversion"
# Make our build directory and run the build command
mkdir build > $null
go build -i -o build/gorilla.exe -ldflags $BUILD_VERSION ./cmd/gorilla
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
test_script:
- ps: >-
# Add the go bin directory to the path
$env:Path += ";C:\go\bin;C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin"
# Error if gofmt returns anything
If (gofmt -l .) {
Write-Error "Repo contains improperly formatted go files; run gofmt -w *.go"
}
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
# Run go vet
go vet ./...
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
# Run tests
go test -cover -race ./...
artifacts:
- path: build/gorilla.exe
name: gorilla_build
deploy: off