mirror of
https://github.com/xemu-project/xemu.git
synced 2026-07-11 01:24:41 +02:00
f7432c68cf
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 8.0.0 to 8.0.1. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3...3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-version: 8.0.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
176 lines
6.2 KiB
YAML
176 lines
6.2 KiB
YAML
name: Build for Linux
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
pkg_version:
|
|
description: Build version
|
|
required: true
|
|
type: string
|
|
|
|
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:
|
|
ARTIFACT_NAME: xemu-ubuntu-${{ matrix.arch }}-${{ matrix.configuration }}
|
|
CCACHE_DIR: /tmp/xemu-ccache
|
|
CCACHE_MAXSIZE: 512M
|
|
LTO_CACHE_DIR: /tmp/xemu-lto-cache
|
|
LTO_CACHE_MAXSIZE: 512m
|
|
DEB_BUILD_MAINT_OPTIONS: optimize=-lto
|
|
DEB_CFLAGS_MAINT_APPEND: -gdwarf-4 -gstrict-dwarf
|
|
DEB_CXXFLAGS_MAINT_APPEND: -gdwarf-4 -gstrict-dwarf
|
|
DEB_LDFLAGS_MAINT_APPEND: -Wl,--build-id=sha1
|
|
CC: ccache clang-21
|
|
CXX: ccache clang++-21
|
|
CC_LD: lld-21
|
|
CXX_LD: lld-21
|
|
AR: llvm-ar-21
|
|
RANLIB: llvm-ranlib-21
|
|
NM: llvm-nm-21
|
|
steps:
|
|
- name: Setup build options
|
|
run: |
|
|
if [[ "${{ matrix.configuration }}" == "debug" ]]; then
|
|
opts=(
|
|
--debug
|
|
)
|
|
else
|
|
opts=(
|
|
--extra-ldflags="-Wl,--thinlto-cache-policy=cache_size_bytes=$LTO_CACHE_MAXSIZE"
|
|
-Db_lto=true
|
|
-Db_lto_mode=thin
|
|
-Db_thinlto_cache=true
|
|
-Db_thinlto_cache_dir="$LTO_CACHE_DIR"
|
|
)
|
|
mkdir -p ${LTO_CACHE_DIR}
|
|
fi
|
|
echo "XEMU_BUILD_OPTIONS=${opts[*]}" >> "$GITHUB_ENV"
|
|
- name: Initialize compiler cache
|
|
id: cache
|
|
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4
|
|
with:
|
|
path: |
|
|
${{ env.CCACHE_DIR }}
|
|
${{ env.LTO_CACHE_DIR }}
|
|
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@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v4
|
|
with:
|
|
name: src
|
|
- name: Extract source package
|
|
run: |
|
|
mkdir src
|
|
tar -xf xemu-${{ inputs.pkg_version }}.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 ${{ inputs.pkg_version }})\n\
|
|
-- Matt Borgerson <contact@mborgerson.com> $(date -R)" > debian/changelog
|
|
popd
|
|
- name: Add LLVM APT repository
|
|
run: |
|
|
sudo install -d /etc/apt/keyrings
|
|
curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key \
|
|
| sudo gpg --dearmor -o /etc/apt/keyrings/llvm.gpg
|
|
sudo tee /etc/apt/sources.list.d/llvm.list <<EOF
|
|
deb [signed-by=/etc/apt/keyrings/llvm.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-21 main
|
|
deb-src [signed-by=/etc/apt/keyrings/llvm.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-21 main
|
|
EOF
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get -qy update
|
|
sudo apt-get install ccache libfuse2 libusb-1.0-0-dev #clang-21 lld-21 llvm-21-dev
|
|
pushd src
|
|
sudo apt-get -qy build-dep .
|
|
- name: Install LLVM 21
|
|
shell: bash
|
|
env:
|
|
ARCH: ${{ matrix.arch == 'aarch64' && 'arm64' || 'amd64' }}
|
|
POOL: https://apt.llvm.org/jammy/pool/main/l/llvm-toolchain-21/
|
|
run: |
|
|
set -euxo pipefail
|
|
|
|
# Install the newest version that actually exists in the pool.
|
|
# We derive the exact version string from one known package filename.
|
|
HTML="$(curl -fsSL --compressed "$POOL")"
|
|
VER="$(grep -oE 'libllvm21_[0-9][^"]+_${{ env.ARCH }}\.deb' <<<"$HTML" | head -n1 \
|
|
| sed -E 's/^libllvm21_//; s/_${{ env.ARCH }}\.deb$//')"
|
|
echo "Using pool version: $VER"
|
|
|
|
mkdir -p /tmp/llvm21 && cd /tmp/llvm21
|
|
|
|
fetch() {
|
|
local pkg="$1"
|
|
local file="${pkg}_${VER}_${{ env.ARCH }}.deb"
|
|
curl -fsSLO "${POOL}${file}"
|
|
}
|
|
|
|
for pkg in \
|
|
clang-21 clang-tools-21 lld-21 \
|
|
libllvm21 libclang-cpp21 libclang-common-21-dev libclang1-21 libclang-rt-21-dev \
|
|
llvm-21 llvm-21-dev llvm-21-linker-tools llvm-21-runtime llvm-21-tools
|
|
do
|
|
fetch "$pkg"
|
|
done
|
|
|
|
# Install the downloaded LLVM debs. apt will resolve any non-LLVM deps from Ubuntu repos.
|
|
sudo apt-get install -y --no-install-recommends ./*.deb
|
|
- name: Setup ccache
|
|
run: |
|
|
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
|
|
mkdir -p ${CCACHE_DIR}
|
|
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
|
|
env:
|
|
VERSION: ${{ inputs.pkg_version }}${{ matrix.configuration == 'debug' && '-dbg' || '' }}
|
|
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
|
|
|
|
./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@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v4
|
|
with:
|
|
name: ${{ env.ARTIFACT_NAME }}
|
|
path: dist
|
|
compression-level: 0
|