Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,088 changes: 0 additions & 1,088 deletions .github/workflows/CI.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/_docker.yml

This file was deleted.

211 changes: 211 additions & 0 deletions .github/workflows/ci-flatpak.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
---
name: CI-Flatpak
permissions:
contents: read

on:
workflow_call:
inputs:
release_commit:
required: true
type: string
release_tag:
required: true
type: string

jobs:
build_linux_flatpak:
name: ${{ matrix.arch }}
env:
APP_ID: dev.lizardbyte.app.Sunshine
NODE_VERSION: "20"
PLATFORM_VERSION: "23.08"
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: ubuntu-22.04
- arch: aarch64
runner: ubuntu-22.04-arm
steps:
- name: Maximize build space
if: matrix.arch == 'x86_64'
uses: easimon/maximize-build-space@v10
with:
root-reserve-mb: 10240
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'

- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup node
id: node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install npm dependencies
run: npm install --package-lock-only

- name: Debug package-lock.json
run: cat package-lock.json

- name: Setup python
id: python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Setup Dependencies Linux Flatpak
run: |
python -m pip install ./packaging/linux/flatpak/deps/flatpak-builder-tools/node

sudo apt-get update -y
sudo apt-get install -y \
cmake \
flatpak

sudo su $(whoami) -c "flatpak --user remote-add --if-not-exists flathub \
https://flathub.org/repo/flathub.flatpakrepo"

sudo su $(whoami) -c "flatpak --user install -y flathub \
org.flatpak.Builder \
org.freedesktop.Platform/${{ matrix.arch }}/${PLATFORM_VERSION} \
org.freedesktop.Sdk/${{ matrix.arch }}/${PLATFORM_VERSION} \
org.freedesktop.Sdk.Extension.node${NODE_VERSION}/${{ matrix.arch }}/${PLATFORM_VERSION} \
"

flatpak run org.flatpak.Builder --version

- name: flatpak node generator
# https://github.com/flatpak/flatpak-builder-tools/blob/master/node/README.md
run: flatpak-node-generator npm package-lock.json

- name: Debug generated-sources.json
run: cat generated-sources.json

- name: Cache Flatpak build
uses: actions/cache@v4
with:
path: ./build/.flatpak-builder
key: flatpak-${{ matrix.arch }}-${{ github.sha }}
restore-keys: |
flatpak-${{ matrix.arch }}-

- name: Configure Flatpak Manifest
run: |
# variables for manifest
branch="${{ github.head_ref }}"
commit=${{ inputs.release_commit }}

# check the branch variable
if [ -z "$branch" ]
then
echo "This is a PUSH event"
branch=${{ github.ref_name }}
build_version=${{ inputs.release_tag }}
clone_url=${{ github.event.repository.clone_url }}
else
echo "This is a PR event"
clone_url=${{ github.event.pull_request.head.repo.clone_url }}
fi
echo "Branch: ${branch}"
echo "Commit: ${commit}"
echo "Clone URL: ${clone_url}"

mkdir -p build
mkdir -p artifacts

cmake -DGITHUB_CLONE_URL=${clone_url} \
-B build \
-S . \
-DBUILD_VERSION=${build_version} \
-DGITHUB_BRANCH=${branch} \
-DGITHUB_COMMIT=${commit} \
-DSUNSHINE_CONFIGURE_FLATPAK_MAN=ON \
-DSUNSHINE_CONFIGURE_ONLY=ON

- name: Debug Manifest
working-directory: build
run: cat ${APP_ID}.yml

- name: Build Linux Flatpak
working-directory: build
run: |
sudo su $(whoami) -c "flatpak run org.flatpak.Builder \
--arch=${{ matrix.arch }} \
--force-clean \
--repo=repo \
--sandbox \
--stop-at=cuda build-sunshine ${APP_ID}.yml"
cp -r .flatpak-builder copy-of-flatpak-builder
sudo su $(whoami) -c "flatpak run org.flatpak.Builder \
--arch=${{ matrix.arch }} \
--force-clean \
--repo=repo \
--sandbox \
build-sunshine ${APP_ID}.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 ${APP_ID}"
sudo su $(whoami) -c "flatpak build-bundle \
--runtime \
--arch=${{ matrix.arch }} \
./repo \
../artifacts/sunshine_debug_${{ matrix.arch }}.flatpak ${APP_ID}.Debug"

- name: Lint Flatpak
working-directory: build
run: |
exceptions_file="${{ github.workspace }}/packaging/linux/flatpak/exceptions.json"

echo "Linting flatpak manifest"
flatpak run --command=flatpak-builder-lint org.flatpak.Builder \
--exceptions \
--user-exceptions "${exceptions_file}" \
manifest \
${APP_ID}.yml

echo "Linting flatpak repo"
# TODO: add arg
# --mirror-screenshots-url=https://dl.flathub.org/media \
flatpak run --command=flatpak-builder-lint org.flatpak.Builder \
--exceptions \
--user-exceptions "${exceptions_file}" \
repo \
repo

- name: Package Flathub repo archive
# copy files required to generate the Flathub repo
if: matrix.arch == 'x86_64'
run: |
mkdir -p flathub/modules
cp ./build/generated-sources.json ./flathub/
cp ./build/package-lock.json ./flathub/
cp ./build/${APP_ID}.yml ./flathub/
cp ./build/${APP_ID}.metainfo.xml ./flathub/
cp ./packaging/linux/flatpak/README.md ./flathub/
cp ./packaging/linux/flatpak/flathub.json ./flathub/
cp -r ./packaging/linux/flatpak/modules/. ./flathub/modules/
# submodules will need to be handled in the workflow that creates the PR

# create the archive
tar -czf ./artifacts/flathub.tar.gz -C ./flathub .

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: build-Linux-Flatpak-${{ matrix.arch }}
path: artifacts/
if-no-files-found: error
Loading
Loading