forked from cmangos/mangos-wotlk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
116 lines (101 loc) · 6.46 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
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
112
113
114
115
116
# Specify version format
version: "0.18.{build}"
# Operating system (build VM template)
os: Visual Studio 2015
# build platform, i.e. Win32 (instead of x86), x64, Any CPU. This setting is optional.
platform:
- x64
# specify custom environment variables
environment:
MSVC_DEFAULT_OPTIONS: ON
BOOST_ROOT: C:\Libraries\boost_1_59_0
BOOST_LIBRARYDIR_WIN32: C:\Libraries\boost_1_59_0\lib32-msvc-14.0
BOOST_LIBRARYDIR_WIN64: C:\Libraries\boost_1_59_0\lib64-msvc-14.0
SNAPSHOT_TAG: "Last_$(APPVEYOR_PROJECT_NAME)_PreBuild"
SEC_ACCESS_TOKEN:
secure: GXsXxwHSSt1y+ae3C6A0csN+dCQxPW8w98SGwl8cqzqPDhKKbvFJ37eJCCDeNIm2
# build configuration, i.e. Debug, Release, etc.
configuration:
- Release
# scripts that are called at very beginning, before repo cloning
init:
# This script will delete already existing tag with its release when it already exist.
# This should be done to correctly update tag details and to avoid mixed release under same tag (if one fail).
# The principle is to delete the tag and release whenever we found it and the commit hash is different than current.
# Do not modify this script for security reason
- ps: >-
function Delete-Github-Release($gitHubRepository, $releaseVersion, $commitHash, $token){
$baseReleaseUrl = "https://api.github.com/repos/$gitHubRepository/releases";
$ref_endpoint = "https://api.github.com/repos/$gitHubRepository/git/refs/tags"
$getReleaseId = @{Uri = "$baseReleaseUrl" + "?access_token=$token"; Method = "GET";}
$wr_error = 'True'; try {$result = Invoke-WebRequest @getReleaseId;} catch {$wr_error = 'False';}
if ($result.StatusCode -ne 200 -or $wr_error -eq 'False') {Write-Host "No release found so nothing to delete." -f Yellow; return;}
$releasesData = ConvertFrom-Json $result.Content; $releaseInfos = $null;
if ($releasesData -is [system.array] -and $releasesData.Count -ge "1") {foreach ($releaseItr in $releasesData) {if ($releaseItr.name -eq $releaseVersion) { $releaseInfos = $releaseItr; break;}}}
if ($releaseInfos -eq $null) {Write-Host "Release $releaseVersion is not found, nothing to delete." -f Yellow; return;}
if ($releaseInfos.target_commitish -ne $commitHash){
$id = $releaseInfos.id; $delBaseReleaseUrl = "$baseReleaseUrl/$id" + "?access_token=$token"
Write-Host "Deleting release $releaseVersion..." -f Yellow;
$delReleaseParams = @{Uri = $delBaseReleaseUrl; Method = "DELETE";}
$wr_error = 'True'; try { $delRelResult = Invoke-WebRequest @delReleaseParams; } catch { $wr_error = 'False'; }
if ($wr_error -eq 'False' -or $delRelResult.StatusCode -eq 204) {Write-Host "$releaseVersion release is deleted" -f Green;} else {Write-Host "ERROR cannot delete $releaseVersion" -f Red;}
Write-Host "Deleting release tag $releaseVersion..." -f Yellow;
$delTagBaseUrl = "$ref_endpoint/$releaseVersion" + "?access_token=$token";
$delTagParams = @{Uri = $delTagBaseUrl; Method = "DELETE";}
$wr_error = 'True'; try {$delTagResult = Invoke-WebRequest @delTagParams;} catch {$wr_error = 'False';}
if ($wr_error -eq 'False' -or $delTagResult.StatusCode -eq 204) {Write-Host "$releaseVersion tag is deleted" -f Green;} else {Write-Host "ERROR cannot delete $releaseVersion" -f Red;}}
else {Write-Host "Skipping tag delete because its same commit!" -f Yellow;}}
# clone directory
clone_folder: C:\projects\cmangos
# branches to build
branches:
# whitelist
only:
- master
# Do not build on tags (GitHub only)
skip_tags: true
# scripts to run before build
before_build:
- cmd: if "%platform%"=="Win32" set BOOST_LIBRARYDIR="%BOOST_LIBRARYDIR_WIN32%"
- cmd: if "%platform%"=="x64" set BOOST_LIBRARYDIR="%BOOST_LIBRARYDIR_WIN64%"
# build script
build_script:
- ps: |
$destinationFolder = "$env:APPVEYOR_BUILD_FOLDER\bin\extractors"
$sourceFolder = "$env:APPVEYOR_BUILD_FOLDER\contrib\"
Write-Host "Building main $env:APPVEYOR_PROJECT_NAME project ..." -f Yellow
msbuild "$env:APPVEYOR_BUILD_FOLDER\win\mangosdVC140.sln" /m /verbosity:quiet /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
Write-Host "Building extractors ..." -f Yellow;
msbuild "$sourceFolder\extractor\VC140_AD.sln" /verbosity:quiet /p:Configuration="Release" /p:Platform="Win32" /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
msbuild "$sourceFolder\mmap\win\MoveMapGen_VC140.sln" /verbosity:quiet /p:Configuration="Release" /p:Platform="Win32" /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
msbuild "$sourceFolder\vmap_assembler\vmap_assemblerVC140.sln" /verbosity:quiet /p:Configuration="Release" /p:Platform="Win32" /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
msbuild "$sourceFolder\vmap_extractor\win\vmapExtractor_VC140.sln" /verbosity:quiet /p:Configuration="Release" /p:Platform="Win32" /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
Write-Host "Copying successfuly builded extractors binaries ..." -f Yellow
mkdir -p "$destinationFolder"
cp "$sourceFolder\extractor\*.exe" "$destinationFolder"
cp "$sourceFolder\mmap\bin\Win32_Release\*.exe" "$destinationFolder"
cp "$sourceFolder\vmap_assembler\bin\Win32_Release\*.exe" "$destinationFolder"
cp "$sourceFolder\vmap_extractor\bin\Win32_Release\*.exe" "$destinationFolder"
cp "$sourceFolder\extractor_scripts\*" "$destinationFolder"
# unit test
test: off
artifacts:
- path: bin\$(platform)_$(configuration)
name: $(APPVEYOR_PROJECT_NAME)_$(platform)_$(configuration)
- path: bin\extractors
name: Extractors
# scripts to run before deployment
before_deploy:
ps: Delete-Github-Release $env:APPVEYOR_REPO_NAME $env:SNAPSHOT_TAG $env:APPVEYOR_REPO_COMMIT "$env:SEC_ACCESS_TOKEN"
# deploy settings
deploy:
- provider: GitHub
auth_token: $(SEC_ACCESS_TOKEN)
release: $(SNAPSHOT_TAG) # name of the tag used
description: 'Binaries of commit $(APPVEYOR_REPO_COMMIT) \n$(APPVEYOR_REPO_COMMIT_MESSAGE) \nSnapshot v$(APPVEYOR_BUILD_VERSION)'
artifact: $(APPVEYOR_PROJECT_NAME)_$(platform)_$(configuration), Extractors
draft: false
prerelease: true
on:
branch: master # release from master branch only
appveyor_repo_tag: false # deploy on tag push only