Build mesa-git packages #233
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
name: Build mesa-git packages | |
permissions: | |
contents: write | |
on: | |
push: | |
branches: | |
- main | |
- master | |
schedule: | |
- cron: "0 0 * * *" # 每天运行 | |
workflow_dispatch: # 允许手动触发 | |
jobs: | |
build: | |
runs-on: self-hosted | |
outputs: | |
mesa_hash: ${{ steps.mesa_hash.outputs.hash }} | |
mesa_date: ${{ steps.mesa_hash.outputs.date }} | |
container: | |
image: archlinux:base-devel | |
options: --privileged | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup system | |
run: | | |
# add multilib | |
echo "[multilib]" >> /etc/pacman.conf | |
echo "Include = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf | |
cat /etc/pacman.conf | |
echo "" | |
pacman -Syu --noconfirm | |
pacman -S --noconfirm git base-devel sudo | |
- name: Create build user | |
run: | | |
useradd -m builder | |
echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | |
chown -R builder:builder $GITHUB_WORKSPACE/mesa-git | |
chown -R builder:builder $GITHUB_WORKSPACE/lib32-mesa-git | |
- name: Get mesa commit hash | |
id: mesa_hash | |
run: | | |
git clone --depth 1 https://gitlab.freedesktop.org/mesa/mesa.git /tmp/mesa | |
cd /tmp/mesa | |
echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT | |
- name: Install dependencies | |
run: | | |
pacman -Sy --noconfirm | |
sed -i '/BUILDENV/s/ check/ !check/g' /etc/makepkg.conf | |
sed -i '/OPTIONS/s/ debug/ !debug/g' /etc/makepkg.conf | |
pacman -S --noconfirm cmake meson python python-mako ninja llvm clang lld | |
pacman -S --noconfirm lib32-gcc-libs gcc-multilib | |
- name: Build mesa-git | |
run: | | |
cd $GITHUB_WORKSPACE/mesa-git | |
sudo -u builder bash -c " | |
makepkg -fcCs --noconfirm | |
" | |
pacman -Rnsdd mesa --noconfirm | |
pacman -U --noconfirm $GITHUB_WORKSPACE/mesa-git/*.pkg.tar.zst | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mesa-git | |
path: ${{ github.workspace }}/mesa-git/*.pkg.tar.zst | |
- name: Build lib32-mesa-git | |
run: | | |
cd $GITHUB_WORKSPACE/lib32-mesa-git | |
sudo -u builder bash -c " | |
makepkg -fcCs --noconfirm | |
" | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lib32-mesa-git | |
path: ${{ github.workspace }}/lib32-mesa-git/*.pkg.tar.zst | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- run: mkdir /tmp/artifacts | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: /tmp/artifacts | |
- run: ls -R /tmp/artifacts | |
- name: Create release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ needs.build.outputs.mesa_hash }} | |
name: Mesa Git Build ${{ needs.build.outputs.mesa_date }}-${{ needs.build.outputs.mesa_hash }} | |
draft: false | |
prerelease: false | |
make_latest: true | |
files: | | |
/tmp/artifacts/**/*.pkg.tar.zst |