forked from shadowsocks/shadowsocks-windows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
186 lines (145 loc) · 6.28 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# Notes:
# - Minimal appveyor.yml file is an empty file. All sections are optional.
# - Indent each level of configuration with 2 spaces. Do not use tabs!
# - All section names are case-sensitive.
# - Section names should be unique on each level.
#---------------------------------#
# general configuration #
#---------------------------------#
# version format
# Build version format is taken from UI if it is not set
# version: 1.0.{build}
# # branches to build
# branches:
# # whitelist
# only:
# - master
# - production
# # blacklist
# except:
# - gh-pages
#---------------------------------#
# environment configuration #
#---------------------------------#
# Build worker image (VM template)
image: Visual Studio 2017
# scripts that are called at very beginning, before repo cloning
# init:
# - git config --global core.autocrlf false
# set clone depth
clone_depth: 5 # clone entire repository history if not defined
# environment variables
environment:
# my_var1: value1
# # this is how to set encrypted variable. Go to "Settings" -> "Encrypt YAML" page in account menu to encrypt data.
# my_secure_var1:
# secure: FW3tJ3fMncxvs58/ifSP7w==
matrix:
- platform: x86
configuration: Debug
- platform: x86
configuration: Release
# this is how to allow failing jobs in the matrix
matrix:
fast_finish: false # set this flag to immediately finish build once one of the jobs fails.
# build cache to preserve files/folders between builds
cache:
- packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified
# - '%LocalAppData%\NuGet\Cache' # NuGet < v3
- '%LocalAppData%\NuGet\v3-cache' # NuGet v3
# Automatically register private account and/or project AppVeyor NuGet feeds.
# nuget:
# account_feed: true
# project_feed: true
# disable_publish_on_pr: true # disable publishing of .nupkg artifacts to account/project feeds for pull request builds
# publish_wap_octopus: true # disable publishing of Octopus Deploy .nupkg artifacts to account/project feeds
#---------------------------------#
# build configuration #
#---------------------------------#
# Build settings, not to be confused with "before_build" and "after_build".
# "project" is relative to the original build directory and not influenced by directory changes in "before_build".
build:
# parallel: true # enable MSBuild parallel builds
# publish_nuget: true # package projects with .nuspec files and push to artifacts
# publish_nuget_symbols: true # generate and publish NuGet symbol packages
# include_nuget_references: true # add -IncludeReferencedProjects option while packaging NuGet artifacts
# MSBuild verbosity level
verbosity: normal # quiet|minimal|normal|detailed
# scripts to run before build
before_build:
- cmd: nuget restore
# to run your custom scripts instead of automatic MSBuild
# build_script:
# scripts to run after build (working directory and environment changes are persisted from the previous steps)
after_build:
ps: |
function CalculateHash($file)
{
$newLine = "`r`n"
$text = (Split-Path $file -Leaf) + $newLine
$text += 'MD5' + $newLine
$text += (Get-FileHash $file -Algorithm MD5).Hash + $newLine
$text += 'SHA-1' + $newLine
$text += (Get-FileHash $file -Algorithm SHA1).Hash + $newLine
$text += 'SHA-256' + $newLine
$text += (Get-FileHash $file -Algorithm SHA256).Hash + $newLine
$text += 'SHA-512' + $newLine
$text += (Get-FileHash $file -Algorithm SHA512).Hash
return $text
}
$WorkingFolder = "$env:APPVEYOR_BUILD_FOLDER\working"
$ExeFileName = "Shadowsocks-$env:APPVEYOR_BUILD_VERSION-$env:CONFIGURATION.exe"
$ExeFile = "$WorkingFolder\$ExeFileName"
$ExeHashFile = "$Exefile.hash"
New-Item $WorkingFolder -ItemType Directory -Force
Copy-Item $env:APPVEYOR_BUILD_FOLDER\shadowsocks-csharp\bin\$env:PLATFORM\$env:CONFIGURATION\Shadowsocks.exe $WorkingFolder\Shadowsocks.exe
Copy-Item $WorkingFolder\Shadowsocks.exe $ExeFile
CalculateHash -file $Exefile | Out-File -FilePath $ExeHashFile
Push-AppveyorArtifact $ExeFile
Push-AppveyorArtifact $ExeHashFile
# Create and deploy the release zip
if ($env:configuration -eq 'Release')
{
$ReleaseFile = "$WorkingFolder\Shadowsocks.exe"
$HashFile = "$ReleaseFile.hash"
$ZipFile = "$WorkingFolder\Shadowsocks-$env:APPVEYOR_BUILD_VERSION.zip"
$ZipHashFile = "$ZipFile.hash"
# Calculate exe Hash and archieve both exe and hash to zip
CalculateHash -file $ReleaseFile | Out-File -FilePath $hashFile
7z a $ZipFile $ReleaseFile
7z a $ZipFile $HashFile
Push-AppveyorArtifact $ZipFile
# Calculate zip Hash
CalculateHash -file $ZipFile | Out-File -FilePath $ZipHashFile
Push-AppveyorArtifact $ZipHashFile
}
# scripts to run *after* solution is built and *before* automatic packaging occurs (web apps, NuGet packages, Azure Cloud Services)
# before_package:
# to disable automatic builds
#build: off
#---------------------------------#
# deployment configuration #
#---------------------------------#
# providers: Local, FTP, WebDeploy, AzureCS, AzureBlob, S3, NuGet, Environment
# provider names are case-sensitive!
deploy:
# Deploy to GitHub Releases
- provider: GitHub
auth_token:
secure: ZrRlVe3eWp1ccIVZcmFrI7vaCxwz5ewIMSmaPUTjMGyC1rVRlYm7nWWi6Pzkpe0A
description: '%APPVEYOR_BUILD_VERSION%'
artifact: Shadowsocks-%APPVEYOR_BUILD_VERSION%.zip, Shadowsocks-%APPVEYOR_BUILD_VERSION%.zip.hash
draft: true
prerelease: true
on:
branch: master # release from master branch only
configuration: Release
APPVEYOR_REPO_TAG: true # deploy on tag push only
# # scripts to run before deployment
# before_deploy:
# # scripts to run after deployment
# after_deploy:
# # to run your custom scripts instead of provider deployments
# deploy_script:
# # to disable deployment
#deploy: off