This repository has been archived by the owner on Feb 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
222 lines (213 loc) · 9.23 KB
/
azure-pipelines.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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
variables:
- group: variables-haxe
- name: AZURE_PIPELINES_REPO_URL
value: $(Build.Repository.Uri)
- name: AZURE_PIPELINES_BRANCH
value: $(Build.SourceBranchName)
- name: NEKO_VERSION
value: "2.4.0"
trigger:
branches:
include:
- '*'
tags:
include:
- '*'
stages:
- stage: StageTest
jobs:
- template: extra/azure-pipelines/build-linux.yml
parameters:
name: LinuxStatic
linkType: static
- template: extra/azure-pipelines/build-linux.yml
parameters:
name: Linux
linkType: dynamic
- template: extra/azure-pipelines/build-linux.yml
parameters:
name: LinuxStaticArm64
linkType: static
arch: arm64
- template: extra/azure-pipelines/build-linux.yml
parameters:
name: LinuxArm64
linkType: dynamic
arch: arm64
- template: extra/azure-pipelines/build-mac.yml
parameters:
name: MacStatic
staticDeps: 'true'
- template: extra/azure-pipelines/build-mac.yml
parameters:
name: Mac
staticDeps: 'false'
- template: extra/azure-pipelines/build-windows.yml
parameters:
name: WinVS2017
vmImage: windows-2019
cmakeGenerator: Visual Studio 15 2017
arch: Win32
- template: extra/azure-pipelines/build-windows.yml
parameters:
name: WinVS2017x64
vmImage: windows-2019
cmakeGenerator: Visual Studio 15 2017 Win64
arch: x64
- template: extra/azure-pipelines/build-windows.yml
parameters:
name: WinVS2019
vmImage: windows-2019
cmakeGenerator: Visual Studio 16 2019
arch: Win32
- template: extra/azure-pipelines/build-windows.yml
parameters:
name: WinVS2019x64
vmImage: windows-2019
cmakeGenerator: Visual Studio 16 2019
arch: x64
- job: Chocolatey
dependsOn:
- WinVS2017
- WinVS2017x64
pool:
vmImage: windows-2019
steps:
- task: DownloadPipelineArtifact@0
inputs:
artifactName: WinVS2017Binaries
targetPath: WinVS2017Binaries
displayName: Download WinVS2017Binaries
- task: DownloadPipelineArtifact@0
inputs:
artifactName: WinVS2017x64Binaries
targetPath: WinVS2017x64Binaries
displayName: Download WinVS2017x64Binaries
- powershell: |
.\extra\chocolatey\generatePackage.ps1 $(NEKO_VERSION)
Get-ChildItem extra\chocolatey\out
displayName: Prepare Chocolatey Package
- powershell: |
$commitSha = git rev-parse --short HEAD
$commitTime = git show -s --format=%cI HEAD
$commitTime = $commitTime.substring(0,19) -replace '[^0-9]',''
$sourceBranch = '$(Build.SourceBranch)'
$chocoVersion = If ($sourceBranch.StartsWith('refs/tags/v')) {'$(NEKO_VERSION)'} Else {"$(NEKO_VERSION)-SNAP$commitTime"}
echo "##vso[task.setvariable variable=chocoVersion]$chocoVersion"
displayName: Format package version string
- powershell: choco pack --version $env:chocoVersion
workingDirectory: extra/chocolatey/out/
displayName: choco pack
- task: PublishPipelineArtifact@0
inputs:
artifactName: Chocolatey
targetPath: extra/chocolatey/out/
- stage: StageDeploy
condition: and(succeeded(), not(variables['System.PullRequest.PullRequestId']))
jobs:
- job: S3
condition: and(succeeded(), variables['HXBUILDS_AWS_ACCESS_KEY_ID'], variables['HXBUILDS_S3ADDR'])
pool:
vmImage: 'ubuntu-20.04'
steps:
- task: DownloadPipelineArtifact@0
inputs:
artifactName: LinuxStaticBinaries
targetPath: LinuxStaticBinaries
displayName: Download LinuxStaticBinaries
- task: DownloadPipelineArtifact@0
inputs:
artifactName: LinuxStaticArm64Binaries
targetPath: LinuxStaticArm64Binaries
displayName: Download LinuxStaticArm64Binaries
- task: DownloadPipelineArtifact@0
inputs:
artifactName: MacStaticBinaries
targetPath: MacStaticBinaries
displayName: Download MacStaticBinaries
- task: DownloadPipelineArtifact@0
inputs:
artifactName: WinVS2017Binaries
targetPath: WinVS2017Binaries
displayName: Download WinVS2017Binaries
- task: DownloadPipelineArtifact@0
inputs:
artifactName: WinVS2017x64Binaries
targetPath: WinVS2017x64Binaries
displayName: Download WinVS2017x64Binaries
- task: DownloadPipelineArtifact@0
inputs:
artifactName: Chocolatey
targetPath: Chocolatey
displayName: Download Chocolatey
- script: |
set -ex
sudo apt-get update -qqy
sudo apt-get install -qqy awscli
displayName: "Install awscli"
- script: |
set -ex
COMMIT_HASH=`git rev-parse HEAD`
COMMIT_HASH_SHORT=${COMMIT_HASH:0:7}
COMMIT_DATE=`TZ=UTC git show --quiet --date='format-local:%Y-%m-%d' --format="%cd"`
FILE_NAME=neko_${COMMIT_DATE}_$(Build.SourceBranchName)_${COMMIT_HASH_SHORT}
aws s3 cp LinuxStaticBinaries/neko-*.tar.gz $(HXBUILDS_S3ADDR)/neko/linux64/${FILE_NAME}.tar.gz
aws s3 cp LinuxStaticArm64Binaries/neko-*.tar.gz $(HXBUILDS_S3ADDR)/neko/linux-arm64/${FILE_NAME}.tar.gz
aws s3 cp MacStaticBinaries/neko-*.tar.gz $(HXBUILDS_S3ADDR)/neko/mac/${FILE_NAME}.tar.gz
aws s3 cp WinVS2017Binaries/neko-*.zip $(HXBUILDS_S3ADDR)/neko/windows/${FILE_NAME}.zip
aws s3 cp WinVS2017x64Binaries/neko-*.zip $(HXBUILDS_S3ADDR)/neko/windows64/${FILE_NAME}.zip
aws s3 cp Chocolatey/*.nupkg $(HXBUILDS_S3ADDR)/neko/windows64-choco/
env:
AWS_ACCESS_KEY_ID: $(HXBUILDS_AWS_ACCESS_KEY_ID)
AWS_SECRET_ACCESS_KEY: $(HXBUILDS_AWS_SECRET_ACCESS_KEY)
AWS_EC2_METADATA_DISABLED: true
displayName: Upload binaries
- script: |
set -ex
aws s3 cp LinuxStaticBinaries/neko-*.tar.gz $(HXBUILDS_S3ADDR)/neko/linux64/neko_latest.tar.gz
aws s3 cp LinuxStaticArm64Binaries/neko-*.tar.gz $(HXBUILDS_S3ADDR)/neko/linux-arm64/neko_latest.tar.gz
aws s3 cp MacStaticBinaries/neko-*.tar.gz $(HXBUILDS_S3ADDR)/neko/mac/neko_latest.tar.gz
aws s3 cp WinVS2017Binaries/neko-*.zip $(HXBUILDS_S3ADDR)/neko/windows/neko_latest.zip
aws s3 cp WinVS2017x64Binaries/neko-*.zip $(HXBUILDS_S3ADDR)/neko/windows64/neko_latest.zip
# Chocolatey packages have to be named with version number,
# so let's use web redirection to keep the original file name.
[[ "$HXBUILDS_S3ADDR" =~ s3://([^/]+)(.*) ]] && HXBUILDS_S3BUCKET="${BASH_REMATCH[1]}" && HXBUILDS_S3PATH="${BASH_REMATCH[2]}"
[[ `echo Chocolatey/*.nupkg` =~ Chocolatey/(.+) ]] && FILE_NAME="${BASH_REMATCH[1]}"
aws s3 cp $(HXBUILDS_S3ADDR)/neko/windows64-choco/${FILE_NAME} $(HXBUILDS_S3ADDR)/neko/windows64-choco/neko_latest.nupkg --acl public-read --website-redirect "${HXBUILDS_S3PATH}/neko/windows64-choco/${FILE_NAME}"
env:
AWS_ACCESS_KEY_ID: $(HXBUILDS_AWS_ACCESS_KEY_ID)
AWS_SECRET_ACCESS_KEY: $(HXBUILDS_AWS_SECRET_ACCESS_KEY)
AWS_EC2_METADATA_DISABLED: true
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'))
displayName: Update "latest"
- job: PPA
condition: and(succeeded(), variables['PPA'], variables['DEBFULLNAME'], variables['DEBEMAIL'])
pool:
vmImage: 'ubuntu-20.04'
steps:
- task: DownloadSecureFile@1
inputs:
secureFile: haxeci_sec.gpg
displayName: Download haxeci_sec.gpg
- task: DownloadSecureFile@1
inputs:
secureFile: haxeci_ssh
displayName: Download haxeci_ssh
- script: |
set -ex
chmod 600 $(Agent.TempDirectory)/haxeci_ssh
eval `ssh-agent -s`
ssh-add $(Agent.TempDirectory)/haxeci_ssh
gpg --allow-secret-key-import --import $(Agent.TempDirectory)/haxeci_sec.gpg
git config --global user.name "${DEBFULLNAME}"
git config --global user.email "${DEBEMAIL}"
displayName: Setup credentials
- script: |
set -ex
sudo apt-get update -qqy
sudo apt-get install -qqy ninja-build pkg-config libgtk-3-dev devscripts git-buildpackage ubuntu-dev-tools dh-make dh-apache2
displayName: Install devscripts
- script: cmake . -DSTATIC_DEPS=all
displayName: CMake
- script: make upload_to_ppa
displayName: Upload to PPA