-
Notifications
You must be signed in to change notification settings - Fork 0
187 lines (187 loc) · 9.19 KB
/
debian-packages-build.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
name: Build test and deploy ZFS packages for Debian 10, Ubuntu 18.04 and later
on:
push:
branches:
- master
paths-ignore:
- 'README.md'
jobs:
build:
name: Building packages
runs-on: ubuntu-22.04
steps:
- name: clone zfs upstream repo
shell: bash
run: |
mkdir ~/zfs && cd ~/zfs
git init
git fetch https://github.com/openzfs/zfs.git refs/tags/zfs-2.2.0:refs/tags/zfs-2.2.0 --depth=1
git checkout zfs-2.2.0
- name: clone our zfs ubuntu repo
shell: bash
run: |
echo "ref triggered = ${{ github.ref }}"
mkdir ~/zfs/debian && cd ~/zfs/debian
git init
git fetch https://github.com/${{ github.repository }}.git ${{ github.ref }} --depth=1
git checkout FETCH_HEAD
- name: retrieve build packages
shell: bash
run: |
#sudo DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:jonathonf/libabigail
sudo DEBIAN_FRONTEND=noninteractive apt-get -yq update
sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install acl abigail-tools alien attr autoconf bc build-essential curl dbench debhelper-compat dh-python dkms fakeroot fio gdb gdebi git ksh lcov libacl1-dev libaio-dev libattr1-dev libblkid-dev libcurl4-openssl-dev libdevmapper-dev libelf-dev libffi-dev libmount-dev libpam0g-dev libselinux1-dev libssl-dev libtool libudev-dev linux-headers-generic lsscsi mdadm nfs-kernel-server pamtester parted po-debconf python3 python3-all-dev python3-cffi python3-dev python3-packaging python3-pip python3-setuptools python3-sphinx rng-tools-debian rsync samba sysstat uuid-dev watchdog wget xfslibs-dev xz-utils zlib1g-dev
- name: build zfs packages
shell: bash
run: |
echo "current folder"
pwd
cd ~/zfs
sed -i "s/\$upstream_sha/$(git rev-parse HEAD)/g" ./debian/changelog
sed -i "s/\$github_run_number/${{ github.run_number }}/g" ./debian/changelog
cat ./debian/changelog
dpkg-buildpackage -b -rfakeroot -us -uc --no-sign
mkdir ./zfs-deb-packages
cp ../*.deb ./zfs-deb-packages
ls ./zfs-deb-packages -al
- name: cache created packages
uses: actions/cache@v1
with:
path: ~/zfs/zfs-deb-packages
key: ${{ runner.OS }}-zfs-${{ github.sha }}
test:
needs: build
name: Testing packages
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
testbatch:
- 'alloc_class,limits,arc,channel_program,cp_files,deadman,btree,cache,history,hkdf,inuse,zfs_property,zfs_receive,zfs_reservation,zfs_send,zfs_set,zfs_share,zfs_snapshot,zfs_unload-key,zfs_unmount,zfs_unshare,zfs_upgrade,zpool,zpool_detach'
- 'rootpool,scrub_mirror,pool_checkpoint'
- 'acl,atime,bootfs,cachefile,casenorm,chattr,checksum,clean_mirror,compression,crtime,ctime,delegate,devices,events,exec,fault,features,grow_pool'
- 'grow_replicas,mv_files,cli_user,zfs_mount,zfs_promote,zfs_rollback,zpool_events,zpool_expand,zpool_export,zpool_attach,zpool_clear,zpool_create'
- 'zpool_get,zpool_history,zpool_import,zpool_labelclear,zpool_offline,zpool_online'
- 'zpool_reopen,zpool_remove,zpool_replace,zpool_scrub,zpool_set,zpool_status,zpool_sync,zpool_upgrade,redacted_send,redundancy'
- 'zfs_destroy,link_count,migration,refquota,refreserv,rename_dirs,replacement,log_spacemap'
- 'zfs,zfs_bookmark,zfs_change-key,zfs_clone,zfs_copies,zfs_create,zfs_diff,zfs_get,zfs_inherit,zfs_load-key,zfs_rename,mmap,mmp,mount,nestedfs,no_space,nopwrite,online_offline,pool_names,poolversion'
- 'zdb,mmp,trim'
- 'privilege,quota,raidz,redundancy,rsend'
- 'slog,snapused,sparse,threadsappend,tmpfile,truncate,upgrade,userquota,vdev_zaps,write_dirs,xattr'
steps:
- name: Restore cached packages
uses: actions/cache@v1
with:
path: ./zfs-deb-packages
key: ${{ runner.OS }}-zfs-${{ github.sha }}
- name: setup local repo and put earlier-built ZFS packages there
shell: bash
run: |
cd ./zfs-deb-packages
ls ./ -alt
pwd
sudo bash -c "dpkg-scanpackages -m . > Packages"
sudo bash -c "echo 'deb [trusted=yes] file:$(pwd) ./' >> /etc/apt/sources.list"
sudo bash -c "echo -e \"Package: *\nPin: origin \\\"\\\"\nPin-Priority: 1001\" > /etc/apt/preferences.d/90_zfs"
sudo DEBIAN_FRONTEND=noninteractive apt-get -yq update
- name: install earlier-built ZFS packages along with packages required for conducting tests
shell: bash
run: |
sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install linux-modules-extra-$(uname -r)
sudo bash -c "echo \"zfs-dkms zfs-dkms/note-incompatible-licenses note true\" | debconf-set-selections"
sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install zfs-dkms zfsutils-linux zfs-zed zfs-test parted lsscsi ksh attr acl fio quota nfs-kernel-server samba-common-bin linux-tools-generic linux-tools-$(uname -r) linux-cloud-tools-$(uname -r)
zfs version
- name: run tests
shell: bash
run: |
sudo rm -rf /etc/hostid
/usr/share/zfs/zfs-tests.sh -v -T ${{ matrix.testbatch }}
- name: show test output on failure
if: failure()
shell: bash
run: |
find /var/tmp/test_results/current/log -type f -name '*' -printf "%f\n" -exec cut -c -800 {} \;
deploy:
needs: test
name: Deploying artefacts to debian repository
runs-on: ubuntu-latest
steps:
- name: Restore cached packages
uses: actions/cache@v1
with:
path: ./zfs-deb-packages
key: ${{ runner.OS }}-zfs-${{ github.sha }}
- name: adding required packages for repo publishing
shell: bash
run: |
sudo bash -c "echo 'deb http://repo.aptly.info/ squeeze main' >> /etc/apt/sources.list"
wget -qO - https://www.aptly.info/pubkey.txt | sudo apt-key add -
sudo DEBIAN_FRONTEND=noninteractive apt-get -yq update
sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install gnupg aptly
- name: create repo and add packages
shell: bash
run: |
aptly repo create -distribution="zfs-debian-experimental" -component="main" zfs-debian-experimental
sed -i 's/\"architectures\": \[\]/\"architectures\": \[\"amd64\"\]/g' ~/.aptly.conf
echo -n "${{ secrets.GPG_KEY }}" > ./apt-private-key.asc
echo ${{ secrets.GPG_PASS }} | gpg --batch --import ./apt-private-key.asc
rm -rf ./apt-private-key.asc
ls ./zfs-deb-packages/*.deb -1 | xargs aptly repo add zfs-debian-experimental
aptly publish repo --gpg-key="$(gpg --list-public-keys --keyid-format 0xLONG | sed -n -E 's/^pub\s+\w{1,30}[0-9]+\/0x([0-9A-Z]+)\s+.+$/\1/p')" --batch=true --passphrase="${{ secrets.GPG_PASS }}" zfs-debian-experimental
rm -rf ./zfs-deb-packages
- uses: actions/checkout@v2
with:
ref: gh-pages
- name: push updates
shell: bash
run: |2
git config --global user.email "$(git log -n 1 --format=format:%ae)"
git config --global user.name "$(git log -n 1 --format=format:%an)"
rm ./public -rf
cp -r /home/runner/.aptly/public ./
export PAGE_FOOTER_DATE_TAG=$(date -Is)
sed -i -E "s/(<span class=\"datetag\">)[^<]*(<\/span>)/\1${PAGE_FOOTER_DATE_TAG}\2/" ./index.html
python - <<END
import os
indexTextStart = """<!DOCTYPE html>
<html>
<head><title>Index of {folderPath}</title></head>
<body>
<h2>Index of {folderPath}</h2>
<hr>
<ul>
<li>
<a href='../'>../</a>
</li>
"""
indexTextEnd = """
</ul>
<hr/>
<p>Page generated: ${PAGE_FOOTER_DATE_TAG}</p>
</body>
</html>
"""
def index_folder(folderPath):
print("Indexing: " + folderPath +'/')
files = os.listdir(folderPath)
root = folderPath
if folderPath == '.':
root = 'Root'
indexText = indexTextStart.format(folderPath=root)
for file in files:
if file != 'index.html':
indexText += "\t\t<li>\n\t\t\t<a href='" + file + "'>" + file + "</a>\n\t\t</li>\n"
if os.path.isdir(folderPath+'/'+file):
index_folder(folderPath + '/' + file)
indexText += indexTextEnd
index = open(folderPath+'/index.html', "w")
index.write(indexText)
index_folder('./public')
END
rm -rf ./.git
git init
git checkout --orphan "gh-pages"
git remote add origin "https://x-access-token:${{ secrets.GH_PERSONAL_TOKEN }}@github.com/${{ github.repository }}.git"
git add --all
git commit -am "automatic pages update from ${{ github.ref }} commit ${{ github.sha }}"
git push --force --set-upstream origin gh-pages