From 15b91a1ad4439a5288d78bf239a25800eddf61a1 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Sun, 6 Oct 2024 14:41:21 -0400 Subject: [PATCH] build(fedora)!: add copr build (#3239) --- .github/workflows/ci-copr.yml | 56 +++++ .github/workflows/update-flathub-repo.yml | 2 +- .github/workflows/update-pacman-repo.yml | 4 +- DOCKER_README.md | 4 - docker/fedora-39.dockerfile | 104 ---------- docker/fedora-40.dockerfile | 104 ---------- docs/getting_started.md | 40 ++-- packaging/linux/fedora/copr-build.sh | 62 ++++++ packaging/linux/fedora/sunshine.spec | 240 ++++++++++++++++++++++ 9 files changed, 378 insertions(+), 238 deletions(-) create mode 100644 .github/workflows/ci-copr.yml delete mode 100644 docker/fedora-39.dockerfile delete mode 100644 docker/fedora-40.dockerfile create mode 100644 packaging/linux/fedora/copr-build.sh create mode 100644 packaging/linux/fedora/sunshine.spec diff --git a/.github/workflows/ci-copr.yml b/.github/workflows/ci-copr.yml new file mode 100644 index 00000000..ba3d14ff --- /dev/null +++ b/.github/workflows/ci-copr.yml @@ -0,0 +1,56 @@ +--- +name: CI Copr + +on: + pull_request: + branches: + - master + types: + - opened + - synchronize + - reopened + release: + types: + - prereleased + - released + workflow_dispatch: + +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + +jobs: + build: + name: Copr build + if: github.repository_owner == 'LizardByte' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Get properties + run: | + # package name = repository name + package=${{ github.event.repository.name }} + copr_base="https://copr.fedorainfracloud.org/webhooks/custom-dir/lizardbyte" + + # release and released type + if [ "${{ github.event_name }}" = "release" ]; then + if [ "${{ github.event.action }}" = "prereleased" ]; then + COPR_PUSH_WEBHOOK="${copr_base}/beta/${{ secrets.COPR_BETA_WEBHOOK_TOKEN }}/${package}/" + elif [ "${{ github.event.action }}" = "released" ]; then + COPR_PUSH_WEBHOOK="${copr_base}/stable/${{ secrets.COPR_STABLE_WEBHOOK_TOKEN }}/${package}/" + fi + elif [ "${{ github.event_name }}" = "pull_request" ]; then + COPR_PR_WEBHOOK="${copr_base}/pulls:pr:${{github.event.number}}/${{vars.COPR_PR_WEBHOOK_TOKEN}}/${package}/" + fi + + echo "COPR_PUSH_WEBHOOK=${COPR_PUSH_WEBHOOK}" >> $GITHUB_ENV + echo "COPR_PR_WEBHOOK=${COPR_PR_WEBHOOK}" >> $GITHUB_ENV + + - name: Build + run: | + curl https://raw.githubusercontent.com/praiskup/copr-ci-tooling/main/copr-gh-actions-submit > submit + + # if a PR number is added the script will use the PR webhook, otherwise it will use the push webhook + bash submit ${{ github.event.pull_request.number }} diff --git a/.github/workflows/update-flathub-repo.yml b/.github/workflows/update-flathub-repo.yml index 15580f23..b3e326c9 100644 --- a/.github/workflows/update-flathub-repo.yml +++ b/.github/workflows/update-flathub-repo.yml @@ -180,7 +180,7 @@ jobs: with: path: "flathub/${{ env.FLATHUB_PKG }}" token: ${{ secrets.GH_BOT_TOKEN }} - commit-message: Update ${{ env.FLATHUB_PKG }} to ${{ github.event.release.tag_name }} + commit-message: "chore: Update ${{ env.FLATHUB_PKG }} to ${{ github.event.release.tag_name }}" branch: bot/bump-${{ env.FLATHUB_PKG }}-${{ github.event.release.tag_name }} delete-branch: true title: "chore: Update ${{ env.FLATHUB_PKG }} to ${{ github.event.release.tag_name }}" diff --git a/.github/workflows/update-pacman-repo.yml b/.github/workflows/update-pacman-repo.yml index c95f7cda..92e14dc7 100644 --- a/.github/workflows/update-pacman-repo.yml +++ b/.github/workflows/update-pacman-repo.yml @@ -70,7 +70,7 @@ jobs: steps.check-label.outputs.hasTopic == 'true' && steps.check-release.outputs.isLatestRelease == 'true' run: | - echo "pkg_name=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT + echo "pkg_name=$(echo ${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT - name: Download release asset id: download @@ -97,7 +97,7 @@ jobs: add-paths: | pkgbuilds/* token: ${{ secrets.GH_BOT_TOKEN }} - commit-message: Update ${{ github.repository }} to ${{ github.event.release.tag_name }} + commit-message: "chore: Update ${{ github.repository }} to ${{ github.event.release.tag_name }}" branch: bot/bump-${{ github.repository }}-${{ github.event.release.tag_name }} delete-branch: true title: "chore: Update ${{ github.repository }} to ${{ github.event.release.tag_name }}" diff --git a/DOCKER_README.md b/DOCKER_README.md index 0d9d1f4c..cbe977a3 100644 --- a/DOCKER_README.md +++ b/DOCKER_README.md @@ -26,8 +26,6 @@ Sunshine images are available with the following tag suffixes, based on their re - `archlinux` - `debian-bookworm` -- `fedora-39` -- `fedora-40` - `ubuntu-22.04` - `ubuntu-24.04` @@ -157,8 +155,6 @@ The architectures supported by these images are shown in the table below. |-----------------|--------------|---------------| | archlinux | ✅ | ❌ | | debian-bookworm | ✅ | ✅ | -| fedora-39 | ✅ | ❌ | -| fedora-40 | ✅ | ❌ | | ubuntu-22.04 | ✅ | ✅ | | ubuntu-24.04 | ✅ | ✅ | diff --git a/docker/fedora-39.dockerfile b/docker/fedora-39.dockerfile deleted file mode 100644 index 579eec9e..00000000 --- a/docker/fedora-39.dockerfile +++ /dev/null @@ -1,104 +0,0 @@ -# syntax=docker/dockerfile:1 -# artifacts: true -# platforms: linux/amd64 -# platforms_pr: linux/amd64 -# no-cache-filters: sunshine-base,artifacts,sunshine -ARG BASE=fedora -ARG TAG=39 -FROM ${BASE}:${TAG} AS sunshine-base - -FROM sunshine-base AS sunshine-build - -ARG BRANCH -ARG BUILD_VERSION -ARG COMMIT -# note: BUILD_VERSION may be blank - -ENV BRANCH=${BRANCH} -ENV BUILD_VERSION=${BUILD_VERSION} -ENV COMMIT=${COMMIT} - -SHELL ["/bin/bash", "-o", "pipefail", "-c"] - -# copy repository -WORKDIR /build/sunshine/ -COPY --link .. . - -# cmake and cpack -RUN <<_BUILD -#!/bin/bash -set -e -chmod +x ./scripts/linux_build.sh -./scripts/linux_build.sh \ - --publisher-name='LizardByte' \ - --publisher-website='https://app.lizardbyte.dev' \ - --publisher-issue-url='https://app.lizardbyte.dev/support' \ - --sudo-off -dnf clean all -rm -rf /var/cache/yum -_BUILD - -# run tests -WORKDIR /build/sunshine/build/tests -# hadolint ignore=SC1091 -RUN <<_TEST -#!/bin/bash -set -e -export DISPLAY=:1 -Xvfb ${DISPLAY} -screen 0 1024x768x24 & -./test_sunshine --gtest_color=yes -_TEST - -FROM scratch AS artifacts -ARG BASE -ARG TAG -ARG TARGETARCH -COPY --link --from=sunshine-build /build/sunshine/build/cpack_artifacts/Sunshine.rpm /sunshine-${BASE}-${TAG}-${TARGETARCH}.rpm - -FROM sunshine-base AS sunshine - -# copy deb from builder -COPY --link --from=artifacts /sunshine*.rpm /sunshine.rpm - -# install sunshine -RUN <<_INSTALL_SUNSHINE -#!/bin/bash -set -e -dnf -y update -dnf -y install /sunshine.rpm -dnf clean all -rm -rf /var/cache/yum -_INSTALL_SUNSHINE - -# network setup -EXPOSE 47984-47990/tcp -EXPOSE 48010 -EXPOSE 47998-48000/udp - -# setup user -ARG PGID=1000 -ENV PGID=${PGID} -ARG PUID=1000 -ENV PUID=${PUID} -ENV TZ="UTC" -ARG UNAME=lizard -ENV UNAME=${UNAME} - -ENV HOME=/home/$UNAME - -# setup user -RUN <<_SETUP_USER -#!/bin/bash -set -e -groupadd -f -g "${PGID}" "${UNAME}" -useradd -lm -d ${HOME} -s /bin/bash -g "${PGID}" -u "${PUID}" "${UNAME}" -mkdir -p ${HOME}/.config/sunshine -ln -s ${HOME}/.config/sunshine /config -chown -R ${UNAME} ${HOME} -_SETUP_USER - -USER ${UNAME} -WORKDIR ${HOME} - -# entrypoint -ENTRYPOINT ["/usr/bin/sunshine"] diff --git a/docker/fedora-40.dockerfile b/docker/fedora-40.dockerfile deleted file mode 100644 index fc6362d4..00000000 --- a/docker/fedora-40.dockerfile +++ /dev/null @@ -1,104 +0,0 @@ -# syntax=docker/dockerfile:1 -# artifacts: true -# platforms: linux/amd64 -# platforms_pr: linux/amd64 -# no-cache-filters: sunshine-base,artifacts,sunshine -ARG BASE=fedora -ARG TAG=40 -FROM ${BASE}:${TAG} AS sunshine-base - -FROM sunshine-base AS sunshine-build - -ARG BRANCH -ARG BUILD_VERSION -ARG COMMIT -# note: BUILD_VERSION may be blank - -ENV BRANCH=${BRANCH} -ENV BUILD_VERSION=${BUILD_VERSION} -ENV COMMIT=${COMMIT} - -SHELL ["/bin/bash", "-o", "pipefail", "-c"] - -# copy repository -WORKDIR /build/sunshine/ -COPY --link .. . - -# cmake and cpack -RUN <<_BUILD -#!/bin/bash -set -e -chmod +x ./scripts/linux_build.sh -./scripts/linux_build.sh \ - --publisher-name='LizardByte' \ - --publisher-website='https://app.lizardbyte.dev' \ - --publisher-issue-url='https://app.lizardbyte.dev/support' \ - --sudo-off -dnf clean all -rm -rf /var/cache/yum -_BUILD - -# run tests -WORKDIR /build/sunshine/build/tests -# hadolint ignore=SC1091 -RUN <<_TEST -#!/bin/bash -set -e -export DISPLAY=:1 -Xvfb ${DISPLAY} -screen 0 1024x768x24 & -./test_sunshine --gtest_color=yes -_TEST - -FROM scratch AS artifacts -ARG BASE -ARG TAG -ARG TARGETARCH -COPY --link --from=sunshine-build /build/sunshine/build/cpack_artifacts/Sunshine.rpm /sunshine-${BASE}-${TAG}-${TARGETARCH}.rpm - -FROM sunshine-base AS sunshine - -# copy deb from builder -COPY --link --from=artifacts /sunshine*.rpm /sunshine.rpm - -# install sunshine -RUN <<_INSTALL_SUNSHINE -#!/bin/bash -set -e -dnf -y update -dnf -y install /sunshine.rpm -dnf clean all -rm -rf /var/cache/yum -_INSTALL_SUNSHINE - -# network setup -EXPOSE 47984-47990/tcp -EXPOSE 48010 -EXPOSE 47998-48000/udp - -# setup user -ARG PGID=1000 -ENV PGID=${PGID} -ARG PUID=1000 -ENV PUID=${PUID} -ENV TZ="UTC" -ARG UNAME=lizard -ENV UNAME=${UNAME} - -ENV HOME=/home/$UNAME - -# setup user -RUN <<_SETUP_USER -#!/bin/bash -set -e -groupadd -f -g "${PGID}" "${UNAME}" -useradd -lm -d ${HOME} -s /bin/bash -g "${PGID}" -u "${PUID}" "${UNAME}" -mkdir -p ${HOME}/.config/sunshine -ln -s ${HOME}/.config/sunshine /config -chown -R ${UNAME} ${HOME} -_SETUP_USER - -USER ${UNAME} -WORKDIR ${HOME} - -# entrypoint -ENTRYPOINT ["/usr/bin/sunshine"] diff --git a/docs/getting_started.md b/docs/getting_started.md index 534aa5f2..02de66e3 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -54,28 +54,21 @@ CUDA is used for NVFBC capture.