diff --git a/.clang-format b/.clang-format index 6944ec3e..9f868d75 100644 --- a/.clang-format +++ b/.clang-format @@ -1,3 +1,4 @@ +--- # This file is centrally managed in https://github.com//.github/ # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in # the above-mentioned repo. @@ -6,7 +7,7 @@ BasedOnStyle: LLVM AccessModifierOffset: -2 AlignAfterOpenBracket: DontAlign -AlignConsecutiveAssignments: true +AlignConsecutiveAssignments: Consecutive AlignOperands: Align AllowAllArgumentsOnNextLine: false AllowAllConstructorInitializersOnNextLine: false @@ -14,7 +15,7 @@ AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: Always AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: All -AllowShortIfStatementsOnASingleLine: Always +AllowShortIfStatementsOnASingleLine: WithoutElse AllowShortLambdasOnASingleLine: All AllowShortLoopsOnASingleLine: true AlwaysBreakAfterReturnType: None @@ -62,7 +63,7 @@ SpaceBeforeParens: Never SpaceBeforeRangeBasedForLoopColon: true SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 -SpacesInAngles: false +SpacesInAngles: Never SpacesInCStyleCastParentheses: false SpacesInContainerLiterals: false SpacesInParentheses: false diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 5e534a2b..2d367286 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -73,7 +73,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Dependencies Linux AUR run: | @@ -173,6 +173,13 @@ jobs: name: Linux Flatpak runs-on: ubuntu-22.04 needs: check_changelog + strategy: + fail-fast: false # false to test all, true to fail entire job if any fail + matrix: + arch: ['x86_64', 'aarch64'] + exclude: + # exclude `aarch64` on anything except a release triggering event + - arch: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) && '' || 'aarch64' }} steps: - name: Checkout @@ -183,11 +190,22 @@ jobs: sudo apt-get update -y sudo apt-get install -y \ cmake \ + qemu-user-static \ flatpak - sudo su $(whoami) -c 'flatpak remote-add --user --if-not-exists flathub \ + sudo su $(whoami) -c 'flatpak --user remote-add --if-not-exists flathub \ https://flathub.org/repo/flathub.flatpakrepo' - sudo su $(whoami) -c 'flatpak install --user flathub \ - org.flatpak.Builder org.freedesktop.Platform//21.08 org.freedesktop.Sdk//21.08 -y' + sudo su $(whoami) -c 'flatpak --user install -y flathub \ + org.flatpak.Builder \ + org.freedesktop.Platform/${{ matrix.arch }}/21.08 \ + org.freedesktop.Sdk/${{ matrix.arch }}/21.08' + + - name: Cache Flatpak build + uses: actions/cache@v3 + with: + path: ./build/.flatpak-builder + key: flatpak-${{ matrix.arch }}-${{ github.sha }} + restore-keys: | + flatpak-${{ matrix.arch }}- - name: Configure Flatpak Manifest run: | @@ -224,14 +242,22 @@ jobs: - name: Build Linux Flatpak working-directory: build run: | - sudo su $(whoami) -c 'flatpak run org.flatpak.Builder --repo=repo --force-clean build-sunshine \ - dev.lizardbyte.sunshine.yml' - sudo su $(whoami) -c 'flatpak build-bundle ./repo ../artifacts/sunshine.flatpak dev.lizardbyte.sunshine' + sudo su $(whoami) -c 'flatpak run org.flatpak.Builder --arch=${{ matrix.arch }} --repo=repo --force-clean \ + --stop-at=cuda build-sunshine dev.lizardbyte.sunshine.yml' + cp -r .flatpak-builder copy-of-flatpak-builder + sudo su $(whoami) -c 'flatpak run org.flatpak.Builder --arch=${{ matrix.arch }} --repo=repo --force-clean \ + build-sunshine dev.lizardbyte.sunshine.yml' + rm -rf .flatpak-builder + mv copy-of-flatpak-builder .flatpak-builder + sudo su $(whoami) -c 'flatpak build-bundle --arch=${{ matrix.arch }} ./repo \ + ../artifacts/sunshine_${{ matrix.arch }}.flatpak dev.lizardbyte.sunshine' + sudo su $(whoami) -c 'flatpak build-bundle --runtime --arch=${{ matrix.arch }} ./repo \ + ../artifacts/sunshine_debug_${{ matrix.arch }}.flatpak dev.lizardbyte.sunshine.Debug' - name: Upload Artifacts uses: actions/upload-artifact@v3 with: - name: sunshine-linux-flatpak + name: sunshine-linux-flatpak-${{ matrix.arch }} path: artifacts/ - name: Create Release @@ -591,7 +617,7 @@ jobs: echo "$subport" subportlist="$subportlist $subport" done - echo "::set-output name=subportlist::${subportlist}" + echo "subportlist=${subportlist}" >> $GITHUB_OUTPUT - name: Run port lint for all subports run: | diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 7ff83e0a..0ac82a7a 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Autoapproving - uses: hmarr/auto-approve-action@v2 + uses: hmarr/auto-approve-action@v3 with: github-token: "${{ secrets.GITHUB_TOKEN }}" @@ -44,7 +44,7 @@ jobs: steps: - name: Automerging - uses: pascalgn/automerge-action@v0.15.3 + uses: pascalgn/automerge-action@v0.15.5 env: BASE_BRANCHES: nightly GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }} diff --git a/.github/workflows/cpp-clang-format-lint.yml b/.github/workflows/cpp-clang-format-lint.yml index 4717f70a..cc42ea10 100644 --- a/.github/workflows/cpp-clang-format-lint.yml +++ b/.github/workflows/cpp-clang-format-lint.yml @@ -28,7 +28,7 @@ jobs: FOUND=false fi - echo "::set-output name=src::${FOUND}" + echo "src=${FOUND}" >> $GITHUB_OUTPUT outputs: src: ${{ steps.check.outputs.src }} diff --git a/.github/workflows/localize.yml b/.github/workflows/localize.yml index 79674aa4..2c57c114 100644 --- a/.github/workflows/localize.yml +++ b/.github/workflows/localize.yml @@ -62,17 +62,20 @@ jobs: # print the git diff git diff locale/sunshine.po - # set the variable with minimal output - OUTPUT=$(git diff --numstat locale/sunshine.po) + # set the variable with minimal output, replacing `\t` with ` ` + OUTPUT=$(git diff --numstat locale/sunshine.po | sed -e "s#\t# #g") echo "git_diff=${OUTPUT}" >> $GITHUB_ENV - name: git reset # only run if a single line changed (date/time) and file already existed - # \t in next line is a tab character - if: ${{ env.git_diff == '1\t1\tlocale/sunshine.po' && env.new_file == 'false' }} + if: ${{ env.git_diff == '1 1 locale/sunshine.po' && env.new_file == 'false' }} run: | git reset --hard + - name: Get current date + id: date + run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT + - name: Create/Update Pull Request uses: peter-evans/create-pull-request@v4 with: @@ -86,7 +89,7 @@ jobs: title: New Babel Updates body: | Update report - - Updated with *today's* date + - Updated ${{ steps.date.outputs.date }} - Auto-generated by [create-pull-request][1] [1]: https://github.com/peter-evans/create-pull-request diff --git a/.github/workflows/release-notifier-moonlight.yml b/.github/workflows/release-notifier-moonlight.yml new file mode 100644 index 00000000..9ac896f3 --- /dev/null +++ b/.github/workflows/release-notifier-moonlight.yml @@ -0,0 +1,22 @@ +--- +name: Release Notifications (Moonlight) + +on: + release: + types: [published] + +jobs: + discord: + runs-on: ubuntu-latest + steps: + - name: discord + uses: sarisia/actions-status-discord@v1 # https://github.com/sarisia/actions-status-discord + with: + webhook: ${{ secrets.DISCORD_RELEASE_WEBHOOK_MOONLIGHT }} + nodetail: true + nofail: false + username: ${{ secrets.DISCORD_USERNAME }} + avatar_url: ${{ secrets.ORG_LOGO_URL }} + title: ${{ github.event.repository.name }} ${{ github.ref_name }} Released + description: ${{ github.event.release.body }} + color: 0xFF4500 diff --git a/.github/workflows/yaml-lint.yml b/.github/workflows/yaml-lint.yml index f2e07218..5623c2dc 100644 --- a/.github/workflows/yaml-lint.yml +++ b/.github/workflows/yaml-lint.yml @@ -17,6 +17,24 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Find additional files + id: find-files + run: | + # space separated list of files + FILES=.clang-format + + # empty placeholder + FOUND="" + + for FILE in ${FILES}; do + if [ -f "$FILE" ] + then + FOUND="$FOUND $FILE" + fi + done + + echo "found=${FOUND}" >> $GITHUB_OUTPUT + - name: yaml lint id: yaml-lint uses: ibiqlik/action-yamllint@v3 @@ -30,17 +48,14 @@ jobs: line-length: max: 120 truthy: - allowed-values: ['true', 'false', 'on'] # GitHub uses "on" for workflow event triggers + # GitHub uses "on" for workflow event triggers + # .clang-format file has options of "Yes" "No" that will be caught by this, so changed to "warning" + allowed-values: ['true', 'false', 'on'] check-keys: true - level: error + level: warning + file_or_dir: . ${{ steps.find-files.outputs.found }} - name: Log - run: | - echo ${{ steps.yaml-lint.outputs.logfile }} - - - name: Upload logs - uses: actions/upload-artifact@v3 if: failure() - with: - name: yamllint-logfile - path: ${{ steps.yaml-lint.outputs.logfile }} + run: | + cat "${{ steps.yaml-lint.outputs.logfile }}" >> $GITHUB_STEP_SUMMARY diff --git a/packaging/linux/flatpak/dev.lizardbyte.sunshine.yml b/packaging/linux/flatpak/dev.lizardbyte.sunshine.yml index 0b7e57b5..d9e64a13 100644 --- a/packaging/linux/flatpak/dev.lizardbyte.sunshine.yml +++ b/packaging/linux/flatpak/dev.lizardbyte.sunshine.yml @@ -26,40 +26,14 @@ cleanup: - /share/man modules: - - name: cuda - disabled: false - buildsystem: simple - only-arches: - - x86_64 - - aarch64 - cleanup: - - '*' - build-commands: - - chmod u+x ./cuda.run - - ./cuda.run --silent --toolkit --toolkitpath=$FLATPAK_DEST/cuda --no-opengl-libs --no-man-page --no-drm --tmpdir=$FLATPAK_BUILDER_BUILDDIR # yamllint disable-line rule:line-length - - rm -r $FLATPAK_DEST/cuda/nsight-systems-2021.3.2 - - rm ./cuda.run - sources: - - type: file - only-arches: - - x86_64 - url: https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux.run - sha256: bbd87ca0e913f837454a796367473513cddef555082e4d86ed9a38659cc81f0a - dest-filename: cuda.run - - type: file - only-arches: - - aarch64 - url: https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux_sbsa.run # yamllint disable-line rule:line-length - sha256: f2c4a52e06329606c8dfb7c5ea3f4cb4c0b28f9d3fdffeeb734fcc98daf580d8 - dest-filename: cuda.run - - name: boost disabled: false buildsystem: simple build-commands: - cd tools/build && bison -y -d -o src/engine/jamgram.cpp src/engine/jamgram.y - ./bootstrap.sh --prefix=$FLATPAK_DEST --with-libraries=system,thread,log || cat bootstrap.log - - ./b2 install variant=release link=static,shared runtime-link=shared cxxflags="$CXXFLAGS" linkflags="$LDFLAGS" -j $FLATPAK_BUILDER_N_JOBS # yamllint disable-line rule:line-length + - ./b2 install variant=release link=static,shared runtime-link=shared cxxflags="$CXXFLAGS" linkflags="$LDFLAGS" + -j $FLATPAK_BUILDER_N_JOBS sources: - type: archive url: http://archive.ubuntu.com/ubuntu/pool/main/b/boost1.74/boost1.74_1.74.0.orig.tar.xz @@ -74,22 +48,20 @@ modules: - --disable-doc - --disable-programs - --disable-decoders - - --enable-libfontconfig - - --enable-libfreetype - - --enable-libopus - - --enable-libvorbis - - --enable-libvpx + - --disable-vdpau + - --disable-audiotoolbox + - --disable-videotoolbox + - --disable-vulkan + - --disable-sdl2 + - --disable-filters + - --disable-avfilter + - --disable-postproc + - --disable-autodetect + - --enable-nvenc + - --enable-ffnvcodec + - --enable-vaapi - --enable-libx264 - --enable-libx265 - - --enable-nvenc - - --enable-encoder=h264_v4l2m2m - - --enable-encoder=hevc_v4l2m2m - # - --enable-nonfree - # - --enable-cuda-nvcc - # - --enable-libnpp - # - --extra-cflags=-I${FLATPAK_DEST}/cuda/include - # - --extra-ldflags=-L${FLATPAK_DEST}/cuda/lib64 - # - --nvccflags="-gencode arch=compute_52,code=sm_52 -O2" cleanup: - /share sources: @@ -107,6 +79,7 @@ modules: sha256: 8b237e94b08c196a1da22f2f25875f10be4cff3648df4eeff21e00da8f683fc2 - name: x265 + disabled: false buildsystem: cmake-ninja builddir: true subdir: source @@ -157,24 +130,18 @@ modules: - --disable-doxygen-html - --disable-manpages - --disable-xmltoman + - --disable-libevent sources: - type: archive url: http://archive.ubuntu.com/ubuntu/pool/main/a/avahi/avahi_0.8.orig.tar.gz sha256: 060309d7a333d38d951bc27598c677af1796934dbd98e1024e7ad8de798fedda - modules: - - name: libevent - cleanup: - - /bin - sources: - - type: archive - url: http://archive.ubuntu.com/ubuntu/pool/main/libe/libevent/libevent_2.1.12-stable.orig.tar.gz - sha256: 92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb - - name: libevdev + disabled: false buildsystem: meson config-opts: - -Ddocumentation=disabled + - -Dtests=disabled cleanup: - /bin sources: @@ -182,17 +149,36 @@ modules: url: http://archive.ubuntu.com/ubuntu/pool/main/libe/libevdev/libevdev_1.13.0+dfsg.orig.tar.xz sha256: a882e13ef1dd6bd227318080cabf60fe5af3c06471259d3acfc9dbfb202351a7 - modules: - - name: libcheck - buildsystem: cmake - cleanup: - - /bin - sources: - - type: archive - url: http://archive.ubuntu.com/ubuntu/pool/universe/c/check/check_0.15.2.orig.tar.gz - sha256: 8451b68ac5d6f3157b24f22eceff575bcf566264f6d78f3852f89d4e08cf42e1 + - name: cuda + disabled: false + buildsystem: simple + only-arches: + - x86_64 + - aarch64 + cleanup: + - '*' + build-commands: + - chmod u+x ./cuda.run + - ./cuda.run --silent --toolkit --toolkitpath=$FLATPAK_DEST/cuda --no-opengl-libs --no-man-page --no-drm + --tmpdir=$FLATPAK_BUILDER_BUILDDIR + - rm -r $FLATPAK_DEST/cuda/nsight-systems-2021.3.2 + - rm ./cuda.run + sources: + - type: file + only-arches: + - x86_64 + url: https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux.run + sha256: bbd87ca0e913f837454a796367473513cddef555082e4d86ed9a38659cc81f0a + dest-filename: cuda.run + - type: file + only-arches: + - aarch64 + url: https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux_sbsa.run # yamllint disable-line rule:line-length + sha256: f2c4a52e06329606c8dfb7c5ea3f4cb4c0b28f9d3fdffeeb734fcc98daf580d8 + dest-filename: cuda.run - name: sunshine + disabled: false buildsystem: cmake no-make-install: false builddir: true diff --git a/scripts/requirements.txt b/scripts/requirements.txt index 55da79d8..84c26fe1 100644 --- a/scripts/requirements.txt +++ b/scripts/requirements.txt @@ -1,5 +1,5 @@ Babel==2.10.3 m2r2==0.3.2 -Sphinx==5.2.3 +Sphinx==5.3.0 sphinx-copybutton==0.5.0 sphinx-rtd-theme==1.0.0 diff --git a/src/platform/linux/graphics.cpp b/src/platform/linux/graphics.cpp index 3c0adbda..59b85522 100644 --- a/src/platform/linux/graphics.cpp +++ b/src/platform/linux/graphics.cpp @@ -365,6 +365,7 @@ display_t make_display(std::variant &proc_t::get_apps() { } // Gets application image from application list. +// Returns image from assets directory if found there. // Returns default image if image configuration is not set. -// returns http content-type header compatible image type +// Returns http content-type header compatible image type. std::string proc_t::get_app_image(int app_id) { auto app_index = app_id - 1; if(app_index < 0 || app_index >= _apps.size()) { @@ -201,20 +202,41 @@ std::string proc_t::get_app_image(int app_id) { return SUNSHINE_ASSETS_DIR "/box.png"; } + auto default_image = SUNSHINE_ASSETS_DIR "/box.png"; auto app_image_path = _apps[app_index].image_path; if(app_image_path.empty()) { - return SUNSHINE_ASSETS_DIR "/box.png"; + // image is empty, return default box image + return default_image; } + // get the image extension and convert it to lowercase auto image_extension = std::filesystem::path(app_image_path).extension().string(); boost::to_lower(image_extension); - std::error_code code; - if(!std::filesystem::exists(app_image_path, code) || image_extension != ".png") { - return SUNSHINE_ASSETS_DIR "/box.png"; + // return the default box image if extension is not "png" + if(image_extension != ".png") { + return default_image; } - // return only "content-type" http header compatible image type. + // check if image is in assets directory + auto full_image_path = std::filesystem::path(SUNSHINE_ASSETS_DIR) / app_image_path; + if(std::filesystem::exists(full_image_path)) { + return full_image_path.string(); + } + else if(app_image_path == "./assets/steam.png") { + // handle old default steam image definition + return SUNSHINE_ASSETS_DIR "/steam.png"; + } + + // check if specified image exists + std::error_code code; + if(!std::filesystem::exists(app_image_path, code)) { + // return default box image if image does not exist + return default_image; + } + + // image is a png, and not in assets directory + // return only "content-type" http header compatible image type return app_image_path; } diff --git a/src_assets/linux/assets/apps.json b/src_assets/linux/assets/apps.json index 552dabe2..4a848bd8 100644 --- a/src_assets/linux/assets/apps.json +++ b/src_assets/linux/assets/apps.json @@ -14,7 +14,7 @@ "output":"steam.txt", "detached":["setsid steam steam://open/bigpicture"], - "image-path":"./assets/steam.png" + "image-path":"steam.png" } ] } diff --git a/src_assets/windows/assets/apps.json b/src_assets/windows/assets/apps.json index 419f2be4..379dd2fb 100644 --- a/src_assets/windows/assets/apps.json +++ b/src_assets/windows/assets/apps.json @@ -8,7 +8,7 @@ "output":"steam.txt", "detached":["steam steam://open/bigpicture"], - "image-path":"./assets/steam.png" + "image-path":"steam.png" } ] }