Merge pull request #129 from YACReader/feature/azure-update

Update azure pipelines to work on forked repos
This commit is contained in:
Luis Ángel San Martín 2020-04-09 20:22:23 +02:00 committed by GitHub
commit 5688303999
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 72 additions and 61 deletions

View File

@ -17,7 +17,7 @@ jobs:
- script: |
pip install aqtinstall
mkdir C:\Qt
python -m aqt install -O c:\Qt ${{ parameters.qt_version }} windows desktop ${{ parameters.qt_aqt_spec }}
python -m aqt install -O c:\Qt ${{ parameters.qt_version }} windows desktop ${{ parameters.qt_aqt_spec }} -m qtscript
dir C:\Qt\${{ parameters.qt_version }}\${{ parameters.qt_spec }}\bin
choco install -y wget
choco install innosetup

View File

@ -3,6 +3,10 @@ trigger:
- master
- develop
variables:
is_original_repo: ${{ eq(variables['System.TeamFoundationCollectionUri'], 'https://dev.azure.com/luisangelsm/') }}
is_fork: ${{ not(eq(variables['System.TeamFoundationCollectionUri'], 'https://dev.azure.com/luisangelsm/')) }}
jobs:
- job: Initialization
pool:
@ -12,7 +16,7 @@ jobs:
- job: CodeFormatValidation
dependsOn: Initialization
pool:
vmImage: 'macOS-10.14'
vmImage: 'macOS-10.15'
steps:
- script: |
brew install clang-format
@ -59,9 +63,10 @@ jobs:
- job: MacOS
dependsOn: CodeFormatValidation
variables:
- group: macos-codesign
- ${{ if eq(variables['System.TeamFoundationCollectionUri'], 'https://dev.azure.com/luisangelsm/') }}:
- group: macos-codesign
pool:
vmImage: 'macOS-10.14'
vmImage: 'macOS-10.15'
steps:
- script: |
brew install qt
@ -74,14 +79,16 @@ jobs:
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'
- task: InstallAppleCertificate@2
inputs:
certSecureFile: 'developerID_application.p12'
certPwd: $(P12Password)
- ${{ if eq(variables['System.TeamFoundationCollectionUri'], 'https://dev.azure.com/luisangelsm/') }}:
- 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 '"' )"
SKIP_CODESIGN="$(tr [A-Z] [a-z] <<< "$(System.PullRequest.IsFork)")"
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
@ -112,60 +119,64 @@ jobs:
vc_redist_url: 'https://go.microsoft.com/fwlink/?LinkId=746571'
vc_redist_file_name: 'vc_redist.x86.exe'
vc_vars: 'vcvars32.bat'
- job: PublishDevBuilds
dependsOn:
- Linux
- MacOS
- Windows_x86
- Windows_x64
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop'))
variables:
- group: bintray
pool:
vmImage: 'ubuntu-16.04'
steps:
- ${{ if eq(variables['System.TeamFoundationCollectionUri'], 'https://dev.azure.com/luisangelsm/') }}:
- 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 eq(variables['System.TeamFoundationCollectionUri'], 'https://dev.azure.com/luisangelsm/') }}:
- 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.SourcesDirectory)/dev_bin
targetPath: $(Build.ArtifactStagingDirectory)
- script: |
ls -lah $(Build.SourcesDirectory)/dev_bin/**/*.*
- task: cURLUploader@2
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:
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)/
- 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
gitHubConnection: yacreader-releases
title: $(VERSION)
tagSource: 'manual'
tag: $(VERSION)
addChangeLog: false