build(linux): sync PKGBUILD with pacman-repo (#2833)

This commit is contained in:
ReenigneArcher 2024-07-12 13:53:19 -04:00 committed by GitHub
parent e7c420dd6e
commit f3a164e95e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 176 additions and 50 deletions

View File

@ -1,7 +1,7 @@
---
# This action is a candidate to centrally manage in https://github.com/<organization>/.github/
# If more Homebrew applications are developed, consider moving this action to the organization's .github repository,
# using the `homebrew-pkg` repository label to identify repositories that should trigger have this workflow.
# using the `homebrew-pkg` repository label to identify repositories that should trigger this workflow.
# Update Homebrew on release events.

110
.github/workflows/update-pacman-repo.yml vendored Normal file
View File

@ -0,0 +1,110 @@
---
# This action is a candidate to centrally manage in https://github.com/<organization>/.github/
# If more pacman packages are developed, consider moving this action to the organization's .github repository,
# using the `pacman-pkg` repository label to identify repositories that should trigger have this workflow.
# Update pacman repo on release events.
name: Update pacman repo
on:
release:
types: [created, edited]
concurrency:
group: "${{ github.workflow }}-${{ github.event.release.tag_name }}"
cancel-in-progress: true
jobs:
update-homebrew-release:
if: >-
github.repository_owner == 'LizardByte' &&
!github.event.release.draft && !github.event.release.prerelease
runs-on: ubuntu-latest
steps:
- name: Check if pacman repo
env:
TOPIC: pacman-pkg
id: check
uses: actions/github-script@v7
with:
script: |
const topic = process.env.TOPIC;
console.log(`Checking if repo has topic: ${topic}`);
const repoTopics = await github.rest.repos.getAllTopics({
owner: context.repo.owner,
repo: context.repo.repo
});
console.log(`Repo topics: ${repoTopics.data.names}`);
const hasTopic = repoTopics.data.names.includes(topic);
console.log(`Has topic: ${hasTopic}`);
core.setOutput('hasTopic', hasTopic);
- name: Check if edited release is latest GitHub release
id: check
if: >-
github.event_name == 'release' &&
github.event.action == 'edited'
uses: actions/github-script@v7
with:
script: |
const latestRelease = await github.rest.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo
});
core.setOutput('isLatestRelease', latestRelease.data.tag_name === context.payload.release.tag_name);
- name: Checkout pacman-repo
if: >-
steps.check.outputs.hasTopic == 'true' &&
steps.check.outputs.isLatestRelease == 'true'
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/pacman-repo
- name: Prep
id: prep
if: >-
steps.check.outputs.hasTopic == 'true' &&
steps.check.outputs.isLatestRelease == 'true'
run: |
echo "pkg_name=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
- name: Download release asset
id: download
if: >-
steps.check.outputs.hasTopic == 'true' &&
steps.check.outputs.isLatestRelease == 'true'
uses: robinraju/release-downloader@v1.11
with:
repository: "${{ github.repository }}"
tag: "${{ github.event.release.tag_name }}"
fileName: "*.pkg.tar.gz"
tarBall: false
zipBall: false
out-file-path: "pkgbuilds/${{ steps.prep.outputs.pkg_name }}"
extract: true
- name: Create/Update Pull Request
if: >-
steps.check.outputs.hasTopic == 'true'&&
steps.check.outputs.isLatestRelease == 'true' &&
fromJson(steps.download.outputs.downloaded_files)[0]
uses: peter-evans/create-pull-request@v6
with:
add-paths: |
pkgbuilds/*
token: ${{ secrets.GH_BOT_TOKEN }}
commit-message: Update ${{ github.repository }} to ${{ github.event.release.tag_name }}
branch: bot/bump-${{ github.repository }}-${{ github.event.release.tag_name }}
delete-branch: true
base: master
title: Update ${{ github.repository }} to ${{ github.event.release.tag_name }}
body: ${{ github.event.release.body }}
labels: |
auto-approve
auto-merge

View File

@ -1,7 +1,7 @@
---
# This action is a candidate to centrally manage in https://github.com/<organization>/.github/
# If more Winget applications are developed, consider moving this action to the organization's .github repository,
# using the `winget-pkg` repository label to identify repositories that should trigger have this workflow.
# using the `winget-pkg` repository label to identify repositories that should trigger this workflow.
# Update Winget on release events.

View File

@ -7,10 +7,15 @@ ARG BASE=archlinux/archlinux
ARG TAG=base-devel
FROM ${BASE}:${TAG} AS sunshine-base
# Setup builder user, arch prevents running makepkg as root
RUN useradd -m builder && \
echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# makepkg is used in sunshine-build and uploader build stages
# Update keyring to avoid signature errors, and update system
RUN <<_DEPS
#!/bin/bash
set -e
pacman -Syy --disable-download-timeout --needed --noconfirm \
archlinux-keyring
pacman -Syu --disable-download-timeout --noconfirm
pacman -Scc --noconfirm
_DEPS
FROM sunshine-base as sunshine-build
@ -25,13 +30,20 @@ ENV BUILD_VERSION=${BUILD_VERSION}
ENV COMMIT=${COMMIT}
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Setup builder user, arch prevents running makepkg as root
RUN useradd -m builder && \
echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# patch the build flags
# hadolint ignore=SC2016
RUN sed -i 's,#MAKEFLAGS="-j2",MAKEFLAGS="-j$(nproc)",g' /etc/makepkg.conf
# install dependencies
# cuda is an optional build-time dependency for PKGBUILD
RUN <<_DEPS
#!/bin/bash
set -e
pacman -Syu --disable-download-timeout --needed --noconfirm \
archlinux-keyring \
base-devel \
cmake \
cuda \
@ -89,6 +101,8 @@ USER builder
RUN <<_PKGBUILD
#!/bin/bash
set -e
# shellcheck source=/dev/null
source /etc/profile # ensure cuda is in the PATH
export DISPLAY=:1
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
namcap -i PKGBUILD
@ -104,16 +118,12 @@ COPY --link --from=sunshine-build /build/sunshine/sunshine.pkg.tar.gz /sunshine.
FROM sunshine-base as sunshine
# copy from uploader instead of artifacts or uploader stage will not run
COPY --link --from=artifacts /sunshine.pkg.tar.zst /
# install sunshine
RUN <<_INSTALL_SUNSHINE
#!/bin/bash
set -e
# update keyring to prevent cached keyring errors
pacman -Syu --disable-download-timeout --needed --noconfirm \
archlinux-keyring
pacman -U --disable-download-timeout --needed --noconfirm \
/sunshine.pkg.tar.zst
pacman -Scc --noconfirm
@ -139,10 +149,6 @@ ENV HOME=/home/$UNAME
RUN <<_SETUP_USER
#!/bin/bash
set -e
# first delete the builder user
userdel -r builder
# then create the lizard user
groupadd -f -g "${PGID}" "${UNAME}"
useradd -lm -d ${HOME} -s /bin/bash -g "${PGID}" -u "${PUID}" "${UNAME}"
mkdir -p ${HOME}/.config/sunshine

View File

@ -12,41 +12,51 @@ install=sunshine.install
_gcc_version=13
depends=('avahi'
'curl'
'libayatana-appindicator'
'libcap'
'libdrm'
'libevdev'
'libmfx'
'libnotify'
'libpulse'
'libva'
'libvdpau'
'libx11'
'libxcb'
'libxfixes'
'libxrandr'
'libxtst'
'miniupnpc'
'numactl'
'openssl'
'opus'
'udev')
makedepends=('cmake'
'doxygen'
"gcc${_gcc_version}"
'graphviz'
'git'
'make'
'nodejs'
'npm'
'python')
optdepends=('cuda: Nvidia GPU encoding support'
'libva-mesa-driver: AMD GPU encoding support'
'xorg-server-xvfb: Virtual X server for headless testing')
depends=(
'avahi'
'curl'
'libayatana-appindicator'
'libcap'
'libdrm'
'libevdev'
'libmfx'
'libnotify'
'libpulse'
'libva'
'libvdpau'
'libx11'
'libxcb'
'libxfixes'
'libxrandr'
'libxtst'
'miniupnpc'
'numactl'
'openssl'
'opus'
'udev'
)
provides=('sunshine')
makedepends=(
'cmake'
'cuda'
'doxygen'
"gcc${_gcc_version}"
'graphviz'
'git'
'make'
'nodejs'
'npm'
'python'
)
optdepends=(
'cuda: Nvidia GPU encoding support'
'libva-mesa-driver: AMD GPU encoding support'
'xorg-server-xvfb: Virtual X server for headless testing'
)
provides=()
conflicts=()
source=("$pkgname::git+@GITHUB_CLONE_URL@#commit=@GITHUB_COMMIT@")
sha256sums=('SKIP')