-
Notifications
You must be signed in to change notification settings - Fork 56
/
azure-pipelines.yml
101 lines (94 loc) · 3.68 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
# https://docs.microsoft.com/azure/devops/pipelines/languages/java
trigger:
branches:
include:
- master
- releases/*
- feature/*
exclude:
- releases/old*
- feature/*-working
paths:
exclude:
- docs/*.md
pr:
- master
- release/*
resources:
- repo: self
variables:
tag: '$(Build.BuildId)'
stages:
- stage: Build
displayName: Build image
jobs:
- job: Build
displayName: Build
pool:
vmImage: ubuntu-latest
steps:
- task: JavaToolInstaller@0
inputs:
versionSpec: '21'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'
# see: https://stackoverflow.com/questions/43587635/dpkg-error-processing-package-oracle-java8-installer-configure
# - script: |
# whoami
# sudo /bin/mkdir -p /builds/binaries/externals
# sudo chmod a+rx -R /builds
# sudo chmod a+w /builds
# sudo chmod a+w /builds/binaries/externals
# curl -o /tmp/OpenJDK17-jdk_x64_linux_hotspot_17_35.tar.gz -L https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17%2B35/OpenJDK17-jdk_x64_linux_hotspot_17_35.tar.gz \
# && sudo mv /tmp/OpenJDK17-jdk_x64_linux_hotspot_17_35.tar.gz /builds/ \
# && true
# ls -Ral /builds
# displayName: "Download Eclipse Temurin OpenJDK 17"
# - task: JavaToolInstaller@0
# inputs:
# versionSpec: '17'
# jdkArchitectureOption: x64
# jdkSourceOption: LocalDirectory
# jdkFile: "/builds/OpenJDK17-jdk_x64_linux_hotspot_17_35.tar.gz"
# jdkDestinationDirectory: "/builds/binaries/externals"
# cleanDestinationDirectory: true
- script: |
echo Starting the build
mvn -B -q package -DskipTests
displayName: 'Build with Maven'
- task: DockerCompose@0
displayName: "Starting Database"
inputs:
dockerComposeFile: "./docker-compose.yml"
action: Run services
# serviceName: "mongodb"
- script: |
sleep 10
docker ps -a
displayName: "Display Docker Services"
- script: |
mvn -B -q clean verify -Pcoverage
displayName: 'Running Tests'
# Publish code coverage results
# Publish Cobertura or JaCoCo code coverage results from a build
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'JaCoCo' # Available options: 'JaCoCo', 'Cobertura'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/target/site/jacoco/jacoco.xml'
#pathToSources: # Optional
reportDirectory: '$(System.DefaultWorkingDirectory)/target/site/jacoco/'
additionalCodeCoverageFiles: '$(System.DefaultWorkingDirectory)/target/**/jacoco.exec' # Optional
#failIfCoverageEmpty: false # Optional
# Publish Test Results
# Publish test results to Azure Pipelines
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit, cTest
testResultsFiles: '**/TEST-*.xml'
searchFolder: '$(System.DefaultWorkingDirectory)/target' # Optional
#mergeTestResults: false # Optional
#failTaskOnFailedTests: false # Optional
#testRunTitle: # Optional
#buildPlatform: # Optional
#buildConfiguration: # Optional
#publishRunAttachments: true # Optional