forked from YACReader/yacreader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
183 lines (179 loc) · 7.37 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
# aka.ms/yaml
trigger:
- master
- develop
variables:
is_original_repo: ${{ and(eq(variables['System.TeamFoundationCollectionUri'], 'https://dev.azure.com/luisangelsm/'), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.SourceBranch'], 'refs/heads/develop'))) }}
is_fork: ${{ not(and(eq(variables['System.TeamFoundationCollectionUri'], 'https://dev.azure.com/luisangelsm/'), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.SourceBranch'], 'refs/heads/develop')))) }}
jobs:
- job: Initialization
pool:
vmImage: 'vs2017-win2016'
steps:
- template: azure-pipelines-build-number.yml
- job: CodeFormatValidation
dependsOn: Initialization
pool:
vmImage: 'macOS-10.15'
steps:
- script: |
brew install clang-format
displayName: 'Install dependencies'
- script: |
cd $(Build.SourcesDirectory)
find . \( -name '*.h' -or -name '*.cpp' -or -name '*.c' -or -name '*.mm' -or -name '*.m' \) -print0 | xargs -0 clang-format -style=file -i
git diff $(Build.SourceVersion)
if [ "$(git diff $(Build.SourceVersion))" != "" ]; then exit 1; fi
displayName: 'clang-format'
- job: Linux
dependsOn: CodeFormatValidation
pool:
vmImage: 'ubuntu-16.04'
steps:
- script: |
sudo add-apt-repository 'deb http://download.opensuse.org/repositories/home:/selmf/xUbuntu_16.04/ /'
sudo add-apt-repository ppa:kubuntu-ppa/backports
sudo apt-get update
sudo apt-get install -y --allow-unauthenticated qt-default qt5-qmake \
qtbase5-dev qtmultimedia5-dev libpoppler-qt5-dev qtscript5-dev \
libqt5opengl5-dev libglu1-mesa-dev libunarr-dev qtdeclarative5-dev
displayName: 'Install dependencies'
- script: |
cd $(Build.SourcesDirectory)
VERSION="$(cat common/yacreader_global.h | grep '#define VERSION "' | tr -d '#define VERSION' | tr -d '"' )"
./mktarball.sh $VERSION.$(Build.BuildNumber)
mkdir tarball
cp yacreader-*-src.tar.xz* tarball\
displayName: 'Create tarball'
- script: |
export DEFINES_VAR=DEFINES+\=\"BUILD_NUMBER=\\\\\\\"$(Build.BuildNumber)\\\\\\\"\"
qmake CONFIG+="unarr" $DEFINES_VAR
make
displayName: 'Build'
- task: CopyFiles@2
inputs:
sourceFolder: $(Build.SourcesDirectory)/tarball
contents: '*'
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishPipelineArtifact@1
inputs:
path: $(Build.ArtifactStagingDirectory)
artifactName: src $(Build.BuildNumber) tarball
- job: MacOS
dependsOn: CodeFormatValidation
variables:
- ${{ if and(eq(variables['System.TeamFoundationCollectionUri'], 'https://dev.azure.com/luisangelsm/'), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.SourceBranch'], 'refs/heads/develop'))) }}:
- group: macos-codesign
pool:
vmImage: 'macOS-10.15'
steps:
- script: |
brew install qt
brew link qt --force
brew install create-dmg
brew install node
brew link --overwrite node
npm install -g appdmg
wget "https://sourceforge.net/projects/p7zip/files/p7zip/16.02/p7zip_16.02_src_all.tar.bz2" -P $(Build.SourcesDirectory)/compressed_archive
tar xjf $(Build.SourcesDirectory)/compressed_archive/p7zip_16.02_src_all.tar.bz2 -C $(Build.SourcesDirectory)/compressed_archive
mv $(Build.SourcesDirectory)/compressed_archive/p7zip_16.02 $(Build.SourcesDirectory)/compressed_archive/libp7zip
displayName: 'Install dependencies'
- ${{ if and(eq(variables['System.TeamFoundationCollectionUri'], 'https://dev.azure.com/luisangelsm/'), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.SourceBranch'], 'refs/heads/develop'))) }}:
- task: InstallAppleCertificate@2
inputs:
certSecureFile: 'developerID_application.p12'
certPwd: $(P12Password)
- script: |
cd $(Build.SourcesDirectory)
VERSION="$(cat common/yacreader_global.h | grep '#define VERSION "' | tr -d '#define VERSION' | tr -d '"' )"
echo "Trying to know if we are in a forked repo: $IS_FORK"
SKIP_CODESIGN="$(tr [A-Z] [a-z] <<< "$IS_FORK")"
./compileOSX.sh $VERSION $(Build.BuildNumber) $SKIP_CODESIGN
displayName: 'Build'
- task: CopyFiles@2
inputs:
contents: '*.dmg'
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishPipelineArtifact@1
inputs:
path: $(Build.ArtifactStagingDirectory)
artifactName: Macos $(Build.BuildNumber) dmg
- template: azure-pipelines-windows-template.yml
parameters:
name: Windows_x64
architecture: 'x64'
qt_version: '5.12.6'
qt_spec: 'msvc2017_64'
qt_aqt_spec: 'win64_msvc2017_64'
vc_redist_url: 'https://go.microsoft.com/fwlink/?LinkId=746572'
vc_redist_file_name: 'vc_redist.x64.exe'
vc_vars: 'vcvars64.bat'
- template: azure-pipelines-windows-template.yml
parameters:
name: Windows_x86
architecture: 'x86'
qt_version: '5.12.6'
qt_spec: 'msvc2017'
qt_aqt_spec: 'win32_msvc2017'
vc_redist_url: 'https://go.microsoft.com/fwlink/?LinkId=746571'
vc_redist_file_name: 'vc_redist.x86.exe'
vc_vars: 'vcvars32.bat'
- ${{ if and(eq(variables['System.TeamFoundationCollectionUri'], 'https://dev.azure.com/luisangelsm/'), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.SourceBranch'], 'refs/heads/develop'))) }}:
- job: PublishDevBuilds
dependsOn:
- Linux
- MacOS
- Windows_x86
- Windows_x64
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop'), true)
variables:
- group: bintray
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
targetPath: $(Build.SourcesDirectory)/dev_bin
- script: |
ls -lah $(Build.SourcesDirectory)/dev_bin/**/*.*
- task: cURLUploader@2
inputs:
files: '$(Build.SourcesDirectory)/dev_bin/**/*.*'
authType: 'userAndPass'
username: $(username)
password: $(api-key)
options: -H "X-Bintray-Publish:1"
remotePath: ''
url: https://api.bintray.com/content/luisangelsm/YACReader/DevBuilds/$(Build.BuildNumber)/
- ${{ if and(eq(variables['System.TeamFoundationCollectionUri'], 'https://dev.azure.com/luisangelsm/'), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.SourceBranch'], 'refs/heads/develop'))) }}:
- job: Release
dependsOn:
- Linux
- MacOS
- Windows_x86
- Windows_x64
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
variables:
- group: github-releases
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
targetPath: $(Build.ArtifactStagingDirectory)
- script: |
find $(Build.ArtifactStagingDirectory) -name '*.*' -exec cp {} $(Build.ArtifactStagingDirectory) \;
displayName: 'flatten artifact staging directory'
- script: |
VERSION="$(cat common/yacreader_global.h | grep '#define VERSION "' | tr -d '#define VERSION' | tr -d '"' )"
echo "##vso[task.setvariable variable=VERSION]$VERSION"
displayName: 'Version'
- task: GitHubRelease@0
inputs:
gitHubConnection: yacreader-releases
title: $(VERSION)
tagSource: 'manual'
tag: $(VERSION)
addChangeLog: false