You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

appveyor.yml 6.4 kB

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