Skip to content

Commit 55747ed

Browse files
committed
Rewrite the Appveyor build pipeline
- Backup the original appveyor.yml as appveyor.yml.obsolete - Fetch an official appveyor sample file as reference - Create a test scope appveyor pipeline
1 parent cd4595a commit 55747ed

File tree

3 files changed

+693
-22
lines changed

3 files changed

+693
-22
lines changed

appveyor.yml

+186-22
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,186 @@
1-
version: 1.0.{build}
2-
image: Visual Studio 2017
3-
environment:
4-
matrix:
5-
- platform: x86
6-
configuration: Debug
7-
- platform: x86
8-
configuration: Release
9-
matrix:
10-
fast_finish: false
11-
nuget:
12-
project_feed: true
13-
before_build:
14-
- cmd: nuget restore
15-
build:
16-
parallel: true
17-
verbosity: normal
18-
artifacts:
19-
- path: shadowsocks-csharp\bin\x86\Release\Shadowsocks.exe
20-
name: Shadowsocks-release.exe
21-
- path: shadowsocks-csharp\bin\x86\Debug\Shadowsocks.exe
22-
name: Shadowsocks-debug.exe
1+
2+
# Notes:
3+
# - Minimal appveyor.yml file is an empty file. All sections are optional.
4+
# - Indent each level of configuration with 2 spaces. Do not use tabs!
5+
# - All section names are case-sensitive.
6+
# - Section names should be unique on each level.
7+
8+
#---------------------------------#
9+
# general configuration #
10+
#---------------------------------#
11+
12+
# version format
13+
# Build version format is taken from UI if it is not set
14+
# version: 1.0.{build}
15+
16+
# # branches to build
17+
# branches:
18+
# # whitelist
19+
# only:
20+
# - master
21+
# - production
22+
23+
# # blacklist
24+
# except:
25+
# - gh-pages
26+
27+
28+
#---------------------------------#
29+
# environment configuration #
30+
#---------------------------------#
31+
32+
# Build worker image (VM template)
33+
image: Visual Studio 2017
34+
35+
# scripts that are called at very beginning, before repo cloning
36+
# init:
37+
# - git config --global core.autocrlf false
38+
39+
40+
# set clone depth
41+
clone_depth: 5 # clone entire repository history if not defined
42+
43+
44+
# environment variables
45+
environment:
46+
# my_var1: value1
47+
# # this is how to set encrypted variable. Go to "Settings" -> "Encrypt YAML" page in account menu to encrypt data.
48+
# my_secure_var1:
49+
# secure: FW3tJ3fMncxvs58/ifSP7w==
50+
matrix:
51+
- platform: x86
52+
configuration: Debug
53+
- platform: x86
54+
configuration: Release
55+
56+
# this is how to allow failing jobs in the matrix
57+
matrix:
58+
fast_finish: false # set this flag to immediately finish build once one of the jobs fails.
59+
60+
# build cache to preserve files/folders between builds
61+
cache:
62+
- packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified
63+
# - '%LocalAppData%\NuGet\Cache' # NuGet < v3
64+
- '%LocalAppData%\NuGet\v3-cache' # NuGet v3
65+
66+
67+
# Automatically register private account and/or project AppVeyor NuGet feeds.
68+
# nuget:
69+
# account_feed: true
70+
# project_feed: true
71+
# disable_publish_on_pr: true # disable publishing of .nupkg artifacts to account/project feeds for pull request builds
72+
# publish_wap_octopus: true # disable publishing of Octopus Deploy .nupkg artifacts to account/project feeds
73+
74+
#---------------------------------#
75+
# build configuration #
76+
#---------------------------------#
77+
78+
# Build settings, not to be confused with "before_build" and "after_build".
79+
# "project" is relative to the original build directory and not influenced by directory changes in "before_build".
80+
build:
81+
# parallel: true # enable MSBuild parallel builds
82+
# publish_nuget: true # package projects with .nuspec files and push to artifacts
83+
# publish_nuget_symbols: true # generate and publish NuGet symbol packages
84+
# include_nuget_references: true # add -IncludeReferencedProjects option while packaging NuGet artifacts
85+
86+
# MSBuild verbosity level
87+
verbosity: normal # quiet|minimal|normal|detailed
88+
89+
90+
# scripts to run before build
91+
before_build:
92+
- cmd: nuget restore
93+
94+
# to run your custom scripts instead of automatic MSBuild
95+
# build_script:
96+
97+
# scripts to run after build (working directory and environment changes are persisted from the previous steps)
98+
after_build:
99+
ps: |
100+
function CalculateHash($file)
101+
{
102+
$newLine = "`r`n"
103+
$text = (Split-Path $file -Leaf) + $newLine
104+
$text += 'MD5' + $newLine
105+
$text += (Get-FileHash $file -Algorithm MD5).Hash + $newLine
106+
$text += 'SHA-1' + $newLine
107+
$text += (Get-FileHash $file -Algorithm SHA1).Hash + $newLine
108+
$text += 'SHA-256' + $newLine
109+
$text += (Get-FileHash $file -Algorithm SHA256).Hash + $newLine
110+
$text += 'SHA-512' + $newLine
111+
$text += (Get-FileHash $file -Algorithm SHA512).Hash
112+
return $text
113+
}
114+
115+
116+
$WorkingFolder = "$env:APPVEYOR_BUILD_FOLDER\working"
117+
$ExeFileName = "Shadowsocks-$env:APPVEYOR_BUILD_VERSION-$env:CONFIGURATION.exe"
118+
$ExeFile = "$WorkingFolder\$ExeFileName"
119+
$ExeHashFile = "$Exefile.hash"
120+
121+
New-Item $WorkingFolder -ItemType Directory -Force
122+
Copy-Item $env:APPVEYOR_BUILD_FOLDER\shadowsocks-csharp\bin\$env:PLATFORM\$env:CONFIGURATION\Shadowsocks.exe $WorkingFolder\Shadowsocks.exe
123+
Copy-Item $WorkingFolder\Shadowsocks.exe $ExeFile
124+
125+
CalculateHash -file $Exefile | Out-File -FilePath $ExeHashFile
126+
127+
Push-AppveyorArtifact $ExeFile
128+
Push-AppveyorArtifact $ExeHashFile
129+
130+
# Create and deploy the release zip
131+
if ($env:configuration -eq 'Release')
132+
{
133+
$ReleaseFile = "$WorkingFolder\Shadowsocks.exe"
134+
$HashFile = "$ReleaseFile.hash"
135+
$ZipFile = "$WorkingFolder\Shadowsocks-$env:APPVEYOR_BUILD_VERSION.zip"
136+
$ZipHashFile = "$ZipFile.hash"
137+
# Calculate exe Hash and archieve both exe and hash to zip
138+
CalculateHash -file $ReleaseFile | Out-File -FilePath $hashFile
139+
7z a $ZipFile $ReleaseFile
140+
7z a $ZipFile $HashFile
141+
Push-AppveyorArtifact $ZipFile
142+
# Calculate zip Hash
143+
CalculateHash -file $ZipFile | Out-File -FilePath $ZipHashFile
144+
Push-AppveyorArtifact $ZipHashFile
145+
}
146+
147+
# scripts to run *after* solution is built and *before* automatic packaging occurs (web apps, NuGet packages, Azure Cloud Services)
148+
# before_package:
149+
150+
# to disable automatic builds
151+
#build: off
152+
153+
154+
#---------------------------------#
155+
# deployment configuration #
156+
#---------------------------------#
157+
158+
# providers: Local, FTP, WebDeploy, AzureCS, AzureBlob, S3, NuGet, Environment
159+
# provider names are case-sensitive!
160+
deploy:
161+
162+
# Deploy to GitHub Releases
163+
- provider: GitHub
164+
auth_token:
165+
secure: ZrRlVe3eWp1ccIVZcmFrI7vaCxwz5ewIMSmaPUTjMGyC1rVRlYm7nWWi6Pzkpe0A
166+
description: '%APPVEYOR_BUILD_VERSION%'
167+
artifact: Shadowsocks-%APPVEYOR_BUILD_VERSION%.zip, Shadowsocks-%APPVEYOR_BUILD_VERSION%.zip.hash
168+
draft: true
169+
prerelease: true
170+
on:
171+
branch: master # release from master branch only
172+
configuration: Release
173+
APPVEYOR_REPO_TAG: true # deploy on tag push only
174+
175+
176+
# # scripts to run before deployment
177+
# before_deploy:
178+
179+
# # scripts to run after deployment
180+
# after_deploy:
181+
182+
# # to run your custom scripts instead of provider deployments
183+
# deploy_script:
184+
185+
# # to disable deployment
186+
#deploy: off

appveyor.yml.obsolete

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Created by wongsyrone
2+
3+
version: 1.0.{build}
4+
image: Visual Studio 2017
5+
environment:
6+
matrix:
7+
- platform: x86
8+
configuration: Debug
9+
- platform: x86
10+
configuration: Release
11+
matrix:
12+
fast_finish: false
13+
nuget:
14+
project_feed: true
15+
before_build:
16+
- cmd: nuget restore
17+
build:
18+
parallel: true
19+
verbosity: normal
20+
artifacts:
21+
- path: shadowsocks-csharp\bin\x86\Release\Shadowsocks.exe
22+
name: Shadowsocks-release.exe
23+
- path: shadowsocks-csharp\bin\x86\Debug\Shadowsocks.exe
24+
name: Shadowsocks-debug.exe

0 commit comments

Comments
 (0)