|
| 1 | +name: Build a Debian package using an overlay recipe |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + config: |
| 7 | + description: 'Path to the YAML configuration file' |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + arch: [amd64, arm64] |
| 16 | + runs-on: [self-hosted, qcom-u2404, "${{ matrix.arch }}"] |
| 17 | + container: |
| 18 | + image: debian:trixie |
| 19 | + options: --privileged # Required for chroot creation |
| 20 | + steps: |
| 21 | + - name: Update OS packages |
| 22 | + run: | |
| 23 | + set -ux |
| 24 | + apt update |
| 25 | + DEBIAN_FRONTEND=noninteractive apt -y upgrade |
| 26 | + DEBIAN_FRONTEND=noninteractive apt -y full-upgrade |
| 27 | +
|
| 28 | + - name: Checkout repository |
| 29 | + uses: actions/checkout@v4 |
| 30 | + |
| 31 | + - name: Install sbuild and dependencies |
| 32 | + run: | |
| 33 | + set -ux |
| 34 | + DEBIAN_FRONTEND=noninteractive \ |
| 35 | + apt -y install --no-install-recommends \ |
| 36 | + sudo sbuild gnupg debootstrap debian-archive-keyring schroot |
| 37 | +
|
| 38 | + - name: Set up sbuild user |
| 39 | + run: | |
| 40 | + set -ux |
| 41 | + useradd -m builder |
| 42 | + echo 'builder ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers |
| 43 | + mkdir -p /etc/sbuild |
| 44 | + echo 'builder' > /etc/sbuild/buildd.conf |
| 45 | + sbuild-adduser builder |
| 46 | +
|
| 47 | + - name: Create sbuild chroot for target suite |
| 48 | + run: | |
| 49 | + set -ux |
| 50 | + # to read yaml config |
| 51 | + DEBIAN_FRONTEND=noninteractive \ |
| 52 | + apt -y install --no-install-recommends python3 python3-yaml |
| 53 | + # read suite from yaml |
| 54 | + suite="$(python3 -c "import yaml; print(yaml.safe_load(open('${CONFIG_PATH}'))['suite'])")" |
| 55 | + # defaults args |
| 56 | + extra_repo="" |
| 57 | + debootstrap_suite="${suite}" |
| 58 | + chroot_prefix="" |
| 59 | + if [ "${suite}" = experimental ]; then |
| 60 | + # special extra args for experimental |
| 61 | + debootstrap_suite='unstable' |
| 62 | + extra_repo='--extra-repository=deb http://deb.debian.org/debian experimental main' |
| 63 | + chroot_prefix='--chroot-prefix=experimental' |
| 64 | + fi |
| 65 | + sudo sbuild-createchroot --include=eatmydata,ccache \ |
| 66 | + ${extra_repo:+"${extra_repo}"} \ |
| 67 | + ${chroot_prefix:+"${chroot_prefix}"} \ |
| 68 | + "${debootstrap_suite}" \ |
| 69 | + "/srv/chroot/${suite}-${{ matrix.runs_on }}-sbuild" \ |
| 70 | + http://deb.debian.org/debian |
| 71 | +
|
| 72 | + - name: Download and build deb package |
| 73 | + run: | |
| 74 | + set -ux |
| 75 | + # install dependencies |
| 76 | + DEBIAN_FRONTEND=noninteractive \ |
| 77 | + apt -y install --no-install-recommends \ |
| 78 | + python3 devscripts patch python3-yaml debian-keyring |
| 79 | + # create output dir |
| 80 | + mkdir -v upload |
| 81 | + chmod a+rw upload |
| 82 | + sudo -u builder python3 scripts/build-deb.py \ |
| 83 | + --config "${CONFIG_PATH}" --output-dir upload |
| 84 | +
|
| 85 | + - name: Upload as private artifacts |
| 86 | + uses: qualcomm-linux/upload-private-artifact-action@v1 |
| 87 | + with: |
| 88 | + path: upload |
| 89 | + |
0 commit comments