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
7 changes: 0 additions & 7 deletions .flake8

This file was deleted.

10 changes: 7 additions & 3 deletions .github/workflows/ci-freebsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
BUILD_VERSION: ${{ inputs.release_version }}
PYTHON_VERSION: '3.14'
COMMIT: ${{ inputs.release_commit }}
FREEBSD_CLANG_VERSION: 19

Expand Down Expand Up @@ -90,7 +91,7 @@ jobs:
with:
arch: ${{ matrix.arch }}
cpu: ${{ steps.processor_count.outputs.PROCESSOR_COUNT }}
envs: 'BRANCH BUILD_VERSION COMMIT'
envs: 'BRANCH BUILD_VERSION COMMIT PYTHON_VERSION'
# TODO: there is no libcap for freebsd... we need graphics/libdrm if we find a way to use libcap
# TODO: docs are off because doxygen is too old: https://www.freshports.org/devel/doxygen/ must be >= 1.10
prepare: |
Expand Down Expand Up @@ -142,7 +143,10 @@ jobs:
release: ${{ matrix.bsd_release }}
run: |
set -e
uv sync --locked --group glad --group test --python /usr/local/bin/python3.14 \
uv sync --locked --only-group glad --python "/usr/local/bin/python${PYTHON_VERSION}" \
--no-python-downloads --no-install-project
uv sync --project third-party/lizardbyte-common --locked --only-group test-c \
--python "/usr/local/bin/python${PYTHON_VERSION}" \
--no-python-downloads --no-install-project

# fix git safe.directory issues
Expand Down Expand Up @@ -255,7 +259,7 @@ jobs:
shell: freebsd {0}
run: |
cd "${GITHUB_WORKSPACE}/build"
uv run --locked --no-sync python -m gcovr . -r ../src \
uv run --project ../third-party/lizardbyte-common --locked --no-sync gcovr . -r ../src \
--exclude-noncode-lines \
--exclude-throw-branches \
--exclude-unreachable-branches \
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ jobs:
enable-cache: true

- name: Sync Python tools
run: uv sync --locked --only-group test --python "${PYTHON_VERSION}" --no-python-downloads --no-install-project
run: |
uv sync --project third-party/lizardbyte-common --locked --only-group test-c \
--python "${PYTHON_VERSION}" \
--no-python-downloads --no-install-project

- name: Run tests
id: test
Expand All @@ -192,7 +195,8 @@ jobs:
(steps.test.outcome == 'success' || steps.test.outcome == 'failure')
working-directory: build
run: |
uv run --locked --no-sync python -m gcovr --gcov-executable "gcov-${GCC_VERSION}" . -r ../src \
uv run --project ../third-party/lizardbyte-common --locked --no-sync gcovr \
--gcov-executable "gcov-${GCC_VERSION}" . -r ../src \
--exclude-noncode-lines \
--exclude-throw-branches \
--exclude-unreachable-branches \
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ jobs:
enable-cache: true

- name: Sync Python tools
run: uv sync --locked --only-group test --python "${PYTHON_VERSION}" --no-python-downloads --no-install-project
run: |
uv sync --project third-party/lizardbyte-common --locked --only-group test-c \
--python "${PYTHON_VERSION}" \
--no-python-downloads --no-install-project

- name: Configure
env:
Expand Down Expand Up @@ -181,7 +184,7 @@ jobs:
(steps.test.outcome == 'success' || steps.test.outcome == 'failure')
working-directory: build
run: |
uv run --locked --no-sync python -m gcovr . -r ../src \
uv run --project ../third-party/lizardbyte-common --locked --no-sync gcovr . -r ../src \
--exclude-noncode-lines \
--exclude-throw-branches \
--exclude-unreachable-branches \
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ jobs:
MSYS2_PATH_TYPE: inherit
UV_PYTHON: ${{ steps.setup-python.outputs.python-path }}
run: |
uv sync --locked --only-group test --no-python-downloads --no-install-project
uv sync --project third-party/lizardbyte-common --locked --only-group test-c \
--no-python-downloads \
--no-install-project

- name: Build Windows
shell: msys2 {0}
Expand Down Expand Up @@ -367,7 +369,7 @@ jobs:
env:
MSYS2_PATH_TYPE: inherit
run: |
uv run --locked --no-sync python -m gcovr . -r ../src \
uv run --project ../third-party/lizardbyte-common --locked --no-sync gcovr . -r ../src \
--exclude-noncode-lines \
--exclude-throw-branches \
--exclude-unreachable-branches \
Expand Down
95 changes: 3 additions & 92 deletions .github/workflows/localize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,100 +12,11 @@ on:
- 'locale/sunshine.po'
workflow_dispatch:

