2020-05-01 14:15:42 -04:00
|
|
|
trigger:
|
2020-05-28 09:31:52 -04:00
|
|
|
- master
|
|
|
|
- release
|
2020-05-02 10:00:03 -04:00
|
|
|
|
2020-05-28 09:31:52 -04:00
|
|
|
pr:
|
|
|
|
- master
|
|
|
|
- release
|
|
|
|
|
|
|
|
# Different users have different machine setups, we run the build three times, on ubuntu, osx, and windows
|
2020-05-02 10:00:03 -04:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
linux:
|
|
|
|
imageName: "ubuntu-16.04"
|
2020-06-02 15:53:24 -04:00
|
|
|
# mac:
|
|
|
|
# imageName: "macos-10.14"
|
|
|
|
# windows:
|
|
|
|
# imageName: "vs2017-win2016"
|
2020-05-02 10:00:03 -04:00
|
|
|
maxParallel: 3
|
2020-05-01 14:15:42 -04:00
|
|
|
|
|
|
|
pool:
|
2020-05-02 10:00:03 -04:00
|
|
|
vmImage: $(imageName)
|
|
|
|
|
|
|
|
variables:
|
|
|
|
currentImage: $(imageName)
|
2020-05-05 13:22:03 -04:00
|
|
|
codecov: $(CODECOV_TOKEN)
|
2020-05-28 09:31:52 -04:00
|
|
|
VERSION:
|
2020-05-01 14:15:42 -04:00
|
|
|
|
|
|
|
steps:
|
2020-05-28 09:31:52 -04:00
|
|
|
- bash: ls -la
|
|
|
|
- bash: pwd
|
|
|
|
# This task pulls the <version> value from the org.hl7.fhir.r5 project pom.xml file. All modules are released as
|
|
|
|
# the same version, at the same time, as defined in the root level pom.xml.
|
2020-05-02 10:00:03 -04:00
|
|
|
- task: PowerShell@2
|
|
|
|
inputs:
|
|
|
|
targetType: 'inline'
|
|
|
|
script: |
|
2020-05-28 09:31:52 -04:00
|
|
|
[xml]$pomXml = Get-Content -Path .\pom.xml
|
2020-05-02 10:00:03 -04:00
|
|
|
# version
|
|
|
|
Write-Host $pomXml.project.version
|
|
|
|
$version=$pomXml.project.version
|
|
|
|
Write-Host "##vso[task.setvariable variable=version]$version"
|
2020-05-05 13:54:14 -04:00
|
|
|
|
2020-05-28 09:31:52 -04:00
|
|
|
# Prints out the build version, for debugging purposes
|
|
|
|
- bash: echo Pulled version from pom.xml => $(version)
|
|
|
|
|
|
|
|
# Azure pipelines cannot pass variables between pipelines, but it can pass files, so we
|
|
|
|
# pass the build id (ex: 1.1.13-SNAPSHOT) as a string in a file.
|
|
|
|
# This is used in the release pipeline, so we create it here.
|
|
|
|
# This is only done for the release branch.
|
|
|
|
- bash: |
|
|
|
|
echo $(version)
|
|
|
|
VERSION=$(version)
|
|
|
|
echo "$VERSION" > $(System.DefaultWorkingDirectory)/VERSION
|
|
|
|
condition: and(eq(variables.currentImage, 'ubuntu-16.04'), eq(variables['Build.SourceBranch'], 'refs/heads/release'))
|
|
|
|
|
|
|
|
# Copies the VERSION file containing the build id (ex: 1.1.13-SNAPSHOT) to the staging directory
|
|
|
|
# This is done for release versions only.
|
|
|
|
- task: CopyFiles@2
|
|
|
|
condition: and(eq(variables.currentImage, 'ubuntu-16.04'), eq(variables['Build.SourceBranch'], 'refs/heads/release'))
|
|
|
|
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
|
|
|
|
inputs:
|
|
|
|
SourceFolder: '$(System.Defaultworkingdirectory)'
|
|
|
|
Contents: "$(System.DefaultWorkingDirectory)/VERSION"
|
|
|
|
TargetFolder: '$(build.artifactstagingdirectory)'
|
|
|
|
|
|
|
|
# Runs 'mvn clean package'
|
2020-05-02 10:00:03 -04:00
|
|
|
- task: Maven@3
|
|
|
|
inputs:
|
|
|
|
mavenPomFile: 'pom.xml'
|
|
|
|
mavenOptions: '-Xmx3072m'
|
|
|
|
javaHomeOption: 'JDKVersion'
|
|
|
|
jdkVersionOption: '1.8'
|
|
|
|
jdkArchitectureOption: 'x64'
|
|
|
|
publishJUnitResults: true
|
|
|
|
testResultsFiles: '**/surefire-reports/TEST-*.xml'
|
2020-05-04 12:44:46 -04:00
|
|
|
goals: 'clean package'
|
2020-05-02 10:00:03 -04:00
|
|
|
|
2020-05-28 09:31:52 -04:00
|
|
|
# Upload test results to codecov
|
2020-05-05 13:22:03 -04:00
|
|
|
- script: bash <(curl https://codecov.io/bash) -t $(codecov)
|
2020-05-28 09:31:52 -04:00
|
|
|
displayName: 'codecov Bash Uploader'
|
2020-06-02 14:55:51 -04:00
|
|
|
condition: and(eq(variables.currentImage, 'ubuntu-16.04'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
|
2020-05-28 09:31:52 -04:00
|
|
|
|
|
|
|
# Publishes the test results to build artifacts.
|
2020-05-05 11:44:57 -04:00
|
|
|
- task: PublishCodeCoverageResults@1
|
2020-05-28 09:31:52 -04:00
|
|
|
displayName: 'Publish JaCoCo test results '
|
2020-05-05 11:44:57 -04:00
|
|
|
inputs:
|
2020-05-05 12:47:00 -04:00
|
|
|
codeCoverageTool: 'JaCoCo'
|
2020-05-06 11:00:57 -04:00
|
|
|
summaryFileLocation: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.report/target/site/jacoco-aggregate/jacoco.xml'
|
|
|
|
reportDirectory: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.report/target/site/jacoco-aggregate/'
|
2020-06-02 14:55:51 -04:00
|
|
|
condition: and(eq(variables.currentImage, 'ubuntu-16.04'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
|
|
|
|
|
2020-05-28 09:31:52 -04:00
|
|
|
# Publishes the built Validator jar to build artifacts. Primarily for testing and debugging builds.
|
2020-05-05 13:54:51 -04:00
|
|
|
- task: PublishPipelineArtifact@1
|
2020-05-28 09:31:52 -04:00
|
|
|
displayName: 'Publish Validator jar'
|
|
|
|
condition: and(eq(variables.currentImage, 'ubuntu-16.04'), eq(variables['Build.SourceBranch'], 'refs/heads/release'))
|
2020-05-05 13:54:51 -04:00
|
|
|
inputs:
|
2020-05-05 14:14:16 -04:00
|
|
|
targetPath: "$(System.DefaultWorkingDirectory)/org.hl7.fhir.validation/target/org.hl7.fhir.validation-$(version).jar"
|
2020-05-06 11:00:57 -04:00
|
|
|
artifactName: Validator
|
2020-05-02 10:00:03 -04:00
|
|
|
|
2020-05-28 09:31:52 -04:00
|
|
|
# Publishes the files we've moved into the staging directory, so they can be accessed by the
|
|
|
|
# release pipeline. You will notice that we only do this for the ubuntu build, as doing it
|
|
|
|
# for each of the three release pipelines will cause conflicts.
|
|
|
|
# This is done for release versions only.
|
|
|
|
- task: PublishBuildArtifacts@1
|
|
|
|
condition: and(eq(variables.currentImage, 'ubuntu-16.04'), eq(variables['Build.SourceBranch'], 'refs/heads/release'))
|
|
|
|
displayName: 'Publish Build Artifacts'
|
|
|
|
inputs:
|
|
|
|
PathtoPublish: '$(build.artifactstagingdirectory)'
|
2020-05-02 10:00:03 -04:00
|
|
|
|