Skip to content

Commit

Permalink
build(linux): sync PKGBUILD with pacman-repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Jul 12, 2024
1 parent 6607a28 commit 3aaef13
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update-homebrew-release.yml
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
110 changes: 110 additions & 0 deletions .github/workflows/update-pacman-repo.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .github/workflows/update-winget-release.yml
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
34 changes: 20 additions & 14 deletions docker/archlinux.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 \
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
80 changes: 45 additions & 35 deletions packaging/linux/Arch/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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')

provides=('sunshine')
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'
'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')
Expand Down

0 comments on commit 3aaef13

Please sign in to comment.