windows_exporter/appveyor.yml

85 lines
3.1 KiB
YAML
Raw Normal View History

version: "{build}"
os: Visual Studio 2019
build: off
environment:
GOPATH: c:\gopath
2019-10-19 14:50:13 +00:00
GO111MODULE: on
2020-05-24 18:42:23 +00:00
clone_folder: c:\gopath\src\github.com\prometheus-community\windows_exporter
install:
2019-10-19 14:50:13 +00:00
- mkdir %GOPATH%\bin
- set PATH=%GOPATH%\bin;%PATH%
- set PATH=%PATH%;C:\msys64\mingw64\bin
- choco install gitversion.portable make -y
2019-10-19 14:50:13 +00:00
- ps: |
appveyor DownloadFile https://github.com/golangci/golangci-lint/releases/download/v1.21.0/golangci-lint-1.21.0-windows-amd64.zip
Expand-Archive golangci-lint-1.21.0-windows-amd64.zip
Move-Item golangci-lint-1.21.0-windows-amd64\golangci-lint-1.21.0-windows-amd64\golangci-lint.exe $env:GOPATH\bin\golangci-lint.exe
- ps: |
$env:GO111MODULE="off"
go get -u github.com/prometheus/promu
go get -u github.com/josephspurrier/goversioninfo/cmd/goversioninfo
2019-10-19 14:50:13 +00:00
$env:GO111MODULE="on"
test_script:
- make test
2018-10-02 07:25:01 +00:00
after_test:
- make lint
- make e2e-test
2018-10-02 07:25:01 +00:00
build_script:
- ps: |
2019-10-19 14:50:13 +00:00
# go mod download (or, if we don't call it, go build) will write every dependent package name to
# stderr, which will be interpreted as an error and abort the build if ErrorActionPreference is Stop,
# so we need to run it before setting the preference.
go mod download
$ErrorActionPreference = "Stop"
gitversion /output json /showvariable FullSemVer | Set-Content VERSION -PassThru
$Version = Get-Content VERSION
# Windows versioninfo resources need the file version by parts (but product version is free text)
$VersionParts = ($Version -replace '^v?([0-9\.]+).*$','$1').Split(".")
goversioninfo.exe -ver-major $VersionParts[0] -ver-minor $VersionParts[1] -ver-patch $VersionParts[2] -product-version $Version -platform-specific
make crossbuild
# GH requires all files to have different names, so add version/arch to differentiate
foreach($Arch in "amd64","386") {
2020-05-24 18:42:23 +00:00
Rename-Item output\$Arch\windows_exporter.exe -NewName windows_exporter-$Version-$Arch.exe
}
after_build:
- ps: |
# Build installer packages only on tagged releases
if($env:APPVEYOR_REPO_TAG -ne "True") {
return
}
$ErrorActionPreference = "Stop"
2019-05-25 12:43:36 +00:00
$BuildVersion = Get-Content VERSION
# The MSI version is not semver compliant, so just take the numerical parts
2019-05-25 12:43:36 +00:00
$MSIVersion = $env:APPVEYOR_REPO_TAG_NAME -replace '^v?([0-9\.]+).*$','$1'
foreach($Arch in "amd64","386") {
2020-05-24 18:42:23 +00:00
Write-Verbose "Building windows_exporter $MSIVersion msi for $Arch"
.\installer\build.ps1 -PathToExecutable .\output\$Arch\windows_exporter-$BuildVersion-$Arch.exe -Version $MSIVersion -Arch "$Arch"
Move-Item installer\Output\windows_exporter-$MSIVersion-$Arch.msi output\$Arch\
}
- promu checksum output\
artifacts:
- name: Artifacts
path: output\**\*
deploy:
- provider: GitHub
2020-05-24 18:42:23 +00:00
description: windows_exporter version $(appveyor_build_version)
artifact: Artifacts
auth_token:
2020-06-02 13:17:56 +00:00
secure: 'hFR7Ymxt/Rb25p4BweFvMNhX03lHD9kXJXrRlC/KbThazHuLD5NTx2ibMI6LYRsr'
draft: false
prerelease: false
on:
appveyor_repo_tag: true