-
Notifications
You must be signed in to change notification settings - Fork 2
/
azure-pipelines.yml
252 lines (218 loc) · 7.94 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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
#
# webalizer - a web server log analysis program
#
# Copyright (c) 2004-2023, Stone Steps Inc. (www.stonesteps.ca)
#
# See COPYING and Copyright files for additional licensing and copyright information
#
variables:
#
# Intended upcoming app version on this branch. Once a dot-zero version
# is released, this version should be updated towards the next release.
#
# For example, after 6.1.0 is released and a v6-1 branch is created,
# pipeline YAML on that branch should be changed to use version 6.1.1
# for bug fixes and version on master should be changed to 6.2.0 or
# 7.0.0, whichever is planned. Once 6.1.1 is released, pipeline YAML
# on branch v6-1 should be changed to use version 6.1.2, and so on.
#
VERSION: 6.4.0
BUILD_NUMBER: $[counter(variables.VERSION, 1)]
#
# All directories are within Azure DevOps agent's workspace directory:
#
# $(Pipeline.Workspace)
#
# source checkout directory
SRC_DIR: $(Build.SourcesDirectory)
#
# Makefile build directory for compiled binaries and intermediate object
# files. Build.BinariesDirectory is not cleaned before a build, unless
# explicitly requested, like this:
#
# - job: X
# workspace:
# clean: outputs
#
# Make sure different branches and different jobs don't reuse any build
# files. System.PhaseName is the job name that follows `job:` or `Job1`,
# `Job2`, etc. for nameless jobs. This pipeline is intended only for x64
# builds and x64 is not in any directory paths because we don't need to
# differenciate between x86 and x64.
#
BUILD_DIR: $(Build.BinariesDirectory)/webalizer/$(Build.SourceBranchName)/$(System.PhaseName)
# artifacts staging directory (cleaned automatically before a build)
ARTIFACT_DIR: $(Build.ArtifactStagingDirectory)
# test results directory
TEST_RSLT_DIR: $(Common.TestResultsDirectory)
# a directory for temporary files (cleaned automatically after each job)
TMP_DIR: $(Agent.TempDirectory)
#
# Pipeline run label that can be accessed via $(Build.BuildNumber).
#
# Additional build metadata may be added after $(Build.BuildNumber)
# using dot separators, with a mandatory leading dot.
#
name: $(VERSION)+$(BUILD_NUMBER)
stages:
- stage: BuildPackages
displayName: Build packages
jobs:
- job: windows
displayName: Windows
variables:
TEST_RSLT_FILE: webalizer_win_test.xml
# build output for webalizer.exe and test.exe (must end with a slash in all MS Build tasks)
BIN_OUT_DIR: $(BUILD_DIR)\webalizer
BIN_INT_DIR: $(BUILD_DIR)\webalizer\obj
#
# MSBuild package target merely copies package files into output
# directory and doesn't archive them, which is done by an archive
# task in this pipeline. Give the package output directory the
# same name as will be used for the archive file name, so we can
# include the output directory as the top-level directory in the
# archive.
#
# Package directories must be one level below BIN_OUT_DIR for
# scripts to access build files via parent paths.
#
PKG_NAME: webalizer-stonesteps-$(Build.BuildNumber).win.x64
PKG_OUT_DIR: $(BIN_OUT_DIR)\$(PKG_NAME)
PKG_INT_DIR: $(BIN_OUT_DIR)\$(PKG_NAME)-tmp
pool:
vmImage: windows-2022
steps:
- task: NuGetCommand@2
displayName: Restore Nuget Packages
inputs:
command: 'restore'
restoreSolution: 'src/webalizer.sln'
feedsToUse: 'select'
vstsFeed: 'https://api.nuget.org/v3/index.json'
- task: MSBuild@1
displayName: Build
inputs:
solution: 'src\webalizer.vcxproj'
msbuildArchitecture: 'x64'
platform: 'x64'
configuration: 'Release'
msbuildArguments: '/property:OutDir=$(BIN_OUT_DIR)\;IntDir=$(BIN_INT_DIR)\;AZP_BUILD_NUMBER=$(BUILD_NUMBER)'
- task: MSBuild@1
displayName: Build Test
inputs:
solution: 'src\test\test.vcxproj'
msbuildArchitecture: 'x64'
platform: 'x64'
configuration: 'Release'
msbuildArguments: '/property:OutDir=$(BIN_OUT_DIR)\test\;IntDir=$(BIN_INT_DIR)\test\obj\'
- script: |
$(BIN_OUT_DIR)\test\test.exe --gtest_output=xml:$(TEST_RSLT_DIR)/$(TEST_RSLT_FILE)
displayName: Run Test
- task: PublishTestResults@2
inputs:
testResultsFormat: "JUnit"
testResultsFiles: '$(TEST_RSLT_FILE)'
searchFolder: '$(TEST_RSLT_DIR)'
# create output directory for the package
- script: |
mkdir "$(PKG_OUT_DIR)"
displayName: Create Package Directory
- task: MSBuild@1
displayName: Collect Package Files
inputs:
solution: 'src\package.vcxproj'
msbuildArchitecture: 'x64'
platform: 'x64'
configuration: 'Release'
msbuildArguments: '/property:OutDir=$(PKG_OUT_DIR)\;IntDir=$(PKG_INT_DIR)\'
- task: ArchiveFiles@2
displayName: Make Package
inputs:
rootFolderOrFile: '$(PKG_OUT_DIR)'
includeRootFolder: true
archiveType: 'zip'
archiveFile: '$(ARTIFACT_DIR)/$(PKG_NAME).zip'
replaceExistingArchive: true
- publish: '$(ARTIFACT_DIR)/$(PKG_NAME).zip'
artifact: Windows package
#
# Linux
#
- job: linux
displayName: Linux
# actual display name will be `System.JobDisplayName + ' ' + System.JobName`
# System.JobName is Debian, Ubuntu, Fedora
strategy:
matrix:
Debian:
DIST_NAME: debian
DIST_ABBR: deb
Ubuntu:
DIST_NAME: ubuntu
DIST_ABBR: ubu
Fedora:
DIST_NAME: fedora
DIST_ABBR: fed
variables:
TEST_RSLT_FILE: webalizer_$(DIST_ABBR)_test.xml
# give each matrix configuration its own build directory
BUILD_DIST_DIR: $(BUILD_DIR)/$(DIST_NAME)
pool:
vmImage: ubuntu-22.04
container: stonesteps/webalizer-$(DIST_NAME):20210620
steps:
- script: |
make clean-deps
displayName: Clean dependencies
- script: |
make BLDDIR=$(BUILD_DIST_DIR) AZP_BUILD_NUMBER=$(BUILD_NUMBER)
displayName: Build
- script: |
make BLDDIR=$(BUILD_DIST_DIR) TEST_RSLT_DIR=$(TEST_RSLT_DIR) TEST_RSLT_FILE=$(TEST_RSLT_FILE) test
displayName: Test
- task: PublishTestResults@2
inputs:
testResultsFormat: "JUnit"
testResultsFiles: '$(TEST_RSLT_FILE)'
searchFolder: '$(TEST_RSLT_DIR)'
- script: |
make BLDDIR=$(BUILD_DIST_DIR) PKG_DIR=$(ARTIFACT_DIR) PKG_OS_ABBR=$(DIST_ABBR) PKG_ARCH_ABBR=x64 package
displayName: Package
- publish: '$(ARTIFACT_DIR)/webalizer-stonesteps-$(Build.BuildNumber).$(DIST_ABBR).x64.tar.gz'
artifact: $(System.JobName) package
#
# Doxygen docs
#
- job: doxygen
displayName: Doxygen
variables:
# generate Doxygen docs in a unique folder per job attempt, which we will remove after archiving
DOCYGEN_OUTPUT: '$(Build.BinariesDirectory)/webalizer-doxygen/$(System.JobId)'
pool:
vmImage: ubuntu-20.04
container: stonesteps/webalizer-fedora-doxygen:20210321
steps:
# Doxygen can only create one missing directory segment
- script: >
mkdir -p $(DOCYGEN_OUTPUT)
displayName: Create Doxygen output directory
- script: >
DOXYGEN_BRANCH=$(Build.SourceBranchName)
DOXYGEN_INPUT=$(SRC_DIR)/src
DOXYGEN_OUTPUT=$(DOCYGEN_OUTPUT)
doxygen $(SRC_DIR)/devops/doxygen.conf
displayName: Generate Doxygen docs
- task: ArchiveFiles@2
displayName: Package Doxygen docs
inputs:
rootFolderOrFile: '$(DOCYGEN_OUTPUT)'
includeRootFolder: false
archiveType: 'tar'
tarCompression: 'gz'
archiveFile: '$(ARTIFACT_DIR)/webalizer-stonesteps-$(Build.BuildNumber).doxygen.tar.gz'
replaceExistingArchive: true
- script: >
rm -rf $(DOCYGEN_OUTPUT)
displayName: Remove Doxygen output
- publish: '$(ARTIFACT_DIR)/webalizer-stonesteps-$(Build.BuildNumber).doxygen.tar.gz'
artifact: Doxygen docs