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
35 changes: 29 additions & 6 deletions .github/workflows/ci-flatpak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
required: true
type: string

env:
PYTHON_VERSION: '3.14'

jobs:
build_linux_flatpak:
name: ${{ matrix.arch }}
Expand Down Expand Up @@ -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 Dependencies Linux Flatpak
- 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 ".[flatpak]"
uv sync --locked --only-group flatpak \
--python "${PYTHON_VERSION}" \
--no-python-downloads \
--no-install-project

- name: Setup Dependencies Linux Flatpak
run: |
sudo apt-get update -y
sudo apt-get install -y \
cmake \
Expand All @@ -75,22 +88,32 @@ 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

- 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
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/ci-freebsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ jobs:
devel/llvm${{ env.FREEBSD_CLANG_VERSION }} \
devel/ninja \
devel/pkgconf \
devel/uv \
devel/qt6-base \
ftp/curl \
graphics/libdrm \
Expand Down Expand Up @@ -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 "*"
Expand All @@ -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 \
Expand Down Expand Up @@ -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 \
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
required: true
type: string

env:
PYTHON_VERSION: '3.14'

jobs:
build_linux:
name: ${{ matrix.name }}
Expand Down Expand Up @@ -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
Expand All @@ -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 \
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 \
Expand Down
28 changes: 17 additions & 11 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ on:
AZURE_TENANT_ID:
required: false

env:
PYTHON_VERSION: '3.14'

jobs:
build_windows:
name: ${{ matrix.name }}
Expand Down Expand Up @@ -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: Setup uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true

- name: Python Path
id: python-path
- 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}
Expand Down Expand Up @@ -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 \
Expand Down
18 changes: 13 additions & 5 deletions .github/workflows/localize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:

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

jobs:
localize:
Expand All @@ -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: |
Expand All @@ -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'
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,7 @@ node_modules/
.DS_Store

# Python
*.egg-info/
*.pyc
.venv/
venv/
60 changes: 33 additions & 27 deletions cmake/dependencies/glad.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ include_guard(GLOBAL)
# cache before add_subdirectory() causes glad's find_package(PythonInterp) to
# skip its own search and reuse our interpreter directly.
#
# GLAD_SKIP_PIP_INSTALL is a hard override for environments where pip cannot run
# GLAD_SKIP_PIP_INSTALL is a hard override for environments where Python dependency installs cannot run
# at all (e.g. Flatpak, Homebrew). When OFF (the default) the code below checks
# whether jinja2+setuptools are importable and pip-installs them if they are not.
# whether jinja2+setuptools are importable and installs them with uv if they are not.
# When ON the caller is responsible for supplying a Python that already has jinja2,
# typically via -DPython_EXECUTABLE=/path/to/venv/python.
option(GLAD_SKIP_PIP_INSTALL
"Hard-skip pip install of jinja2 even if it is not importable. \
Only needed in sandboxed build environments (e.g. Flatpak, Homebrew) where pip cannot run." OFF)
"Hard-skip Python dependency installation for jinja2 even if it is not importable. \
Only needed in sandboxed build environments (e.g. Flatpak, Homebrew) where Python dependency installs cannot run." OFF)

if(NOT GLAD_SKIP_PIP_INSTALL)
# glad's generator requires Python >= 3.8 (importlib.metadata) and jinja2.
Expand Down Expand Up @@ -115,41 +115,47 @@ if(NOT GLAD_SKIP_PIP_INSTALL)
)

if(NOT _glad_deps_import_result EQUAL 0)
message(STATUS "glad: jinja2 or setuptools not found in ${Python_EXECUTABLE}, installing via pip...")
find_program(UV_EXECUTABLE uv)
if(NOT UV_EXECUTABLE)
message(FATAL_ERROR
"glad: jinja2 or setuptools not found in ${Python_EXECUTABLE}, and uv is not available.\n"
"Install uv, or provide a Python interpreter with glad dependencies installed and set "
"-DGLAD_SKIP_PIP_INSTALL=ON.")
endif()

# Some system Python installations (e.g. FreeBSD ports) ship without pip.
# Try to bootstrap it via ensurepip before falling back to the pip install.
set(_glad_python_venv "${CMAKE_BINARY_DIR}/glad-python")
message(STATUS "glad: jinja2 or setuptools not found in ${Python_EXECUTABLE}, installing via uv...")
execute_process(
COMMAND "${Python_EXECUTABLE}" -m pip --version
RESULT_VARIABLE _pip_available
OUTPUT_QUIET ERROR_QUIET
COMMAND "${UV_EXECUTABLE}" venv
--python "${Python_EXECUTABLE}"
--no-python-downloads
--allow-existing
"${_glad_python_venv}"
COMMAND_ERROR_IS_FATAL ANY
)
if(NOT _pip_available EQUAL 0)
message(STATUS "glad: pip not found in ${Python_EXECUTABLE}, bootstrapping via ensurepip...")
execute_process(
COMMAND "${Python_EXECUTABLE}" -m ensurepip --upgrade
RESULT_VARIABLE _ensurepip_result
OUTPUT_QUIET ERROR_QUIET
)
if(NOT _ensurepip_result EQUAL 0)
message(FATAL_ERROR
"glad: pip is not available in ${Python_EXECUTABLE} and ensurepip failed to "
"bootstrap it.\nPlease install pip for your Python interpreter "
"(e.g. 'pkg install py311-pip' on FreeBSD, or the python3-pip package for "
"your distro) and re-run cmake.")
endif()

if(WIN32)
set(_glad_python_executable "${_glad_python_venv}/Scripts/python.exe")
else()
set(_glad_python_executable "${_glad_python_venv}/bin/python")
endif()

execute_process(
COMMAND "${Python_EXECUTABLE}" -m pip install
--upgrade
COMMAND "${UV_EXECUTABLE}" pip install
--python "${_glad_python_executable}"
--requirement "${CMAKE_SOURCE_DIR}/third-party/glad/requirements.txt"
"setuptools<81"
--quiet
COMMAND_ERROR_IS_FATAL ANY
)

set(Python_EXECUTABLE "${_glad_python_executable}" # cmake-lint: disable=C0103
CACHE FILEPATH "Python interpreter" FORCE)
set(PYTHON_EXECUTABLE "${Python_EXECUTABLE}" CACHE FILEPATH "Python interpreter for glad" FORCE)
else()
message(STATUS "glad: jinja2 and setuptools already available in ${Python_EXECUTABLE}, skipping pip install")
message(STATUS
"glad: jinja2 and setuptools already available in "
"${Python_EXECUTABLE}, skipping Python dependency install")
endif()
endif()

Expand Down
Loading
Loading