mirror of
https://github.com/LizardByte/Sunshine.git
synced 2026-08-07 18:36:34 +00:00
build(python): migrate to uv (#5222)
This commit is contained in:
@@ -12,6 +12,9 @@ on:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
env:
|
||||
PYTHON_VERSION: '3.14'
|
||||
|
||||
jobs:
|
||||
build_linux_flatpak:
|
||||
name: ${{ matrix.arch }}
|
||||
@@ -49,12 +52,22 @@ jobs:
|
||||
id: python
|
||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||
with:
|
||||
python-version: '3.14'
|
||||
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 --locked --only-group flatpak \
|
||||
--python "${PYTHON_VERSION}" \
|
||||
--no-python-downloads \
|
||||
--no-install-project
|
||||
|
||||
- name: Setup Dependencies Linux Flatpak
|
||||
run: |
|
||||
python -m pip install ".[flatpak]"
|
||||
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y \
|
||||
cmake \
|
||||
@@ -75,7 +88,7 @@ jobs:
|
||||
|
||||
- name: flatpak node generator
|
||||
# https://github.com/flatpak/flatpak-builder-tools/blob/master/node/README.md
|
||||
run: flatpak-node-generator npm package-lock.json
|
||||
run: uv run --locked --no-sync python -m flatpak_node_generator npm package-lock.json
|
||||
|
||||
- name: Debug generated-sources.json
|
||||
run: cat generated-sources.json
|
||||
@@ -83,14 +96,24 @@ jobs:
|
||||
- name: flatpak pip generator
|
||||
# generates glad-dependencies.json for PyPI build-time dependencies (e.g. jinja2 for glad)
|
||||
run: |
|
||||
python \
|
||||
uv export \
|
||||
--quiet \
|
||||
--locked \
|
||||
--only-group glad \
|
||||
--no-emit-project \
|
||||
--no-emit-local \
|
||||
--no-header \
|
||||
--output-file glad-requirements.txt
|
||||
|
||||
uv run --locked --no-sync python \
|
||||
./packaging/linux/flatpak/deps/flatpak-builder-tools/pip/flatpak-pip-generator.py \
|
||||
--runtime="org.kde.Sdk//${KDE_PLATFORM_VERSION}" \
|
||||
--output glad-dependencies \
|
||||
--build-only \
|
||||
--requirements-file=./third-party/glad/requirements.txt
|
||||
--requirements-file=glad-requirements.txt
|
||||
|
||||
# Copy generated pip sources into build dir alongside the manifest
|
||||
mkdir -p build
|
||||
cp glad-dependencies.json build/
|
||||
|
||||
- name: Cache Flatpak build
|
||||
|
||||
@@ -110,6 +110,7 @@ jobs:
|
||||
devel/llvm${{ env.FREEBSD_CLANG_VERSION }} \
|
||||
devel/ninja \
|
||||
devel/pkgconf \
|
||||
devel/uv \
|
||||
devel/qt6-base \
|
||||
ftp/curl \
|
||||
graphics/libdrm \
|
||||
@@ -138,12 +139,11 @@ jobs:
|
||||
|
||||
# setup python
|
||||
ln -s /usr/local/bin/python3.14 /usr/local/bin/python
|
||||
python -m ensurepip
|
||||
release: ${{ matrix.bsd_release }}
|
||||
run: |
|
||||
set -e
|
||||
# install glad deps and gcvor
|
||||
python -m pip install ".[glad,test]"
|
||||
uv sync --locked --group glad --group test --python /usr/local/bin/python3.14 \
|
||||
--no-python-downloads --no-install-project
|
||||
|
||||
# fix git safe.directory issues
|
||||
git config --global --add safe.directory "*"
|
||||
@@ -170,6 +170,8 @@ jobs:
|
||||
-DBUILD_WERROR=OFF \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr/local \
|
||||
-DGLAD_SKIP_PIP_INSTALL=ON \
|
||||
-DPython_EXECUTABLE="${GITHUB_WORKSPACE}/.venv/bin/python" \
|
||||
-DSUNSHINE_ASSETS_DIR=share/assets \
|
||||
-DSUNSHINE_EXECUTABLE_PATH=/usr/local/bin/sunshine \
|
||||
-DSUNSHINE_ENABLE_CUDA=OFF \
|
||||
@@ -253,7 +255,7 @@ jobs:
|
||||
shell: freebsd {0}
|
||||
run: |
|
||||
cd "${GITHUB_WORKSPACE}/build"
|
||||
python -m gcovr . -r ../src \
|
||||
uv run --locked --no-sync python -m gcovr . -r ../src \
|
||||
--exclude-noncode-lines \
|
||||
--exclude-throw-branches \
|
||||
--exclude-unreachable-branches \
|
||||
|
||||
@@ -12,6 +12,9 @@ on:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
env:
|
||||
PYTHON_VERSION: '3.14'
|
||||
|
||||
jobs:
|
||||
build_linux:
|
||||
name: ${{ matrix.name }}
|
||||
@@ -161,7 +164,15 @@ jobs:
|
||||
id: python
|
||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||
with:
|
||||
python-version: '3.14'
|
||||
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 --locked --only-group test --python "${PYTHON_VERSION}" --no-python-downloads --no-install-project
|
||||
|
||||
- name: Run tests
|
||||
id: test
|
||||
@@ -181,8 +192,7 @@ jobs:
|
||||
(steps.test.outcome == 'success' || steps.test.outcome == 'failure')
|
||||
working-directory: build
|
||||
run: |
|
||||
${{ steps.python.outputs.python-path }} -m pip install "..[test]"
|
||||
${{ steps.python.outputs.python-path }} -m gcovr --gcov-executable "gcov-${GCC_VERSION}" . -r ../src \
|
||||
uv run --locked --no-sync python -m gcovr --gcov-executable "gcov-${GCC_VERSION}" . -r ../src \
|
||||
--exclude-noncode-lines \
|
||||
--exclude-throw-branches \
|
||||
--exclude-unreachable-branches \
|
||||
|
||||
@@ -40,6 +40,7 @@ env:
|
||||
BUILD_VERSION: ${{ inputs.release_version }}
|
||||
COMMIT: ${{ inputs.release_commit }}
|
||||
MACOSX_DEPLOYMENT_TARGET: 14.2
|
||||
PYTHON_VERSION: '3.14'
|
||||
|
||||
jobs:
|
||||
build_dmg:
|
||||
@@ -87,6 +88,19 @@ jobs:
|
||||
openssl@3 \
|
||||
opus
|
||||
|
||||
- name: Setup 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 --locked --only-group test --python "${PYTHON_VERSION}" --no-python-downloads --no-install-project
|
||||
|
||||
- name: Configure
|
||||
env:
|
||||
APPLE_CODESIGN_IDENTITY: ${{ secrets.APPLE_CODESIGN_IDENTITY }}
|
||||
@@ -167,8 +181,7 @@ jobs:
|
||||
(steps.test.outcome == 'success' || steps.test.outcome == 'failure')
|
||||
working-directory: build
|
||||
run: |
|
||||
python -m pip install "..[test]"
|
||||
python -m gcovr . -r ../src \
|
||||
uv run --locked --no-sync python -m gcovr . -r ../src \
|
||||
--exclude-noncode-lines \
|
||||
--exclude-throw-branches \
|
||||
--exclude-unreachable-branches \
|
||||
|
||||
@@ -41,6 +41,9 @@ on:
|
||||
AZURE_TENANT_ID:
|
||||
required: false
|
||||
|
||||
env:
|
||||
PYTHON_VERSION: '3.14'
|
||||
|
||||
jobs:
|
||||
build_windows:
|
||||
name: ${{ matrix.name }}
|
||||
@@ -198,18 +201,20 @@ jobs:
|
||||
id: setup-python
|
||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||
with:
|
||||
python-version: '3.14'
|
||||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
|
||||
- name: Python Path
|
||||
id: python-path
|
||||
- name: Setup uv
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: Sync Python tools
|
||||
shell: msys2 {0}
|
||||
env:
|
||||
MSYS2_PATH_TYPE: inherit
|
||||
UV_PYTHON: ${{ steps.setup-python.outputs.python-path }}
|
||||
run: |
|
||||
# replace backslashes with double backslashes
|
||||
python_path=$(echo "${{ steps.setup-python.outputs.python-path }}" | sed 's/\\/\\\\/g')
|
||||
|
||||
# step output
|
||||
echo "python-path=${python_path}"
|
||||
echo "python-path=${python_path}" >> "${GITHUB_OUTPUT}"
|
||||
uv sync --locked --only-group test --no-python-downloads --no-install-project
|
||||
|
||||
- name: Build Windows
|
||||
shell: msys2 {0}
|
||||
@@ -359,9 +364,10 @@ jobs:
|
||||
(steps.test.outcome == 'success' || steps.test.outcome == 'failure')
|
||||
shell: msys2 {0}
|
||||
working-directory: build
|
||||
env:
|
||||
MSYS2_PATH_TYPE: inherit
|
||||
run: |
|
||||
${{ steps.python-path.outputs.python-path }} -m pip install "..[test]"
|
||||
${{ steps.python-path.outputs.python-path }} -m gcovr . -r ../src \
|
||||
uv run --locked --no-sync python -m gcovr . -r ../src \
|
||||
--exclude-noncode-lines \
|
||||
--exclude-throw-branches \
|
||||
--exclude-unreachable-branches \
|
||||
|
||||
@@ -14,6 +14,7 @@ on:
|
||||
|
||||
env:
|
||||
FILE: ./locale/sunshine.po
|
||||
PYTHON_VERSION: '3.14'
|
||||
|
||||
jobs:
|
||||
localize:
|
||||
@@ -28,12 +29,19 @@ jobs:
|
||||
- name: Install Python
|
||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||
with:
|
||||
python-version: '3.14'
|
||||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
|
||||
- name: Set up Python Dependencies
|
||||
- name: Setup uv
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: Sync Python tools
|
||||
run: |
|
||||
python -m pip install --upgrade pip setuptools
|
||||
python -m pip install ".[locale]"
|
||||
uv sync --locked --only-group locale \
|
||||
--python "${PYTHON_VERSION}" \
|
||||
--no-python-downloads \
|
||||
--no-install-project
|
||||
|
||||
- name: Set up xgettext
|
||||
run: |
|
||||
@@ -54,7 +62,7 @@ jobs:
|
||||
echo "NEW_FILE=${new_file}" >> "${GITHUB_ENV}"
|
||||
|
||||
# extract the new strings
|
||||
python ./scripts/_locale.py --extract
|
||||
uv run --locked --no-sync python ./scripts/_locale.py --extract
|
||||
|
||||
- name: git diff
|
||||
if: env.NEW_FILE == 'false'
|
||||
|
||||
Reference in New Issue
Block a user