-
Notifications
You must be signed in to change notification settings - Fork 11
306 lines (306 loc) · 17 KB
/
releases-deb.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
name: Build Artifacts (DEB)
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Test scenario tags'
required: false
type: boolean
pull_request:
branches: [master, develop]
paths-ignore:
- '**/*.md'
- '.circleci/**'
- '.cirrus.yml'
push:
branches: [master, develop]
paths-ignore:
- '**/*.md'
- '.circleci/**'
- '.cirrus.yml'
release:
types: [published]
schedule:
- cron: '0 16 * * *'
concurrency:
group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}
env:
CACHE_EPOCH: 124-1
GOPROXY: direct
DH_QUIET: 1
jobs:
deb-release:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
distro: [xenial]
arch: [amd64, i386]
include:
- distro: bionic
arch: arm64
- distro: sid
arch: riscv64
# XFAIL stretch
# XFAIL focal-i386,jammy-i386
# XFAIL sid-riscv64 (gui, curl)
# distro: [trusty, xenial, bionic, focal, jammy, stretch, buster, bullseye, bookworm]
# arch: [i386, amd64, armhf, arm64]
# include:
# - distro: stretch
# arch: armel
# - distro: stretch
# arch: mipsel
# - distro: stretch
# arch: mips64el
env:
DEBIAN_FRONTEND: 'noninteractive'
HOST_ARCH: '${{ matrix.arch }}'
HOST_DISTRO: '${{ matrix.distro }}'
steps:
- uses: actions/checkout@v4
- name: Checkout with shallow submodules
run: |
# unshallow must come first otherwise submodule may be get unshallowed
git fetch --tags --unshallow
git submodule update --init --depth 1
- name: Patch libcxxabi for both of armel and armhf
if: ${{ env.HOST_ARCH == 'armel' || env.HOST_ARCH == 'armhf' }}
run: |
cd third_party/libc++abi
patch -p1 < v8-6.7.17-fix-gcc-unwind-header.patch
- name: Cache clang
id: clang-cache
uses: actions/cache@v4
with:
path: |
third_party/llvm-build/Release+Asserts
key: ${{ runner.os }}-toolchain-${{ hashFiles('CLANG_REVISION') }}-v${{ env.CACHE_EPOCH }}
- name: Cache golang
uses: actions/cache@v4
with:
path: |
/tmp/.cache/go-build
/tmp/go/pkg/mod
key: ${{ runner.os }}-go-tmp-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-tmp-
- name: "Install dependency: prebuilt clang and clang-tidy binaries"
if: ${{ steps.clang-cache.outputs.cache-hit != 'true' }}
run: |
./scripts/download-clang-prebuilt-binaries.py
rm -f third_party/llvm-build/Release+Asserts/*.tgz
- name: Change ubuntu mirror
run: |
sudo sed -i 's/azure.archive.ubuntu.com/azure.archive.ubuntu.com/g' /etc/apt/sources.list
sudo apt-get update -qq
- name: Populate depedencies (debian keyring, for debian distributions)
run: |
curl -O http://ftp.us.debian.org/debian/pool/main/d/debian-archive-keyring/debian-archive-keyring_2023.4_all.deb
sudo apt-get update -qq && sudo apt-get install -f -y $PWD/debian*.deb
rm -f *.deb
- name: Populate depedencies (sbuild, debhelper, schroot, debootstrap and ubuntu-dev-tools)
run: |
sudo apt-get update -qq
sudo apt-get install -y sbuild debhelper schroot debootstrap ubuntu-dev-tools qemu-user-static
- name: Populate depedencies (deboostrap update for sid fix)
if: ${{ env.HOST_DISTRO == 'sid' }}
run: |
curl -L -O http://mirrors.kernel.org/ubuntu/pool/main/d/debootstrap/debootstrap_1.0.132ubuntu1_all.deb
sudo apt-get update -qq && sudo apt-get install -f -y $PWD/debootstrap*.deb
rm -f *.deb
- name: Copy sbuilrc
run: |
cp -fv sbuildrc ~/.sbuildrc
sudo usermod -aG sudo "$USER"
sudo usermod -aG sbuild "$USER"
sudo chown -R sbuild:sbuild /var/lib/sbuild/
sudo chmod g+rws /var/lib/sbuild/
- name: Pre-Populate sysroot (distro option)
if: ${{ env.HOST_DISTRO == 'stretch' || env.HOST_DISTRO == 'buster' || env.HOST_DISTRO == 'bullseye' || env.HOST_DISTRO == 'bookworm' || env.HOST_DISTRO == 'sid' }}
run: |
echo "mksbuild_distro_opts=--distro=debian" >> $GITHUB_ENV
- name: Pre-Populate BUILD_ARCH (i386)
if: ${{ env.HOST_ARCH == 'i386' }}
run: |
echo "mksbuild_arch_opts=--arch=i386" >> $GITHUB_ENV
echo "BUILD_ARCH=i386" >> $GITHUB_ENV
- name: Pre-Populate BUILD_ARCH (amd64)
if: ${{ env.HOST_ARCH != 'i386' }}
run: |
echo "mksbuild_arch_opts=--arch=amd64" >> $GITHUB_ENV
echo "BUILD_ARCH=$(dpkg-architecture -q DEB_BUILD_ARCH)" >> $GITHUB_ENV
- name: Set check build profile
if: ${{ env.HOST_ARCH == 'i386' || env.HOST_ARCH == 'amd64' }}
run: |
echo "DEB_BUILD_PROFILES=check ${{ env.DEB_BUILD_PROFILES }}" >> $GITHUB_ENV
- name: Set cross build profile
if: ${{ env.HOST_ARCH != 'i386' && env.HOST_ARCH != 'amd64' }}
run: |
echo "DEB_BUILD_PROFILES=nocheck cross ${{ env.DEB_BUILD_PROFILES }}" >> $GITHUB_ENV
- name: Set nogui build profile (armel/mipsel/mips64el and riscv64 only)
if: ${{ env.HOST_ARCH == 'armel' || env.HOST_ARCH == 'mipsel' || env.HOST_ARCH == 'mips64el' || env.HOST_ARCH == 'riscv64' }}
run: |
echo "DEB_BUILD_PROFILES=nogui ${{ env.DEB_BUILD_PROFILES }}" >> $GITHUB_ENV
echo "APT_DEB_BUILD_PROFILES=-o Apt::Build-Profiles=nogui" >> $GITHUB_ENV
- name: Set clang build profile
run: |
echo "DEB_BUILD_PROFILES=clang ${{ env.DEB_BUILD_PROFILES }}" >> $GITHUB_ENV
echo "CC=${{ github.workspace }}/third_party/llvm-build/Release+Asserts/bin/clang" >> $GITHUB_ENV
echo "CXX=${{ github.workspace }}/third_party/llvm-build/Release+Asserts/bin/clang++" >> $GITHUB_ENV
- name: Fix schroot permissions (set store permissions for restore)
run: |
sudo mkdir -p /etc/schroot/chroot.d /var/lib/schroot/chroots
sudo chown -R $USER:sbuild /etc/schroot/chroot.d /var/lib/schroot/chroots
- name: Cache schroot
id: schroot-cache
uses: actions/cache@v4
with:
path: |
/etc/schroot/chroot.d
/var/lib/schroot/chroots
key: ${{ runner.os }}-22.04-schroot-${{ env.HOST_DISTRO }}-${{ env.HOST_ARCH }}-v1
- name: Fix schroot permissions (restore root permissions)
run: |
sudo chown -R root:root /etc/schroot/chroot.d /var/lib/schroot/chroots
# mk-sbuild may fail due to the missing pkg-config-<gnu-type>, but it
# should be fine, will create pkg-config shim in next step
- name: Populate sysroot
if: ${{ steps.schroot-cache.outputs.cache-hit != 'true' }}
run: |
sudo -n sudo -u "$USER" -g sbuild mk-sbuild ${{ env.mksbuild_arch_opts }} ${{ env.HOST_DISTRO }} --target=${{ env.HOST_ARCH }} ${{ env.mksbuild_distro_opts }} || true
sudo sed -i '/profile/d' /etc/schroot/chroot.d/*
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
apt-get clean
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
apt-get update -qq
- name: Populate sysroot (crosscompile toolchain)
if: ${{ steps.schroot-cache.outputs.cache-hit != 'true' && env.HOST_ARCH != 'i386' && env.HOST_ARCH != 'amd64' }}
run: |
export HOST_GNU_TYPE=$(dpkg-architecture -a ${{ env.HOST_ARCH }} -q DEB_HOST_GNU_TYPE)
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
dpkg --add-architecture ${{ env.HOST_ARCH }}
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
apt-get update -qq
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
apt-get install -y dpkg-cross pkg-config gcc-$HOST_GNU_TYPE g++-$HOST_GNU_TYPE libc6:${{ env.HOST_ARCH }} libstdc++6:${{ env.HOST_ARCH }} linux-libc-dev:${{ env.HOST_ARCH }}
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
ln -sf /usr/share/pkg-config-crosswrapper /usr/bin/${HOST_GNU_TYPE}-pkg-config
- name: Populate sysroot (crosscompile toolchain, for bookworm and later distro)
if: ${{ steps.schroot-cache.outputs.cache-hit != 'true' && env.HOST_ARCH != 'i386' && env.HOST_ARCH != 'amd64' }}
run: |
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
bash -c "[ ! -f /usr/share/pkg-config-crosswrapper ] && cp -v $PWD/debian/pkg-config-crosswrapper /usr/share/pkg-config-crosswrapper || :"
- name: Populate sysroot (standard toolchain)
if: ${{ steps.schroot-cache.outputs.cache-hit != 'true' }}
run: |
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
apt-get install -y fakeroot advancecomp apt-utils file build-essential pkg-config debhelper lockfile-progs optipng pkg-config tzdata ucf
- name: Populate sysroot (amd64 runtime for clang)
if: ${{ steps.schroot-cache.outputs.cache-hit != 'true' && env.HOST_ARCH == 'i386' }}
run: |
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
cp -f /etc/apt/sources.list /etc/apt/sources.list.amd64
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
sed -i s/i386/amd64/g /etc/apt/sources.list.amd64
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
bash -c "cat /etc/apt/sources.list /etc/apt/sources.list.amd64 | tee /tmp/sources.list"
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
mv -f /tmp/sources.list /etc/apt/sources.list
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
dpkg --add-architecture amd64
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
apt-get update -qq
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
apt-get install -y libc6:amd64 libstdc++6:amd64 zlib1g:amd64
- name: Populate sysroot (ca-certificates, git)
if: ${{ steps.schroot-cache.outputs.cache-hit != 'true' }}
run: |
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
apt-get install -y ca-certificates git
- name: Populate sysroot (golang, new distro)
if: ${{ steps.schroot-cache.outputs.cache-hit != 'true' && (env.HOST_DISTRO == 'focal' || env.HOST_DISTRO == 'jammy' || env.HOST_DISTRO == 'bookworm' || env.HOST_DISTRO == 'sid') }}
run: |
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
apt-get install -y golang
- name: Populate sysroot (golang, old distro)
if: ${{ steps.schroot-cache.outputs.cache-hit != 'true' && env.HOST_DISTRO != 'focal' && env.HOST_DISTRO != 'jammy' && env.HOST_DISTRO != 'bookworm' && env.HOST_DISTRO != 'sid' }}
run: |
# shipped with debian bullseye
curl -O http://ftp.us.debian.org/debian/pool/main/g/golang-defaults/golang_1.15~1_${{ env.BUILD_ARCH }}.deb
curl -O http://ftp.us.debian.org/debian/pool/main/g/golang-defaults/golang-go_1.15~1_${{ env.BUILD_ARCH }}.deb
curl -O http://ftp.us.debian.org/debian/pool/main/g/golang-defaults/golang-src_1.15~1_${{ env.BUILD_ARCH }}.deb
curl -O http://ftp.us.debian.org/debian/pool/main/g/golang-defaults/golang-doc_1.15~1_all.deb
curl -O http://ftp.us.debian.org/debian/pool/main/g/golang-1.15/golang-1.15_1.15.15-1~deb11u4_all.deb
curl -O http://ftp.us.debian.org/debian/pool/main/g/golang-1.15/golang-1.15-go_1.15.15-1~deb11u4_${{ env.BUILD_ARCH }}.deb
curl -O http://ftp.us.debian.org/debian/pool/main/g/golang-1.15/golang-1.15-src_1.15.15-1~deb11u4_${{ env.BUILD_ARCH }}.deb
curl -O http://ftp.us.debian.org/debian/pool/main/g/golang-1.15/golang-1.15-doc_1.15.15-1~deb11u4_all.deb
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
dpkg --force-depends -i $PWD/*.deb || true
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
apt-get install -y -f
rm -f *.deb
- name: Populate depedencie (cmake, new distro)
if: ${{ steps.schroot-cache.outputs.cache-hit != 'true' && (env.HOST_DISTRO == 'focal' || env.HOST_DISTRO == 'jammy' || env.HOST_DISTRO == 'bookworm' || env.HOST_DISTRO == 'sid') }}
run: |
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
apt-get install -y cmake
- name: Populate depedencie (cmake, old distro)
if: ${{ steps.schroot-cache.outputs.cache-hit != 'true' && env.HOST_DISTRO != 'focal' && env.HOST_DISTRO != 'jammy' && env.HOST_DISTRO != 'bookworm' && env.HOST_DISTRO != 'sid' }}
run: |
# fallback cmake: https://cmake.org/files/v3.12/cmake-3.12.4-Linux-x86_64.tar.gz
curl -L -O https://github.com/Kitware/CMake/releases/download/v3.22.3/cmake-3.22.3-linux-x86_64.tar.gz
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
tar -C /usr --strip-components=1 -xvf cmake-3.22.3-linux-x86_64.tar.gz
rm -f *.tar.gz
- name: Populate depedencie (base)
if: ${{ steps.schroot-cache.outputs.cache-hit != 'true' }}
run: |
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
apt-get install -y perl gcc g++ ninja-build debhelper
- name: Populate depedencie (gui, exclude some arches)
if: ${{ steps.schroot-cache.outputs.cache-hit != 'true' && env.HOST_ARCH != 'armel' && env.HOST_ARCH != 'mipsel' && env.HOST_ARCH != 'mips64el' && env.HOST_ARCH != 'riscv64' }}
run: |
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
apt-get install -y pkg-config libglib2.0-dev:${{ env.HOST_ARCH }} libgtk-3-dev:${{ env.HOST_ARCH }}
- name: Populate depedencie (curl, for test purpose, exclude some arches)
if: ${{ steps.schroot-cache.outputs.cache-hit != 'true' && env.HOST_ARCH != 'armel' && env.HOST_ARCH != 'mipsel' && env.HOST_ARCH != 'mips64el' && env.HOST_ARCH != 'riscv64' }}
run: |
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
apt-get install -y libcurl4-openssl-dev:${{ env.HOST_ARCH }}
- name: Populate depedencie (list upgradable packages)
run: |
sudo schroot --chroot "source:${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}" --user root -- \
apt list --upgradeable || true
- name: Build deb
run: |
export DEB_BUILD_PROFILES
export DH_QUIET
sudo -E sudo -E -u "$USER" -g sbuild ./scripts/build-deb.sh
- name: Upload dist tarball (including debuginfo)
if: ${{ github.event_name == 'release' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.event.release.tag_name }} yass*.deb
- name: Shutdown schroot sessions
run: |
sudo schroot --end-session --all-sessions
- name: Fix schroot dev nodes permissions
if: ${{ steps.schroot-cache.outputs.cache-hit != 'true' }}
run: |
sudo rm -rf /var/lib/schroot/chroots/${{ env.HOST_DISTRO }}-${{ env.BUILD_ARCH }}-${{ env.HOST_ARCH }}/dev
- name: Fix schroot permissions (restore store permissions)
if: ${{ steps.schroot-cache.outputs.cache-hit != 'true' }}
run: |
sudo chown -R $USER /etc/schroot/chroot.d /var/lib/schroot/chroots