Files
xemu/.github/workflows/build-linux.yml
2026-01-04 23:38:25 -07:00

101 lines
3.4 KiB
YAML

name: Build for Linux
on:
workflow_call:
jobs:
build:
name: Build for Ubuntu (${{matrix.arch}}, ${{ matrix.configuration }})
runs-on: ubuntu-22.04${{ matrix.arch == 'aarch64' && '-arm' || '' }}
strategy:
matrix:
arch: [x86_64, aarch64]
configuration: [debug, release]
env:
CCACHE_DIR: /tmp/xemu-ccache
CCACHE_MAXSIZE: 512M
XEMU_BUILD_OPTIONS: ${{ matrix.configuration == 'debug' && '--debug' || '' }}
ARTIFACT_NAME: xemu-ubuntu-${{ matrix.arch }}-${{ matrix.configuration }}
steps:
- name: Initialize compiler cache
id: cache
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v4
with:
path: /tmp/xemu-ccache
key: cache-${{ runner.os }}-${{ matrix.arch }}-${{ matrix.configuration }}-${{ github.sha }}
restore-keys: cache-${{ runner.os }}-${{ matrix.arch }}-${{ matrix.configuration }}-
- name: Download source package
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v4
with:
name: src
- name: Extract source package
run: |
mkdir src
tar -xf xemu-*.tar.zst -C src --strip-components=2
- name: Create debian changelog
run: |
pushd src
echo -e "\
xemu (1:0.0.0-0) unstable; urgency=medium\n\
Built from $(cat XEMU_VERSION)\n\
-- Matt Borgerson <contact@mborgerson.com> $(date -R)" > debian/changelog
popd
- name: Install dependencies
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get -qy update
sudo apt-get install ccache libfuse2 libusb-1.0-0-dev
pushd src
sudo apt-get -qy build-dep .
- name: Setup ccache
run: |
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
ccache -z
- name: Compile
run: |
# XXX: dpkg-genbuildinfo takes two minutes on GH runners. Nuke it for now.
sudo rm /usr/bin/dpkg-genbuildinfo
sudo ln -s /bin/true /usr/bin/dpkg-genbuildinfo
pushd src
dpkg-buildpackage --no-sign -b
popd
mkdir -p deb
mv *.deb *.ddeb deb
- name: Test
run: |
pushd src/build
./pyvenv/bin/meson compile test-xbox
./pyvenv/bin/meson test --suite xbox --no-rebuild
popd
- name: Report ccache stats
run: ccache -s
- name: Generate AppImage
run: |
wget --no-verbose https://github.com/linuxdeploy/linuxdeploy/releases/latest/download/linuxdeploy-${{ matrix.arch }}.AppImage
chmod +x linuxdeploy-${{ matrix.arch }}.AppImage
ar x deb/*.deb
mkdir appimage
tar -C appimage -xf data.tar*
install -DT src/xemu.metainfo.xml appimage/usr/share/metainfo/xemu.metainfo.xml
export VERSION=$(cat src/XEMU_VERSION)
if [[ "${{ matrix.configuration }}" == "debug" ]]; then
export VERSION=$VERSION-dbg
fi
./linuxdeploy-${{ matrix.arch }}.AppImage --output appimage --appdir appimage
- name: Bundle artifacts
run: |
mkdir -p dist
tar -czvf ./dist/${{ env.ARTIFACT_NAME }}.tgz --transform "s#^dist#${{ env.ARTIFACT_NAME }}#" deb
mv xemu-*.AppImage dist
- name: Upload build artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: dist
compression-level: 0