Skip to content

Commit 5c69f62

Browse files
committed
ci: Build debos recipe
Signed-off-by: Loïc Minier <[email protected]>
1 parent 56f3da2 commit 5c69f62

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

.github/workflows/debos.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Build debos recipe
2+
3+
on:
4+
# run on pull requests to the main branch
5+
pull_request:
6+
branches: [main]
7+
# run on pushes to the main branch
8+
push:
9+
branches: [main]
10+
# run daily at 8:30am
11+
schedule:
12+
- cron: '30 8 * * *'
13+
# allow manual runs
14+
workflow_dispatch:
15+
16+
# only need permission to read repository; implicitely set all other
17+
# permissions to none
18+
permissions:
19+
contents: read
20+
21+
defaults:
22+
# run all commands from the debos-recipes directory
23+
run:
24+
working-directory: debos-recipes
25+
26+
env:
27+
INCUS_IMAGE: images:debian/trixie/arm64
28+
INCUS_NAME: debos
29+
30+
# cancel in progress builds for this workflow triggered by the same ref
31+
concurrency:
32+
group: ${{ github.workflow }}-${{ github.ref }}
33+
cancel-in-progress: true
34+
35+
jobs:
36+
build-debos:
37+
runs-on: [self-hosted, arm64, debbuilder]
38+
steps:
39+
- uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 0
42+
43+
# this is the default in our self-hosted runners
44+
- name: Make sure Incus is setup
45+
run: |
46+
set -x
47+
sudo apt -y install incus
48+
sudo incus admin init --auto
49+
50+
# create a fresh container build environment to decouple the build
51+
# operating system from the github runner one; install debos
52+
- name: Setup build environment
53+
run: |
54+
set -x
55+
# privileged container as debos will use mounts
56+
sudo incus init "${INCUS_IMAGE}" "${INCUS_NAME}" \
57+
-c security.privileged=true -c security.nesting=true
58+
sudo incus start "${INCUS_NAME}"
59+
# wait for network to be up (prior to running apt)
60+
sudo incus exec "${INCUS_NAME}" \
61+
/usr/lib/systemd/systemd-networkd-wait-online
62+
(
63+
# these commands are run inside the container
64+
cat <<EOF
65+
apt update
66+
apt upgrade -y
67+
apt install -y debos
68+
EOF
69+
) | sudo incus exec "${INCUS_NAME}" -- sh
70+
71+
- name: Build debos recipe
72+
run: |
73+
set -x
74+
# mount current directory under /build
75+
sudo incus config device add "${INCUS_NAME}" build-dir \
76+
disk "source=${PWD}" path=/build shift=true
77+
(
78+
# these commands are run inside the container
79+
cat <<EOF
80+
cd /build
81+
# debos tries KVM and UML as backends, and falls back to building
82+
# directly on the host, but that requires loop devices; use
83+
# qemu backend explicitly even if it's slower
84+
# qemu backend also requires to set scratchsize, otherwise
85+
# the whole build is done from memory and the out of memory
86+
# killer gets triggered
87+
debos -b qemu --scratchsize 4GiB qualcomm-linux-debian.yaml
88+
EOF
89+
) | sudo incus exec "${INCUS_NAME}" -- sh
90+

0 commit comments

Comments
 (0)