-
Notifications
You must be signed in to change notification settings - Fork 16
345 lines (293 loc) · 12.6 KB
/
build-test-release-client-packages.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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
name: Build, test, and release client packages
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
# Declare default permissions as read only.
permissions: read-all
jobs:
build-linux-packages:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Get the version number for the packages
id: get_version
# If this is a tag, use the tag name (e.g. v1.2.3) without v as version number.
# Otherwise, just use 0.0.
run: |
VERSION=0.0
REF_NAME=${{ github.ref }}
[[ $REF_NAME == refs/tags/v* ]] && VERSION=${REF_NAME/refs\/tags\/v/}
echo ::set-output name=version::${VERSION}
- name: Prepare package source by running the corresponding playbook locally
run: |
echo "localhost ansible_connection=local" > inventory/hosts
ansible-playbook ./prepare-client-packages.yml
# We probably should loop over the set {rpm,deb,osxpkg} to create packages, but
# it will make debugging more annoying.
- name: Build RPM package
uses: bpicode/github-action-fpm@e76c0e2166030f4691d641a700b16958c7d12f5d # v0.9.2
with:
fpm_args: "etc"
fpm_opts: "--debug -n cvmfs-config-eessi -v ${{ steps.get_version.outputs.version }} -t rpm -a all -s dir -C ./package --description 'CVMFS configuration package for EESSI.'"
- name: Build Deb package
uses: bpicode/github-action-fpm@e76c0e2166030f4691d641a700b16958c7d12f5d # v0.9.2
with:
fpm_args: "etc"
fpm_opts: "--debug -n cvmfs-config-eessi -v ${{ steps.get_version.outputs.version }} -t deb -a all -s dir -C ./package --description 'CVMFS configuration package for EESSI.'"
- name: Build tar package
uses: bpicode/github-action-fpm@e76c0e2166030f4691d641a700b16958c7d12f5d # v0.9.2
with:
fpm_args: "etc"
fpm_opts: "--debug -n cvmfs-config-eessi-${{ steps.get_version.outputs.version }} -t tar -a all -s dir -C ./package --description 'CVMFS configuration package for EESSI.'"
- name: Upload packages as build artifacts
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with:
name: linux_packages
path: cvmfs-config-eessi*
# build-macos-package:
# runs-on: macos-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2
#
# - name: Get the version number for the packages
# id: get_version
# # If this is a tag, use the tag name (e.g. v1.2.3) without v as version number.
# # Otherwise, just use 0.0.
# run: |
# VERSION=0.0
# REF_NAME=${{ github.ref }}
# [[ $REF_NAME == refs/tags/v* ]] && VERSION=${REF_NAME/refs\/tags\/v/}
# echo ::set-output name=version::${VERSION}
#
# # The next step uses a custom Ansible inventory, and due to that it cannot find
# # the group_vars folder inside the inventory folder. This symlink fixes that.
# - name: Make symlink to group_vars
# run: ln -s inventory/group_vars
#
# - name: Install Ansible
# run: pip3 install ansible
#
# - name: Prepare package source
# run: ansible-playbook --connection=local ./prepare-client-packages.yml
#
# - name: Install dependencies
# run: brew install gnu-tar
#
# - name: Install fpm
# run: gem install --no-document fpm
#
# - name: Build package
# run: "fpm --debug -n cvmfs-config-eessi -v ${{ steps.get_version.outputs.version }} -t osxpkg -a all -s dir -C ./package --description 'CVMFS configuration package for EESSI.' etc"
#
# - name: Find filename of generated package
# id: find_filename
# shell: bash
# run: |
# pkgfile="$(ls -1 cvmfs-config-eessi*.pkg)"
# echo ::set-output name=pkgfile::${pkgfile}
#
# - name: Upload macOS package as artifact
# uses: actions/upload-artifact@v2
# with:
# name: macos_package
# path: ${{ steps.find_filename.outputs.pkgfile }}
test-deb-package:
needs: build-linux-packages
runs-on: ubuntu-latest
steps:
- name: Install CVMFS dependencies
run: sudo apt-get install lsb-release
- name: Download and install CVMFS client
run: wget https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest_all.deb && sudo dpkg -i cvmfs-release-latest_all.deb
- name: Install CVMFS client
run: sudo apt-get update && sudo apt-get install cvmfs
- name: Download cvmfs-config-eessi package
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1
with:
name: linux_packages
- name: Find filename of package
id: find_filename
shell: bash
run: |
debfile="$(find . -name cvmfs-config-eessi*.deb)"
echo ::set-output name=debfile::${debfile}
- name: Install package
run: sudo dpkg -i ./${{ steps.find_filename.outputs.debfile }}
- name: Add local CVMFS configuration (/etc/cvmfs/default.local)
run: echo "CVMFS_CLIENT_PROFILE=single" | sudo tee /etc/cvmfs/default.local
- name: Mount the repositories
run: sudo cvmfs_config setup
- name: Test repository access
run: ls /cvmfs/pilot.eessi-hpc.org/
test-rpm-package:
needs: build-linux-packages
runs-on: ubuntu-latest
container:
image: centos:centos7
options: --device /dev/fuse --privileged
steps:
- name: Download and install CVMFS client
run: yum install -y https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest.noarch.rpm
- name: Install CVMFS client
run: yum install -y cvmfs
- name: Download cvmfs-config-eessi package
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1
with:
name: linux_packages
- name: Find filename of package
id: find_filename
shell: bash
run: |
rpmfile="$(find . -name cvmfs-config-eessi*.rpm)"
echo ::set-output name=rpmfile::${rpmfile}
- name: Install package
run: rpm -i ./${{ steps.find_filename.outputs.rpmfile }}
- name: Add local CVMFS configuration (/etc/cvmfs/default.local)
run: echo "CVMFS_CLIENT_PROFILE=single" | tee /etc/cvmfs/default.local
- name: Mount the repositories
#run: cvmfs_config setup
run: mkdir -p /cvmfs/pilot.eessi-hpc.org && mount -t cvmfs pilot.eessi-hpc.org /cvmfs/pilot.eessi-hpc.org
- name: Test repository access
run: ls /cvmfs/pilot.eessi-hpc.org/
test-tar-package:
needs: build-linux-packages
runs-on: ubuntu-latest
steps:
- name: Install CVMFS dependencies
run: sudo apt-get install lsb-release
- name: Download and install CVMFS client
run: wget https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest_all.deb && sudo dpkg -i cvmfs-release-latest_all.deb
- name: Install CVMFS client
run: sudo apt-get update && sudo apt-get install cvmfs
- name: Download cvmfs-config-eessi package
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1
with:
name: linux_packages
- name: Find filename of package
id: find_filename
shell: bash
run: |
tarfile="$(find . -name cvmfs-config-eessi*.tar)"
echo ::set-output name=tarfile::${tarfile}
- name: Install package
run: sudo tar -C / -xf ./${{ steps.find_filename.outputs.tarfile }}
- name: Add local CVMFS configuration (/etc/cvmfs/default.local)
run: echo "CVMFS_CLIENT_PROFILE=single" | sudo tee /etc/cvmfs/default.local
- name: Mount the repositories
run: sudo cvmfs_config setup
- name: Test repository access
run: ls /cvmfs/pilot.eessi-hpc.org/
# test-macos-package:
# needs: build-macos-package
# runs-on: macos-10.15
# steps:
# - name: Install OSXFUSE
# run: brew install --cask macfuse
#
# - name: Download and install CVMFS client
# run: wget https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-latest.pkg && sudo installer -target / -pkg cvmfs-latest.pkg
#
# - name: Download cvmfs-config-eessi package
# uses: actions/download-artifact@v2
# with:
# name: macos_package
#
# - name: Find filename of package
# id: find_filename
# shell: bash
# run: |
# pkgfile="$(find . -name cvmfs-config-eessi*.pkg)"
# echo ::set-output name=pkgfile::${pkgfile}
#
# - name: Install package
# run: sudo installer -target / -pkg ./${{ steps.find_filename.outputs.pkgfile }}
#
# - name: Add local CVMFS configuration (/etc/cvmfs/default.local)
# run: echo "CVMFS_CLIENT_PROFILE=single" | sudo tee /etc/cvmfs/default.local
#
# - name: Mount the repositories
# run: sudo mkdir -p /Users/Shared/cvmfs/pilot.eessi-hpc.org && sudo mount -t cvmfs pilot.eessi-hpc.org /Users/Shared/cvmfs/pilot.eessi-hpc.org
#
# - name: Test repository access
# run: ls /Users/Shared/cvmfs/pilot.eessi-hpc.org/
release:
#needs: [build-linux-packages, build-macos-package, test-deb-package, test-rpm-package, test-macos-package, test-tar-package]
needs: [build-linux-packages, test-deb-package, test-rpm-package, test-tar-package]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Find release version in tag
id: find_version
run: |
echo ::set-output name=version::${GITHUB_REF#refs/tags/}
- uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1
with:
path: ./build_artifacts
- name: Find filenames of downloaded packages
id: find_filenames
shell: bash
run: |
ls -1 -R .
echo ::set-output name=package_filenames::$(find ./build_artifacts -name cvmfs-config-eessi*)
- uses: meeDamian/github-release@7ae19492500104f636b3fee4d8103af0fed36c8e # v2.0.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.find_version.outputs.version }}
name: Filesystem Layer ${{ steps.find_version.outputs.version }}
body: >
Filesystem Layer release ${{ steps.find_version.outputs.version }}
files: ${{ steps.find_filenames.outputs.package_filenames }}
gzip: false
release-latest:
needs: [release] # only run when the previous step (the actual release) was successful
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1
with:
path: ./build_artifacts
- name: Find release version in tag
id: find_version
run: |
echo ::set-output name=version::${GITHUB_REF#refs/tags/}
- name: Find filenames of downloaded packages and rename them to latest
id: find_filenames
shell: bash
run: |
sudo apt-get install rename
rename "s/([0-9]+.[0-9]+.[0-9]+)(-[0-9]+)?/latest/g" $(find ./build_artifacts -name cvmfs-config-eessi*)
ls -1 -R ./build_artifacts
echo ::set-output name=package_filenames::$(find ./build_artifacts -name cvmfs-config-eessi*latest*)
- name: Delete any previous tag/release named "latest"
uses: dev-drprasad/delete-tag-and-release@085c6969f18bad0de1b9f3fe6692a3cd01f64fe5 # v0.2.0
with:
delete_release: true # default: false
tag_name: latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: meeDamian/github-release@7ae19492500104f636b3fee4d8103af0fed36c8e # v2.0.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: latest
name: Filesystem Layer latest release
body: |
Filesystem Layer release ${{ steps.find_version.outputs.version }} (see: https://github.com/${{github.repository}}/releases/tag/${{ steps.find_version.outputs.version }})
This `latest` tag is a moving tag that is updated automatically for each release, and provides easy access to the latest `cvmfs-config-eessi` packages.
files: ${{ steps.find_filenames.outputs.package_filenames }}
gzip: false