-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
174 lines (159 loc) · 5.69 KB
/
azure-pipelines.yml
File metadata and controls
174 lines (159 loc) · 5.69 KB
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
#
# Copyright 2018-2020 INAOS GmbH, Thalwil
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
trigger:
- develop
- master
variables:
- group: github-packages
strategy:
matrix:
linux-debug:
imageName: 'ubuntu-latest'
BUILD_CONFIGURATION: Debug
linux-release:
imageName: 'ubuntu-latest'
BUILD_CONFIGURATION: RelWithDebInfo
mac-debug:
imageName: 'macOS-latest'
BUILD_CONFIGURATION: Debug
mac-release:
imageName: 'macOs-latest'
BUILD_CONFIGURATION: RelWithDebInfo
windows-vs19-debug:
imageName: 'windows-2019'
BUILD_CONFIGURATION: Debug
BUILD_ARCH: x86_64
VSINSTALL: "Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build"
MSVC_PLATFORM: amd64
windows-vs19-release:
imageName: 'windows-2019'
BUILD_CONFIGURATION: RelWithDebInfo
BUILD_ARCH: x86_64
VSINSTALL: "Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build"
MSVC_PLATFORM: amd64
windows-vs22-debug:
imageName: 'windows-2022'
BUILD_CONFIGURATION: Debug
BUILD_ARCH: x86_64
VSINSTALL: "Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build"
MSVC_PLATFORM: amd64
windows-vs22-release:
imageName: 'windows-2022'
BUILD_CONFIGURATION: RelWithDebInfo
BUILD_ARCH: x86_64
VSINSTALL: "Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build"
MSVC_PLATFORM: amd64
pool:
vmImage: $(imageName)
steps:
- powershell: gci env:* | sort-object name
- bash: |
mkdir -p $HOME/.inaos/cmake
mkdir -p $HOME/INAOS
echo "INAC_REPOSITORY_LOCAL=$HOME/INAOS" > $HOME/.inaos/cmake/repository.txt
echo "INAC_REPOSITORY_REMOTE=$github_packages_url" >> $HOME/.inaos/cmake/repository.txt
echo "INAC_REPOSITORY_USRPWD=$github_packages_username:$github_packages_pat" >> $HOME/.inaos/cmake/repository.txt
displayName: Setup
env:
github_packages_username: $(github_packages_username)
github_packages_pat: $(github_packages_pat)
github_packages_url: $(github_packages_url)
- bash: |
if [ "$AGENT_OS" != "Windows_NT" ]
then
mkdir cmake-build-$BUILD_CONFIGURATION
cd cmake-build-$BUILD_CONFIGURATION
cmake ../ -DCMAKE_BUILD_TYPE=$BUILD_CONFIGURATION
make -j
fi
displayName: Compile
env:
BUILD_CONFIGURATION: $(BUILD_CONFIGURATION)
- script: |
call "C:\%VSINSTALL%\vcvarsall.bat" %MSVC_PLATFORM%
mkdir cmake-build-%BUILD_CONFIGURATION%
cd cmake-build-%BUILD_CONFIGURATION%
cmake -G "NMake Makefiles" ../ -DCMAKE_BUILD_TYPE=%BUILD_CONFIGURATION% -DINAC_TARGET_ARCH=%BUILD_ARCH%
nmake
displayName: Compile
env:
BUILD_CONFIGURATION: $(BUILD_CONFIGURATION)
BUILD_ARCH: $(BUILD_ARCH)
condition:
eq( variables['Agent.OS'], 'Windows_NT' )
- bash: |
cd cmake-build-$BUILD_CONFIGURATION
if [ "$AGENT_OS" == "Darwin" ] && [ "$BUILD_CONFIGURATION" == "Debug" ]
then
echo "Tests for Darwin in Debug mode currently not executed"
else
./tests --format=junit > junit.xml || true
fi
displayName: Execute tests
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/junit.xml'
- bash: |
cd cmake-build-$BUILD_CONFIGURATION
if [ "$AGENT_OS" != "Windows_NT" ]
then
cpack
cp inac*.zip $INAC_ARTIFACT_TARGET
fi
displayName: Create package
env:
INAC_ARTIFACT_TARGET: $(Build.ArtifactStagingDirectory)
- script: |
call "C:\%VSINSTALL%\vcvarsall.bat" %MSVC_PLATFORM%
cd cmake-build-%BUILD_CONFIGURATION%
call "C:\Program Files\CMake\bin\cpack.exe"
copy inac*.zip %INAC_ARTIFACT_TARGET%
displayName: Create package Windows
env:
INAC_ARTIFACT_TARGET: $(Build.ArtifactStagingDirectory)
condition:
eq( variables['Agent.OS'], 'Windows_NT' )
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: inac-$(imageName)
- bash: |
export LANG=C.UTF-8
cd cmake-build-$BUILD_CONFIGURATION
src=`ls inac*.zip`
artifact_name=`basename $src`
echo $artifact_name
if [ "$AGENT_OS" == "Darwin" ]
then
artifact_version=`echo $artifact_name | grep -Eo '\d+\.\d+\.\d+'`
else
artifact_version=`echo $artifact_name | grep -Po '\d+\.\d+\.\d+'`
fi
if [ "$AGENT_OS" == "Darwin" ]
then
artifact_name2=`echo $artifact_name | grep -Eo '[a-z,0-9,_]+-[a-z,0-9,_]+-[a-z,0-9,_]+-[a-z,0-9,_]+'`
else
artifact_name2=`echo $artifact_name | grep -Po '[a-z,0-9,_]+-[a-z,0-9,_]+-[a-z,0-9,_]+-[a-z,0-9,_]+'`
fi
mvn -B deploy:deploy-file --debug --settings=../maven-settings.xml -DrepositoryId=$github_packages_repository_id -Durl=$github_packages_url -DgroupId=inaos -DartifactId=$artifact_name2 -Dversion=$artifact_version -Dpackaging=zip -Dfile=$src
displayName: Upload to Github packages
env:
github_packages_repository_id: 'github'
github_packages_username: $(github_packages_username)
github_packages_pat: $(github_packages_pat)
github_packages_url: $(github_packages_url)
condition: and(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.Reason'], 'IndividualCI'))