Skip to content

Build Turnip Weekly #15

Build Turnip Weekly

Build Turnip Weekly #15

name: Build Turnip Weekly
on:
schedule:
- cron: '18 10 * * 1'
workflow_dispatch:
inputs:
mesa_git_url:
description: 'Mesa git URL'
required: false
type: string
mesa_git_branch:
description: 'Mesa git branch'
required: false
type: string
mesa_hash:
description: 'Mesa commit hash'
required: false
type: string
skip_update_release:
description: 'Skip update-release'
required: false
type: boolean
default: false
skip_apply_patches:
description: 'Skip applying patches'
required: false
type: boolean
default: false
permissions:
contents: write
jobs:
prepare-source:
runs-on: ubuntu-24.04-arm
outputs:
mesa_hash: ${{ steps.resolve.outputs.mesa_hash }}
steps:
- name: Resolve Mesa hash
id: resolve
shell: bash
run: |
set -euo pipefail
mesa_git_url="${{ github.event.inputs.mesa_git_url || '' }}"
mesa_git_branch="${{ github.event.inputs.mesa_git_branch || '' }}"
input_hash="${{ github.event.inputs.mesa_hash || '' }}"
if [ -z "$mesa_git_url" ]; then
mesa_git_url="https://gitlab.freedesktop.org/mesa/mesa.git"
fi
if [ -z "$mesa_git_branch" ]; then
mesa_git_branch="main"
fi
if [ -n "$input_hash" ]; then
echo "Using user-provided Mesa hash: $input_hash"
echo "mesa_hash=$input_hash" >> "$GITHUB_OUTPUT"
exit 0
fi
resolved_hash=$(git ls-remote "$mesa_git_url" "refs/heads/$mesa_git_branch" | awk '{print $1}')
if [ -z "$resolved_hash" ]; then
echo "Failed to resolve latest hash for branch $mesa_git_branch from $mesa_git_url"
exit 1
fi
echo "Resolved latest Mesa $mesa_git_branch hash from $mesa_git_url: $resolved_hash"
echo "mesa_hash=$resolved_hash" >> "$GITHUB_OUTPUT"
- name: Prepare Mesa source
shell: bash
run: |
set -euo pipefail
retry() {
local max_attempts="$1"
local delay_seconds="$2"
shift 2
local attempt=1
until "$@"; do
if [ "$attempt" -ge "$max_attempts" ]; then
echo "Command failed after ${max_attempts} attempts: $*"
return 1
fi
echo "Attempt ${attempt}/${max_attempts} failed: $*"
echo "Retrying in ${delay_seconds}s..."
sleep "$delay_seconds"
attempt=$((attempt + 1))
done
}
cd ~
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
rm -rf mesa-for-android-container mesa-for-android-container-ci
mesa_git_url="${{ github.event.inputs.mesa_git_url || '' }}"
mesa_git_branch="${{ github.event.inputs.mesa_git_branch || '' }}"
if [ -z "$mesa_git_url" ]; then
mesa_git_url="https://gitlab.freedesktop.org/mesa/mesa.git"
fi
if [ -z "$mesa_git_branch" ]; then
mesa_git_branch="main"
fi
mesa_hash="${{ steps.resolve.outputs.mesa_hash }}"
retry 5 30 git clone -b "$mesa_git_branch" --depth 1 --single-branch --no-tags "$mesa_git_url" mesa-for-android-container
cd mesa-for-android-container
retry 5 30 git fetch origin "$mesa_hash"
git checkout --detach "$mesa_hash"
skip_apply_patches="${{ github.event_name == 'workflow_dispatch' && inputs.skip_apply_patches }}"
if [ "$skip_apply_patches" = "true" ]; then
echo "Skipping patch application as requested by workflow_dispatch input"
else
cd ~
retry 5 30 git clone -b ci --depth 1 --single-branch --no-tags ${{ github.server_url }}/${{ github.repository }}.git mesa-for-android-container-ci
patch_dir=~/mesa-for-android-container-ci/patches/turnip-weekly
if [ ! -d "$patch_dir" ]; then
echo "Patch directory not found: $patch_dir"
exit 1
fi
mapfile -t patches < <(find "$patch_dir" -maxdepth 1 -type f -name '*.patch' -printf '%f\n' | sort)
if [ "${#patches[@]}" -eq 0 ]; then
echo "No patches found in $patch_dir"
else
cd ~/mesa-for-android-container
for patch in "${patches[@]}"; do
echo "Applying $patch"
git apply --index "$patch_dir/$patch"
done
if git diff --cached --quiet; then
echo "No staged patch changes after apply"
else
git commit -m "Apply turnip-weekly patches"
fi
fi
fi
- name: Archive prepared Mesa source
shell: bash
run: |
set -euo pipefail
cd ~
tar -zcf mesa-source-prepared.tar.gz mesa-for-android-container
- name: Upload prepared Mesa source
uses: actions/upload-artifact@v7
with:
name: mesa-source-prepared
path: ~/mesa-source-prepared.tar.gz
retention-days: 1
debian-trixie:
needs: prepare-source
runs-on: ubuntu-24.04-arm
container:
image: debian:trixie-slim
options: --privileged --user root
steps:
- name: Install dependencies
run: |
retry() {
local max_attempts="$1"
local delay_seconds="$2"
shift 2
local attempt=1
until "$@"; do
if [ "$attempt" -ge "$max_attempts" ]; then
echo "Command failed after ${max_attempts} attempts: $*"
return 1
fi
echo "Attempt ${attempt}/${max_attempts} failed: $*"
echo "Retrying in ${delay_seconds}s..."
sleep "$delay_seconds"
attempt=$((attempt + 1))
done
}
sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/debian.sources
retry 5 30 apt update
retry 5 30 apt build-dep -y mesa
retry 5 30 apt install -y git ccache libxfixes-dev libarchive-dev
- name: Cache ccache
uses: actions/cache@v5
with:
path: /root/.ccache
key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: |
ccache-${{ runner.os }}-${{ runner.arch }}-
- name: Configure ccache
run: |
export CCACHE_DIR=/root/.ccache
ccache --max-size=2G
ccache --show-config
ccache --zero-stats
ccache --show-stats
- name: Download prepared source
uses: actions/download-artifact@v8
with:
name: mesa-source-prepared
path: ${{ github.workspace }}/artifacts
- name: Extract prepared source
shell: bash
run: |
set -euo pipefail
rm -rf ~/mesa-for-android-container
archive_path=$(find "$GITHUB_WORKSPACE/artifacts" -type f -name 'mesa-source-prepared.tar.gz' | head -n1)
if [ -z "$archive_path" ]; then
echo "Prepared source archive not found under $GITHUB_WORKSPACE/artifacts"
exit 1
fi
tar -zxf "$archive_path" -C ~
- name: Set release name suffix
shell: bash
run: |
cd ~/mesa-for-android-container
version=$(grep -v '^[[:space:]]*$' VERSION | head -n1)
build_date=$(TZ=Asia/Shanghai date +%Y%m%d)
echo "MESA_RELEASE_NAME_SUFFIX=${version}-${build_date}_debian_trixie_arm64" >> "$GITHUB_ENV"
- name: Build Mesa
shell: bash
run: |
export CCACHE_DIR=/root/.ccache
echo "Building Mesa..."
cd ~/mesa-for-android-container
meson setup build/ \
--prefix=/usr \
-Dplatforms=x11,wayland \
-Dgallium-drivers= \
-Dgallium-va=disabled \
-Dgallium-mediafoundation=disabled \
-Dvulkan-drivers=freedreno \
-Dvulkan-layers= \
-Dgles1=disabled \
-Dgles2=disabled \
-Dopengl=false \
-Dgbm=disabled \
-Dglx=disabled \
-Dxlib-lease=disabled \
-Dfreedreno-kmds=kgsl \
-Degl=disabled \
-Dglvnd=disabled \
-Dintel-rt=disabled \
-Dmicrosoft-clc=disabled \
-Dllvm=disabled \
-Dvalgrind=disabled \
-Dbuild-tests=false \
-Dlibunwind=disabled \
-Dlmsensors=disabled \
-Dandroid-libbacktrace=disabled \
-Dbuildtype=release
ninja -C build/
echo "Mesa build completed successfully!"
- name: Save ccache
uses: actions/cache/save@v5
if: always()
with:
path: /root/.ccache
key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }}
- name: Package Mesa
shell: bash
run: |
echo "Packaging Mesa..."
cd ~/mesa-for-android-container
mkdir /tmp/mesa-install-tmp
DESTDIR=/tmp/mesa-install-tmp meson install -C build/
tar -zcvf turnip-weekly_${MESA_RELEASE_NAME_SUFFIX}.tar.gz -C /tmp/mesa-install-tmp .
rm -rf /tmp/mesa-install-tmp
echo "Calculating sha256 checksums..."
find . -maxdepth 1 \( -name "*.tar.gz" \) -type f -printf "%P\0" | xargs -0 sha256sum | sort -k2 > sha256sums.txt
cat sha256sums.txt && echo
echo "Packaging completed successfully!"
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: turnip-weekly_${{ env.MESA_RELEASE_NAME_SUFFIX }}_${{ needs.prepare-source.outputs.mesa_hash }}
path: |
~/mesa-for-android-container/*.tar.gz
~/mesa-for-android-container/sha256sums.txt
retention-days: 90
ubuntu-noble:
needs: prepare-source
runs-on: ubuntu-24.04-arm
steps:
- name: Install dependencies
run: |
retry() {
local max_attempts="$1"
local delay_seconds="$2"
shift 2
local attempt=1
until "$@"; do
if [ "$attempt" -ge "$max_attempts" ]; then
echo "Command failed after ${max_attempts} attempts: $*"
return 1
fi
echo "Attempt ${attempt}/${max_attempts} failed: $*"
echo "Retrying in ${delay_seconds}s..."
sleep "$delay_seconds"
attempt=$((attempt + 1))
done
}
sudo sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources
retry 5 30 sudo apt update
retry 5 30 sudo apt build-dep -y mesa
retry 5 30 sudo apt install -y git ccache libxfixes-dev libarchive-dev
- name: Cache ccache
uses: actions/cache@v5
with:
path: ~/.ccache
key: ccache-${{ runner.os }}-${{ runner.arch }}-runner-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: |
ccache-${{ runner.os }}-${{ runner.arch }}-runner-
- name: Configure ccache
run: |
export CCACHE_DIR=~/.ccache
ccache --max-size=2G
ccache --show-config
ccache --zero-stats
ccache --show-stats
- name: Download prepared source
uses: actions/download-artifact@v8
with:
name: mesa-source-prepared
path: ${{ github.workspace }}/artifacts
- name: Extract prepared source
shell: bash
run: |
set -euo pipefail
rm -rf ~/mesa-for-android-container
archive_path=$(find "$GITHUB_WORKSPACE/artifacts" -type f -name 'mesa-source-prepared.tar.gz' | head -n1)
if [ -z "$archive_path" ]; then
echo "Prepared source archive not found under $GITHUB_WORKSPACE/artifacts"
exit 1
fi
tar -zxf "$archive_path" -C ~
- name: Set release name suffix
shell: bash
run: |
cd ~/mesa-for-android-container
version=$(grep -v '^[[:space:]]*$' VERSION | head -n1)
build_date=$(TZ=Asia/Shanghai date +%Y%m%d)
echo "MESA_RELEASE_NAME_SUFFIX=${version}-${build_date}_ubuntu_noble_arm64" >> "$GITHUB_ENV"
- name: Build Mesa
shell: bash
run: |
export CCACHE_DIR=~/.ccache
export LLVM_CONFIG=/usr/lib/llvm-20/bin/llvm-config
echo "Building Mesa..."
cd ~/mesa-for-android-container
meson setup build/ \
--prefix=/usr \
-Dplatforms=x11,wayland \
-Dgallium-drivers= \
-Dgallium-va=disabled \
-Dgallium-mediafoundation=disabled \
-Dvulkan-drivers=freedreno \
-Dvulkan-layers= \
-Dgles1=disabled \
-Dgles2=disabled \
-Dopengl=false \
-Dgbm=disabled \
-Dglx=disabled \
-Dxlib-lease=disabled \
-Dfreedreno-kmds=kgsl \
-Degl=disabled \
-Dglvnd=disabled \
-Dintel-rt=disabled \
-Dmicrosoft-clc=disabled \
-Dllvm=disabled \
-Dvalgrind=disabled \
-Dbuild-tests=false \
-Dlibunwind=disabled \
-Dlmsensors=disabled \
-Dandroid-libbacktrace=disabled \
-Dbuildtype=release
ninja -C build/
echo "Mesa build completed successfully!"
- name: Save ccache
uses: actions/cache/save@v5
if: always()
with:
path: ~/.ccache
key: ccache-${{ runner.os }}-${{ runner.arch }}-runner-${{ github.run_id }}-${{ github.run_attempt }}
- name: Package Mesa
shell: bash
run: |
echo "Packaging Mesa..."
cd ~/mesa-for-android-container
sudo mkdir /tmp/mesa-install-tmp
sudo DESTDIR=/tmp/mesa-install-tmp meson install -C build/
sudo tar -zcvf turnip-weekly_${MESA_RELEASE_NAME_SUFFIX}.tar.gz -C /tmp/mesa-install-tmp .
sudo chown $USER:$(id -gn) turnip-weekly_${MESA_RELEASE_NAME_SUFFIX}.tar.gz
chmod 644 turnip-weekly_${MESA_RELEASE_NAME_SUFFIX}.tar.gz
sudo rm -rf /tmp/mesa-install-tmp
echo "Calculating sha256 checksums..."
find . -maxdepth 1 \( -name "*.tar.gz" \) -type f -printf "%P\0" | xargs -0 sha256sum | sort -k2 > sha256sums.txt
cat sha256sums.txt && echo
echo "Packaging completed successfully!"
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: turnip-weekly_${{ env.MESA_RELEASE_NAME_SUFFIX }}_${{ needs.prepare-source.outputs.mesa_hash }}
path: |
~/mesa-for-android-container/*.tar.gz
~/mesa-for-android-container/sha256sums.txt
retention-days: 90
fedora-43:
needs: prepare-source
runs-on: ubuntu-24.04-arm
container:
image: fedora:43
options: --privileged --user root
steps:
- name: Install dependencies
run: |
retry() {
local max_attempts="$1"
local delay_seconds="$2"
shift 2
local attempt=1
until "$@"; do
if [ "$attempt" -ge "$max_attempts" ]; then
echo "Command failed after ${max_attempts} attempts: $*"
return 1
fi
echo "Attempt ${attempt}/${max_attempts} failed: $*"
echo "Retrying in ${delay_seconds}s..."
sleep "$delay_seconds"
attempt=$((attempt + 1))
done
}
echo "assumeyes=True" >> /etc/dnf/dnf.conf
retry 5 30 dnf install -y dnf-plugins-core git ccache libarchive-devel
dnf config-manager setopt fedora-source.enabled=1 updates-source.enabled=1
retry 5 30 dnf makecache
retry 5 30 dnf builddep -y mesa
- name: Cache ccache
uses: actions/cache@v5
with:
path: /root/.ccache
key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: |
ccache-${{ runner.os }}-${{ runner.arch }}-
- name: Configure ccache
run: |
export CCACHE_DIR=/root/.ccache
ccache --max-size=2G
ccache --show-config
ccache --zero-stats
ccache --show-stats
- name: Download prepared source
uses: actions/download-artifact@v8
with:
name: mesa-source-prepared
path: ${{ github.workspace }}/artifacts
- name: Extract prepared source
shell: bash
run: |
set -euo pipefail
rm -rf ~/mesa-for-android-container
archive_path=$(find "$GITHUB_WORKSPACE/artifacts" -type f -name 'mesa-source-prepared.tar.gz' | head -n1)
if [ -z "$archive_path" ]; then
echo "Prepared source archive not found under $GITHUB_WORKSPACE/artifacts"
exit 1
fi
tar -zxf "$archive_path" -C ~
- name: Set release name suffix
shell: bash
run: |
cd ~/mesa-for-android-container
version=$(grep -v '^[[:space:]]*$' VERSION | head -n1)
build_date=$(TZ=Asia/Shanghai date +%Y%m%d)
echo "MESA_RELEASE_NAME_SUFFIX=${version}-${build_date}_fedora_43_arm64" >> "$GITHUB_ENV"
- name: Build Mesa
shell: bash
run: |
export CCACHE_DIR=/root/.ccache
echo "Building Mesa..."
cd ~/mesa-for-android-container
meson setup build/ \
--prefix=/usr \
-Dplatforms=x11,wayland \
-Dgallium-drivers= \
-Dgallium-va=disabled \
-Dgallium-mediafoundation=disabled \
-Dvulkan-drivers=freedreno \
-Dvulkan-layers= \
-Dgles1=disabled \
-Dgles2=disabled \
-Dopengl=false \
-Dgbm=disabled \
-Dglx=disabled \
-Dxlib-lease=disabled \
-Dfreedreno-kmds=kgsl \
-Degl=disabled \
-Dglvnd=disabled \
-Dintel-rt=disabled \
-Dmicrosoft-clc=disabled \
-Dllvm=disabled \
-Dvalgrind=disabled \
-Dbuild-tests=false \
-Dlibunwind=disabled \
-Dlmsensors=disabled \
-Dandroid-libbacktrace=disabled \
-Dbuildtype=release
ninja -C build/
echo "Mesa build completed successfully!"
- name: Save ccache
uses: actions/cache/save@v5
if: always()
with:
path: /root/.ccache
key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }}
- name: Package Mesa
shell: bash
run: |
echo "Packaging Mesa..."
cd ~/mesa-for-android-container
mkdir /tmp/mesa-install-tmp
DESTDIR=/tmp/mesa-install-tmp meson install -C build/
tar -zcvf turnip-weekly_${MESA_RELEASE_NAME_SUFFIX}.tar.gz -C /tmp/mesa-install-tmp .
rm -rf /tmp/mesa-install-tmp
echo "Calculating sha256 checksums..."
find . -maxdepth 1 \( -name "*.tar.gz" \) -type f -printf "%P\0" | xargs -0 sha256sum | sort -k2 > sha256sums.txt
cat sha256sums.txt && echo
echo "Packaging completed successfully!"
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: turnip-weekly_${{ env.MESA_RELEASE_NAME_SUFFIX }}_${{ needs.prepare-source.outputs.mesa_hash }}
path: |
~/mesa-for-android-container/*.tar.gz
~/mesa-for-android-container/sha256sums.txt
retention-days: 90
archlinux:
needs: prepare-source
runs-on: ubuntu-24.04-arm
container:
image: lfdevs/archlinuxarm:base-devel
options: --privileged --user root
steps:
- name: Install dependencies
run: |
retry() {
local max_attempts="$1"
local delay_seconds="$2"
shift 2
local attempt=1
until "$@"; do
if [ "$attempt" -ge "$max_attempts" ]; then
echo "Command failed after ${max_attempts} attempts: $*"
return 1
fi
echo "Attempt ${attempt}/${max_attempts} failed: $*"
echo "Retrying in ${delay_seconds}s..."
sleep "$delay_seconds"
attempt=$((attempt + 1))
done
}
retry 5 30 pacman -Syyu --noconfirm
retry 5 30 pacman -S --noconfirm base-devel git ccache clang directx-headers expat glibc libdisplay-info libdrm libelf libgcc libglvnd libpng libstdc++ libva libx11 libxcb libxext libxml2 libxrandr libxshmfence libxxf86vm llvm llvm-libs lm_sensors rust spirv-llvm-translator spirv-tools systemd-libs vulkan-icd-loader wayland xcb-util-keysyms zlib zstd cbindgen clang cmake elfutils glslang libclc meson python-mako python-packaging python-ply python-pycparser python-yaml rust-bindgen wayland-protocols xorgproto libsysprof-capture valgrind python-sphinx python-sphinx-hawkmoth byacc flex wayland wayland-protocols
- name: Cache ccache
uses: actions/cache@v5
with:
path: /root/.ccache
key: ccache-${{ runner.os }}-${{ runner.arch }}-runner-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: |
ccache-${{ runner.os }}-${{ runner.arch }}-runner-
- name: Configure ccache
run: |
export CCACHE_DIR=/root/.ccache
ccache --max-size=2G
ccache --show-config
ccache --zero-stats
ccache --show-stats
- name: Download prepared source
uses: actions/download-artifact@v8
with:
name: mesa-source-prepared
path: ${{ github.workspace }}/artifacts
- name: Extract prepared source
shell: bash
run: |
set -euo pipefail
rm -rf ~/mesa-for-android-container
archive_path=$(find "$GITHUB_WORKSPACE/artifacts" -type f -name 'mesa-source-prepared.tar.gz' | head -n1)
if [ -z "$archive_path" ]; then
echo "Prepared source archive not found under $GITHUB_WORKSPACE/artifacts"
exit 1
fi
tar -zxf "$archive_path" -C ~
- name: Set release name suffix
shell: bash
run: |
cd ~/mesa-for-android-container
version=$(grep -v '^[[:space:]]*$' VERSION | head -n1)
build_date=$(TZ=Asia/Shanghai date +%Y%m%d)
echo "MESA_RELEASE_NAME_SUFFIX=${version}-${build_date}_archlinux_arm64" >> "$GITHUB_ENV"
- name: Build Mesa
shell: bash
run: |
export CCACHE_DIR=/root/.ccache
echo "Building Mesa..."
cd ~/mesa-for-android-container
meson setup build/ \
--prefix=/usr \
-Dplatforms=x11,wayland \
-Dgallium-drivers= \
-Dgallium-va=disabled \
-Dgallium-mediafoundation=disabled \
-Dvulkan-drivers=freedreno \
-Dvulkan-layers= \
-Dgles1=disabled \
-Dgles2=disabled \
-Dopengl=false \
-Dgbm=disabled \
-Dglx=disabled \
-Dxlib-lease=disabled \
-Dfreedreno-kmds=kgsl \
-Degl=disabled \
-Dglvnd=disabled \
-Dintel-rt=disabled \
-Dmicrosoft-clc=disabled \
-Dllvm=disabled \
-Dvalgrind=disabled \
-Dbuild-tests=false \
-Dlibunwind=disabled \
-Dlmsensors=disabled \
-Dandroid-libbacktrace=disabled \
-Dbuildtype=release
ninja -C build/
echo "Mesa build completed successfully!"
- name: Save ccache
uses: actions/cache/save@v5
if: always()
with:
path: /root/.ccache
key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }}
- name: Package Mesa
shell: bash
run: |
echo "Packaging Mesa..."
cd ~/mesa-for-android-container
mkdir /tmp/mesa-install-tmp
DESTDIR=/tmp/mesa-install-tmp meson install -C build/
tar -zcvf turnip-weekly_${MESA_RELEASE_NAME_SUFFIX}.tar.gz -C /tmp/mesa-install-tmp .
rm -rf /tmp/mesa-install-tmp
echo "Calculating sha256 checksums..."
find . -maxdepth 1 \( -name "*.tar.gz" \) -type f -printf "%P\0" | xargs -0 sha256sum | sort -k2 > sha256sums.txt
cat sha256sums.txt && echo
echo "Packaging completed successfully!"
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: turnip-weekly_${{ env.MESA_RELEASE_NAME_SUFFIX }}_${{ needs.prepare-source.outputs.mesa_hash }}
path: |
~/mesa-for-android-container/*.tar.gz
~/mesa-for-android-container/sha256sums.txt
retention-days: 90
void-linux:
needs: prepare-source
runs-on: ubuntu-24.04-arm
container:
image: ghcr.io/void-linux/void-glibc-full:latest
options: --privileged --user root
steps:
- name: Install dependencies
run: |
retry() {
local max_attempts="$1"
local delay_seconds="$2"
shift 2
local attempt=1
until "$@"; do
if [ "$attempt" -ge "$max_attempts" ]; then
echo "Command failed after ${max_attempts} attempts: $*"
return 1
fi
echo "Attempt ${attempt}/${max_attempts} failed: $*"
echo "Retrying in ${delay_seconds}s..."
sleep "$delay_seconds"
attempt=$((attempt + 1))
done
}
retry 5 30 xbps-install -Syu
retry 5 30 xbps-install -y bash base-devel git ccache meson ninja pkg-config python3 flex bison libdrm-devel libX11-devel libxcb-devel libxshmfence-devel wayland-devel wayland-protocols zlib-devel expat-devel llvm18-devel clang18 libxml2-devel libarchive-devel python3-Mako python3-packaging python3-yaml python3-ply libffi-devel libzstd-devel glslang
- name: Cache ccache
uses: actions/cache@v5
with:
path: /root/.ccache
key: ccache-${{ runner.os }}-${{ runner.arch }}-void-turnip-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: |
ccache-${{ runner.os }}-${{ runner.arch }}-void-turnip-
- name: Configure ccache
run: |
export CCACHE_DIR=/root/.ccache
ccache --max-size=2G
ccache --zero-stats
- name: Download prepared source
uses: actions/download-artifact@v8
with:
name: mesa-source-prepared
path: ${{ github.workspace }}/artifacts
- name: Extract prepared source
shell: bash
run: |
set -euo pipefail
rm -rf ~/mesa-for-android-container
archive_path=$(find "$GITHUB_WORKSPACE/artifacts" -type f -name 'mesa-source-prepared.tar.gz' | head -n1)
if [ -z "$archive_path" ]; then
echo "Prepared source archive not found under $GITHUB_WORKSPACE/artifacts"
exit 1
fi
tar -zxf "$archive_path" -C ~
- name: Set release name suffix
shell: bash
run: |
cd ~/mesa-for-android-container
version=$(grep -v '^[[:space:]]*$' VERSION | head -n1)
build_date=$(TZ=Asia/Shanghai date +%Y%m%d)
echo "MESA_RELEASE_NAME_SUFFIX=${version}-${build_date}_void_arm64" >> "$GITHUB_ENV"
- name: Build Mesa
shell: bash
run: |
export CCACHE_DIR=/root/.ccache
cd ~/mesa-for-android-container
meson setup build/ \
--prefix=/usr \
-Dplatforms=x11,wayland \
-Dgallium-drivers= \
-Dgallium-va=disabled \
-Dgallium-mediafoundation=disabled \
-Dvulkan-drivers=freedreno \
-Dvulkan-layers= \
-Dgles1=disabled \
-Dgles2=disabled \
-Dopengl=false \
-Dgbm=disabled \
-Dglx=disabled \
-Dxlib-lease=disabled \
-Dfreedreno-kmds=kgsl \
-Degl=disabled \
-Dglvnd=disabled \
-Dintel-rt=disabled \
-Dmicrosoft-clc=disabled \
-Dllvm=disabled \
-Dvalgrind=disabled \
-Dbuild-tests=false \
-Dlibunwind=disabled \
-Dlmsensors=disabled \
-Dandroid-libbacktrace=disabled \
-Dbuildtype=release
ninja -C build/
- name: Save ccache
uses: actions/cache/save@v5
if: always()
with:
path: /root/.ccache
key: ccache-${{ runner.os }}-${{ runner.arch }}-void-turnip-${{ github.run_id }}-${{ github.run_attempt }}
- name: Package Mesa
shell: bash
run: |
echo "Packaging Mesa..."
cd ~/mesa-for-android-container
mkdir /tmp/mesa-install-tmp
DESTDIR=/tmp/mesa-install-tmp meson install -C build/
tar -zcvf turnip-weekly_${MESA_RELEASE_NAME_SUFFIX}.tar.gz -C /tmp/mesa-install-tmp .
rm -rf /tmp/mesa-install-tmp
echo "Calculating sha256 checksums..."
find . -maxdepth 1 \( -name "*.tar.gz" \) -type f -printf "%P\0" | xargs -0 sha256sum | sort -k2 > sha256sums.txt
cat sha256sums.txt && echo
echo "Packaging completed successfully!"
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: turnip-weekly_${{ env.MESA_RELEASE_NAME_SUFFIX }}_${{ needs.prepare-source.outputs.mesa_hash }}
path: |
~/mesa-for-android-container/*.tar.gz
~/mesa-for-android-container/sha256sums.txt
retention-days: 90
update-release:
if: ${{ github.event_name != 'workflow_dispatch' || !inputs.skip_update_release }}
needs:
- debian-trixie
- ubuntu-noble
- fedora-43
- archlinux
- void-linux
runs-on: ubuntu-24.04-arm
steps:
- name: Download build artifacts
uses: actions/download-artifact@v8
with:
path: ./artifacts
- name: Build release notes with checksums
shell: bash
run: |
set -euo pipefail
checksums=$(find ./artifacts -type f -name "sha256sums.txt" -exec cat {} \; -exec echo \; | awk 'NF>=2 {print $1 " " $2}' | sort -k2,2)
cat <<'EOF' > release_body.md
# Turnip Weekly Builds
## Important Notice
This release provides weekly automated builds of Turnip drivers. You can use them together with standard releases (whose title does not have the `turnip-` prefix), or you can use this release alone **(which usually has better compatibility)**. When used alone, you need to change the value of the environment variable `MESA_LOADER_DRIVER_OVERRIDE` from `kgsl` to `zink`. See [the README](https://github.com/lfdevs/mesa-for-android-container/blob/adreno-main/.github/README.md) for details.
## Installation Instructions
1. Download an installation package from the Assets section. Please note the Linux distribution suffix in the filename, such as `debian_trixie_arm64`. **You can only install the package that matches your distribution.**
2. Extract the installation package directly to the root directory.
```shell
sudo tar -zxvf turnip-weekly*.tar.gz -C /
```
3. Refresh the dynamic linker cache.
```shell
sudo ldconfig
```
## Checksums
```plaintext
EOF
printf '%s\n' "$checksums" >> release_body.md
printf '%s\n' '```' >> release_body.md
- name: Delete existing release assets
uses: actions/github-script@v8
with:
script: |
const tag = 'turnip-weekly';
const { owner, repo } = context.repo;
let release;
try {
release = await github.rest.repos.getReleaseByTag({ owner, repo, tag });
} catch (error) {
if (error.status === 404) {
core.info(`No existing release found for tag ${tag}, nothing to clean.`);
return;
}
throw error;
}
const assets = await github.paginate(github.rest.repos.listReleaseAssets, {
owner,
repo,
release_id: release.data.id,
per_page: 100,
});
for (const asset of assets) {
core.info(`Deleting asset: ${asset.name}`);
await github.rest.repos.deleteReleaseAsset({
owner,
repo,
asset_id: asset.id,
});
}
core.info(`Deleted ${assets.length} asset(s) from release ${release.data.name || tag}.`);
- name: Upload archives to release
uses: softprops/action-gh-release@v2
with:
tag_name: turnip-weekly
name: turnip-weekly
draft: false
prerelease: true
body_path: release_body.md
files: |
./artifacts/**/turnip-weekly*.tar.gz