azure-pipelines.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. trigger:
  2. batch: true
  3. branches:
  4. include:
  5. - master
  6. - dev*
  7. - refs/tags/*
  8. pr:
  9. - master
  10. - dev*
  11. jobs:
  12. - template: azure-pipelines.template.yml
  13. parameters:
  14. name: linux
  15. vmImage: 'ubuntu-latest'
  16. - template: azure-pipelines.template.yml
  17. parameters:
  18. name: windows
  19. vmImage: 'windows-latest'
  20. - template: azure-pipelines.template.yml
  21. parameters:
  22. name: macos
  23. vmImage: 'macOS-latest'
  24. - job: linux_coverage
  25. dependsOn: linux
  26. condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
  27. timeoutInMinutes: 30
  28. pool:
  29. vmImage: 'ubuntu-latest'
  30. #variables:
  31. # CODECOV_TOKEN: '$(coverage.token)'
  32. steps:
  33. - checkout: self
  34. - task: GoTool@0
  35. inputs:
  36. version: '1.14.4'
  37. - script: |
  38. bash ./testing/coverage/coverall
  39. workingDirectory: '$(Build.SourcesDirectory)'
  40. displayName: 'Coverage'
  41. - job: make_release
  42. dependsOn: linux
  43. condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
  44. timeoutInMinutes: 60
  45. pool:
  46. vmImage: 'ubuntu-latest'
  47. variables:
  48. - group: GithubToken
  49. - name: GOPATH
  50. value: '$(system.defaultWorkingDirectory)/gopath'
  51. - name: BAZEL_VER
  52. value: '0.23.0'
  53. steps:
  54. - checkout: self
  55. - task: GoTool@0
  56. inputs:
  57. version: '1.14.4'
  58. - script: |
  59. mkdir triggersrc
  60. ls -I "triggersrc" | xargs cp -rf -t triggersrc
  61. mkdir gopath
  62. displayName: Prepare Environment
  63. workingDirectory: '$(system.defaultWorkingDirectory)'
  64. - script: |
  65. sudo apt-get -y update
  66. sudo apt-get -y install jq git file pkg-config zip g++ zlib1g-dev unzip python openssl tree
  67. displayName: Apt Install
  68. - script: |
  69. go version
  70. unset GOPATH
  71. mkdir ./src
  72. mkdir ./src/v2ray.com
  73. ln -s $(pwd)/../triggersrc ./src/v2ray.com/core
  74. go get -v -t -d ./src/v2ray.com/core/...
  75. tree
  76. workingDirectory: '$(GOPATH)'
  77. displayName: 'Fetch sources'
  78. - script: |
  79. mkdir release
  80. cd src
  81. zip -9 -r ../release/src_all.zip * -x '*.git*'
  82. workingDirectory: '$(GOPATH)'
  83. displayName: 'Dump sources'
  84. - script: |
  85. curl -L -o bazel-installer.sh https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VER}/bazel-${BAZEL_VER}-installer-linux-x86_64.sh
  86. chmod +x bazel-installer.sh
  87. ./bazel-installer.sh --user
  88. workingDirectory: '$(GOPATH)'
  89. displayName: 'Install Bazel'
  90. - script: |
  91. cd ./src/v2ray.com/core
  92. ./release/updatedat.sh
  93. $HOME/bin/bazel build --action_env=GOPATH=$GOPATH --action_env=PATH=$PATH --action_env=GPG_PASS=${SIGN_KEY_PASS} --action_env=SPWD=$PWD --action_env=GOCACHE=$(go env GOCACHE) --spawn_strategy local //release:all
  94. workingDirectory: '$(GOPATH)'
  95. displayName: 'Build Binaries'
  96. - script: |
  97. cp ./src/v2ray.com/core/bazel-bin/release/*.zip ./release/
  98. workingDirectory: '$(GOPATH)'
  99. displayName: 'Dump Binaries'
  100. - script: |
  101. cd ./src/v2ray.com/core
  102. echo $RELEASE_TAG
  103. ./release/bleedingrelease.sh
  104. workingDirectory: '$(GOPATH)'
  105. displayName: 'Generate Bleeding Edge Release'
  106. env:
  107. GITHUB_TOKEN: $(GITHUB_TOKEN)
  108. PRERELEASE: true
  109. RELEASE_TAG: unstable-$(Build.SourceVersion)
  110. - script: |
  111. cd ./src/v2ray.com/core
  112. echo $RELEASE_TAG
  113. ./release/tagrelease.sh
  114. workingDirectory: '$(GOPATH)'
  115. displayName: 'Generate Tag Release'
  116. env:
  117. GITHUB_TOKEN: $(GITHUB_TOKEN)
  118. PRERELEASE: true
  119. RELEASE_TAG: unstable-$(Build.SourceVersion)
  120. TRIGGER_REASON: $(Build.SourceBranch)