forked from grafana/k6
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
84 lines (72 loc) · 3.29 KB
/
appveyor.yml
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
image: Visual Studio 2017
clone_folder: 'c:\gopath\src\github.com\%APPVEYOR_REPO_NAME%'
# Do not build feature branch with open Pull Requests
skip_branch_with_pr: true
environment:
# improve readability
VCS_URL: 'https://github.com/%APPVEYOR_REPO_NAME%'
# specific to go
VERSION: "%APPVEYOR_REPO_TAG_NAME:v=%"
GOPATH: c:\gopath
GOVERSION: 1.14
GOMAXPROCS: 2
CGO_ENABLED: '0'
GOARCH: amd64
BINTRAY_KEY:
secure: 0DFVlQR9tBvdTiULPdCw12VBf2Zzy/hpPiPtlKhHdaatIBdwB6i1HhPcgh0kDEBr
GPG_PASSPHRASE:
secure: CMQ+U+qVVdhIr1Eip5nGPbaGFggVvSjg/BpSY0EpLbQ=
# prepare system and project
install:
- choco install wixtoolset pandoc -y
- refreshenv
# ensure wix and go are available in PATH
- set PATH=C:\go\bin;%GOPATH%\bin;%WIX%\bin;%PATH%
- ps: |
Remove-Item 'C:\go' -Recurse -Force -ErrorAction Ignore
Remove-Item 'C:\go-x86' -Recurse -Force -ErrorAction Ignore
Write-Host "Downloading..."
$goDistPath = "$env:TEMP\go" + $env:GOVERSION + ".windows-amd64.zip"
(New-Object Net.WebClient).DownloadFile("https://dl.google.com/go/go" + $env:GOVERSION + ".windows-amd64.zip", $goDistPath)
Write-Host "Unpacking..."
7z x $goDistPath -oC:\gotmp-x64 | Out-Null
[IO.Directory]::Move('C:\gotmp-x64\go', 'C:\go')
Remove-Item 'C:\gotmp-x64' -Recurse -Force
del $goDistPath
Write-Host "Testing..."
- go version
- echo "NumCores:%NUMBER_OF_PROCESSORS%"
- systeminfo
# build msi artifacts
build_script:
# In case of non tag build, mock a version
- if "%APPVEYOR_REPO_TAG%" == "false" (set VERSION="0.0.1")
- cd %APPVEYOR_BUILD_FOLDER%
- pandoc -s -f markdown -t rtf -o packaging\LICENSE.rtf LICENSE.md
- go version
- go build -a -trimpath -ldflags "-s -w" -o packaging\k6.exe
- cd %APPVEYOR_BUILD_FOLDER%\packaging
- candle.exe -arch x64 -dVERSION=%VERSION% k6.wxs
- light.exe -ext WixUIExtension k6.wixobj
test_script:
- cd %APPVEYOR_BUILD_FOLDER%
- go version
- go test ./...
deploy_script:
- cd %APPVEYOR_BUILD_FOLDER%\packaging
# Checking if the build has started by pushed tag
- ps: |
if ( $env:APPVEYOR_REPO_TAG -eq "false" ) { Exit-AppveyorBuild }
# Publishing the msi
- 'curl --fail -H "X-GPG-PASSPHRASE: %GPG_PASSPHRASE%" -T k6.msi "https://%BINTRAY_USER%:%BINTRAY_KEY%@api.bintray.com/content/loadimpact/windows/k6/%VERSION%/k6-v%VERSION%-amd64.msi?publish=1&override=1"'
- 'curl --fail -H "X-GPG-PASSPHRASE: %GPG_PASSPHRASE%" -T k6.msi "https://%BINTRAY_USER%:%BINTRAY_KEY%@api.bintray.com/content/loadimpact/windows/k6/latest/k6-latest-amd64.msi?publish=1&override=1"'
- ps: |
# Create Chocolately Package
mkdir .\k6.portable
Copy-Item -Path .\k6.portable.nuspec -Destination .\k6.portable\k6.portable.nuspec
Copy-Item -Path .\k6.exe -Destination .\k6.portable\k6.exe
Set-Location -Path .\k6.portable\
(Get-Content '.\k6.portable.nuspec' -Raw).Replace("<version>__REPLACE__</version>", "<version>$($env:APPVEYOR_REPO_TAG_NAME.substring(1))</version>") | Out-File '.\k6.portable.nuspec'
choco pack
# Publising the chocolatey package
- 'curl --fail -H "X-GPG-PASSPHRASE: %GPG_PASSPHRASE%" -T .\k6.portable.%VERSION%.nupkg "https://%BINTRAY_USER%:%BINTRAY_KEY%@api.bintray.com/content/loadimpact/choco/k6.portable/%VERSION%/k6.portable.%VERSION%.nupkg?publish=1&override=1"'