env:
FILE: ./locale/sunshine.po
PYTHON_VERSION: '3.14'

jobs:
localize:
name: Update Localization
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3

- name: Install Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Setup uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true

- name: Sync Python tools
run: |
uv sync --frozen --only-group locale \
--python "${PYTHON_VERSION}" \
--no-python-downloads \
--no-install-project

- name: Set up xgettext
run: |
sudo apt-get update -y && \
sudo apt-get --reinstall install -y \
gettext

- name: Update Strings
run: |
new_file=true

# first, try to remove existing file as xgettext does not remove unused translations
if [ -f "${FILE}" ];
then
rm "${FILE}"
new_file=false
fi
echo "NEW_FILE=${new_file}" >> "${GITHUB_ENV}"

# extract the new strings
uv run --frozen --no-sync python ./scripts/_locale.py --extract

- name: git diff
if: env.NEW_FILE == 'false'
run: |
# disable the pager
git config --global pager.diff false

# print the git diff
git diff 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
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@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
add-paths: |
locale/*.po
token: ${{ secrets.GH_BOT_TOKEN }} # must trigger PR tests
commit-message: "chore(l10n): new babel updates"
branch: localize/update
delete-branch: true
base: master
title: "chore(l10n): new babel updates"
body: |
Update report
- Updated ${{ steps.date.outputs.date }}
- Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request
labels: |
babel
l10n
uses: LizardByte/lizardbyte-common/.github/workflows/localize.yml@master
secrets:
GH_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
path = third-party/libdisplaydevice
url = https://github.com/LizardByte/libdisplaydevice.git
branch = master
[submodule "third-party/lizardbyte-common"]
path = third-party/lizardbyte-common
url = https://github.com/LizardByte/lizardbyte-common.git
branch = master
[submodule "third-party/moonlight-common-c"]
path = third-party/moonlight-common-c
url = https://github.com/moonlight-stream/moonlight-common-c.git
Expand Down
15 changes: 9 additions & 6 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,23 +128,25 @@ any of the following paths are modified.
```

When testing locally, it may be desirable to manually extract, initialize, update, and compile strings. Python and
uv are required for this, along with the Python dependencies in the `./pyproject.toml` file. You can install these
with the following command.
uv are required for this, along with the Python dependencies in the `third-party/lizardbyte-common/pyproject.toml`
file. You can install these with the following command.

```bash
uv sync --only-group locale
uv sync --project third-party/lizardbyte-common --locked --only-group locale --no-install-project
```

Additionally, [xgettext](https://www.gnu.org/software/gettext) must be installed.

* Extract, initialize, and update
```bash
uv run --no-sync python ./scripts/_locale.py --extract --init --update
uv run --project third-party/lizardbyte-common --locked --no-sync \
python third-party/lizardbyte-common/scripts/localize.py --root-dir . --extract --init --update
```

* Compile
```bash
uv run --no-sync python ./scripts/_locale.py --compile
uv run --project third-party/lizardbyte-common --locked --no-sync \
python third-party/lizardbyte-common/scripts/localize.py --root-dir . --compile
```

> [!IMPORTANT]
Expand All @@ -160,7 +162,8 @@ Source code is tested against the `.clang-format` file for linting errors.

To apply clang-format locally (will modify files):
```bash
uv run --no-sync --only-group lint python ./scripts/update_clang_format.py
uv run --project third-party/lizardbyte-common --locked --only-group lint-c \
python third-party/lizardbyte-common/scripts/update_clang_format.py
```

#### Unit Testing
Expand Down
15 changes: 1 addition & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "Sunshine"
version = "0.0.0"
description = "Helper scripts for Sunshine"
description = "Python tooling for Sunshine"
requires-python = ">=3.14"
license = {text = "GPL-3.0-only"}
authors = [
Expand All @@ -29,19 +29,6 @@ flatpak = [
"flatpak_pip_generator",
]

lint = [
"clang-format==20.*",
"flake8==7.3.0",
]

locale = [
"Babel==2.18.0",
]

test = [
"gcovr==8.6",
]

[project.urls]
Homepage = "https://app.lizardbyte.dev/Sunshine"
Repository = "https://github.com/LizardByte/Sunshine"
Expand Down
Loading
Loading