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