|
| 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 | +env: |
| 22 | + # github runs are only unique per repository and may also be re-run; create a |
| 23 | + # build id for the current run |
| 24 | + BUILD_ID: ${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }} |
| 25 | + FILESERVER_URL: https://quic-yocto-fileserver-1029608027416.us-central1.run.app |
| 26 | + |
| 27 | +# cancel in progress builds for this workflow triggered by the same ref |
| 28 | +concurrency: |
| 29 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 30 | + cancel-in-progress: true |
| 31 | + |
| 32 | +jobs: |
| 33 | + build-debos: |
| 34 | + runs-on: [self-hosted, arm64, debbuilder] |
| 35 | + container: |
| 36 | + image: debian:trixie |
| 37 | + volumes: |
| 38 | + - /srv/gh-runners/quic-yocto/builds:/fileserver-builds |
| 39 | + - /srv/gh-runners/quic-yocto/downloads:/fileserver-downloads |
| 40 | + options: --privileged |
| 41 | + steps: |
| 42 | + # make sure we have latest packages first, to get latest fixes and to |
| 43 | + # avoid an automated update while we're building |
| 44 | + - name: Update OS packages |
| 45 | + run: | |
| 46 | + set -ux |
| 47 | + apt update |
| 48 | + apt -y upgrade |
| 49 | + apt -y full-upgrade |
| 50 | + |
| 51 | + - uses: actions/checkout@v4 |
| 52 | + with: |
| 53 | + fetch-depth: 0 |
| 54 | + |
| 55 | + - name: Copy Linux deb and U-Boot for RB1 from fileserver space for downloads |
| 56 | + run: | |
| 57 | + set -ux |
| 58 | + mkdir -v debos-recipes/local-debs |
| 59 | + dir="/fileserver-downloads/qcom-deb-images" |
| 60 | + # copy linux-image but not the -dbg e.g. |
| 61 | + # linux-image-6.15.0-..._6.15.0...-1_arm64.deb but not |
| 62 | + # linux-image-6.15.0-...-dbg_6.15.0...-1_arm64.deb |
| 63 | + find "${dir}/linux-deb-latest/" \ |
| 64 | + -name linux-image\*.deb \ |
| 65 | + -not -name linux-image\*-dbg_\*.deb \ |
| 66 | + -exec cp -av '{}' debos-recipes/local-debs/ \; |
| 67 | + # copy U-Boot RB1 binary |
| 68 | + cp -av "${dir}/u-boot-rb1-latest/rb1-boot.img" . |
| 69 | + |
| 70 | + # mtools is needed for the flash recipe |
| 71 | + - name: Install debos and dependencies of the recipes |
| 72 | + run: apt -y install debos mtools |
| 73 | + |
| 74 | + - name: Build rootfs with debos |
| 75 | + run: | |
| 76 | + set -ux |
| 77 | + debos -t xfcedesktop:true -t localdebs:local-debs/ \ |
| 78 | + debos-recipes/qualcomm-linux-debian-rootfs.yaml |
| 79 | + |
| 80 | + - name: Build UFS and SD card images with debos |
| 81 | + run: | |
| 82 | + set -ux |
| 83 | + # debos tries KVM and UML as backends, and falls back to |
| 84 | + # building directly on the host, but that requires loop |
| 85 | + # devices; use qemu backend explicitly even if it's slower; |
| 86 | + # qemu backend also requires to set scratchsize, otherwise the |
| 87 | + # whole build is done from memory and the out of memory killer |
| 88 | + # gets triggered |
| 89 | + debos -b qemu --scratchsize 4GiB -t imagetype:ufs \ |
| 90 | + debos-recipes/qualcomm-linux-debian-image.yaml |
| 91 | + debos -b qemu --scratchsize 4GiB -t imagetype:sdcard \ |
| 92 | + debos-recipes/qualcomm-linux-debian-image.yaml |
| 93 | + |
| 94 | + - name: Build flashable files with debos |
| 95 | + run: | |
| 96 | + set -ux |
| 97 | + debos -t u_boot_rb1:rb1-boot.img \ |
| 98 | + debos-recipes/qualcomm-linux-debian-flash.yaml |
| 99 | + |
| 100 | + - name: Upload artifacts to fileserver space for builds |
| 101 | + run: | |
| 102 | + set -ux |
| 103 | + # curl will be used to talk to fileserver; should be installed by |
| 104 | + # default |
| 105 | + apt -y install curl |
| 106 | + # create a directory for the current run |
| 107 | + dir="/fileserver-builds/${BUILD_ID}" |
| 108 | + mkdir -vp "${dir}" |
| 109 | + # copy output files |
| 110 | + cp -av rootfs.tar.gz "${dir}" |
| 111 | + cp -av dtbs.tar.gz "${dir}" |
| 112 | + cp -av disk-ufs.img.gz "${dir}" |
| 113 | + cp -av disk-sdcard.img.gz "${dir}" |
| 114 | + # TODO: separate flash_* directories between UFS and eMMC |
| 115 | + tar -cvf "${dir}"/flash-ufs.tar.gz \ |
| 116 | + disk-ufs.img1 \ |
| 117 | + disk-ufs.img2 \ |
| 118 | + flash_rb3* |
| 119 | + tar -cvf "${dir}"/flash-emmc.tar.gz \ |
| 120 | + disk-sdcard.img1 \ |
| 121 | + disk-sdcard.img2 \ |
| 122 | + flash_rb1* |
| 123 | + # instruct fileserver to publish this directory |
| 124 | + url="${FILESERVER_URL}/${BUILD_ID}/" |
| 125 | + curl -X POST -H 'Accept: text/event-stream' "${url}" |
| 126 | + |
0 commit comments