[WIP] Run CI on QEMU #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-FileCopyrightText: 2023 fosslinux <[email protected]> | |
| # | |
| # SPDX-License-Identifier: GPL-3.0-or-later | |
| name: Run under QEMU | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| build: | |
| name: Run under QEMU | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Install qemu | |
| run: > | |
| sudo apt-get install build-essential libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev ninja-build && | |
| curl -L -O https://download.qemu.org/qemu-10.1.1.tar.xz && | |
| tar -xf qemu-10.1.1.tar.xz && | |
| cd qemu-10.1.1 && | |
| mkdir build && | |
| cd build && | |
| ../configure --disable-user --without-default-features --target-list=i386-softmmu --enable-system && | |
| ninja && | |
| sudo ninja install | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| # There is a strange bug(?) in nongnu, when you clone a git repository | |
| # against a commit != HEAD with depth=1, it errors out. | |
| fetch-depth: 0 | |
| - name: Query cache for sources | |
| id: cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| mirror | |
| mirror-state | |
| key: cache-${{ hashFiles('steps/*/sources') }} | |
| restore-keys: | | |
| cache- | |
| - name: Get sources | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: mkdir -p mirror mirror-state && ./mirror.sh mirror mirror-state | |
| - name: Cache sources | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| mirror | |
| mirror-state | |
| key: cache-${{ hashFiles('steps/*/sources') }} | |
| - name: Run bootstrap | |
| run: > | |
| ulimit -c unlimited && | |
| sudo ./rootfs.py --qemu --qemu-cmd qemu-system-i386 --external-sources --cores 2 --mirror file://${PWD}/mirror ; | |
| echo $? ; | |
| sudo coredumpctl list; | |
| sudo coredumpctl dump | |
| - name: Remount package disk | |
| if: always() | |
| run: > | |
| DEV=$(sudo losetup -f --show target/external.img) && | |
| sudo partprobe ${DEV} && | |
| mkdir -p mnt && | |
| sudo mount ${DEV}p1 mnt | |
| - name: Archive created packages | |
| if: always() # archive both failed and successful builds | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: packages | |
| path: mnt/repo/** |