forked from google/xsecurelock
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-pipelines.yml
195 lines (179 loc) · 6.39 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
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
branches:
include:
- master
- releases/*
tags:
include:
- v*
variables:
System.Debug: true
stages:
- stage: Build
jobs:
- job: Build
pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
debian8:
containerImage: stuwilkins/xsecurelock-build-deb8:latest
debrelease: debian8
pkg_type: debian
debian9:
containerImage: stuwilkins/xsecurelock-build-deb9:latest
debrelease: debian9
pkg_type: debian
debian10:
containerImage: stuwilkins/xsecurelock-build-deb9:latest
debrelease: debian10
pkg_type: debian
ubuntu-groovy:
containerImage: stuwilkins/xsecurelock-build-ubuntu:latest
debrelease: ubuntu-groovy
pkg_type: debian
centos8:
containerImage: stuwilkins/xsecurelock-build-centos8:latest
pkg_type: redhat
rpmrelease: centos8
centos7:
containerImage: stuwilkins/xsecurelock-build-centos7:latest
pkg_type: redhat
rpmrelease: centos7
container:
image: $[ variables['containerImage'] ]
steps:
- script: |
set -e
./autogen.sh
./configure \
--with-pam \
--with-pam-service-name=xsecurelock \
--with-userfile-priv=/etc/xsecurelock/userfile-priv \
--with-userfile-block=/etc/xsecurelock/userfile-block \
--with-userfile-any=/etc/xsecurelock/userfile-any \
--with-userfile-noblank=/etc/xsecurelock/userfile-noblank \
--with-banner-filename=/etc/xsecurelock/banner \
--enable-any-user-auth \
--enable-banner \
--enable-wallpaper \
--enable-no-blank \
--enable-secure \
--with-fontconfig \
--without-htpasswd \
--with-fontconfig \
--with-mplayer=/usr/bin/mplayer \
--with-mpv=/usr/bin/mpv \
--with-pamtester=no \
--with-xcomposite \
--with-xf86misc=no \
--with-xrandr \
--with-xss \
--with-xsync \
--with-xfixes \
--with-xft \
--with-xkb
displayName: Run Configure
- script: |
set -e
make
displayName: Build
- script: |
GITDESC=$(git describe --abbrev=0)
VERSION=$(git describe --abbrev=0 | sed -En 's/v([0-9]+\.)([0-9]+\.)?([0-9]+)-.*/\1\2\3/p')
echo "##vso[task.setvariable variable=gitdesc]$GITDESC"
echo "##vso[task.setvariable variable=gitversion]$VERSION"
echo "##[debug] GITDESC = $GITDESC"
echo "##[debug] VERSION = $VERSION"
displayName: Set Git Describe to Variable
- script: |
set -e
mkdir -p build
gbp buildpackage \
--git-ignore-new \
--git-ignore-branch \
-uc -us \
--git-export-dir=build \
--git-tarball-dir=build
old_debfile=$(ls -1 build/xsecurelock-nsls2_*.deb | head -1)
new_debfile=$(echo ${old_debfile} | sed "s/\.deb/-$(debrelease).deb/")
mv "${old_debfile}" "${new_debfile}"
echo "##vso[task.setvariable variable=releasefile]${new_debfile}"
echo "##[debug] old_debfile = ${old_debfile}"
echo "##[debug] new_debfile = ${new_debfile}"
echo "##[debug] gitdesc = $(gitdesc)"
displayName: 'Build Debian Package'
condition: and(succeeded(), eq(variables.pkg_type, 'debian'))
- task: CopyFiles@2
inputs:
targetFolder: '$(Build.ArtifactStagingDirectory)'
contents: 'build/xsecurelock-nsls2_*.deb'
flattenFolders: true
condition: and(succeeded(), eq(variables.pkg_type, 'debian'))
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: packages
displayName: Publish Debian Packages
condition: and(succeeded(), eq(variables.pkg_type, 'debian'))
- script: |
set -e
RPMDIR="`pwd`/rpmbuild"
echo $RPMDIR
SOURCES=${RPMDIR}/SOURCES
mkdir -p ${SOURCES}
git archive --format=tar \
--prefix=xsecurelock-$(gitversion)-nsls2/ \
--output=${SOURCES}/xsecurelock-v$(gitversion)-nsls2.tar.gz \
HEAD
cp xautolock.patch ${SOURCES}
cp xautolock-allow-locknow.patch ${SOURCES}
rpmbuild -bb --define "_topdir ${RPMDIR}" --define "version $(gitversion)" xsecurelock-nsls2.spec
rpmbuild -bb --undefine="_disable_source_fetch" --define "_topdir ${RPMDIR}" xautolock-nsls2.spec
rpmbuild -bb --undefine="_disable_source_fetch" --define "_topdir ${RPMDIR}" feh.spec
echo "##[debug] gitdesc = $(gitdesc)"
displayName: 'Build rpm Package'
condition: and(succeeded(), eq(variables.pkg_type, 'redhat'))
- task: CopyFiles@2
inputs:
targetFolder: '$(Build.ArtifactStagingDirectory)'
contents: rpmbuild/RPMS/x86_64/*
flattenFolders: true
condition: and(succeeded(), eq(variables.pkg_type, 'redhat'))
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: packages
displayName: Publish RedHat Packages
condition: and(succeeded(), eq(variables.pkg_type, 'redhat'))
- job: Publish
dependsOn: Build
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v')
steps:
- script: |
GITDESC=$(git describe --abbrev=0)
echo "##vso[task.setvariable variable=gitdesc]$GITDESC"
echo "##[debug] GITDESC = $GITDESC"
displayName: Set Git Describe to Variable
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'packages'
downloadPath: '$(System.ArtifactsDirectory)'
displayName: Download Packages
- task: GithubRelease@0
inputs:
gitHubConnection: github.com_stuwilkins
repositoryName: NSLS-II/xsecurelock
assets: '$(System.ArtifactsDirectory)/**/*'
action: edit
target: '$(Build.SourceVersion)'
tag: $(gitdesc)
addChangeLog: false
assetUploadMode: replace
displayName: 'Attach package to release'