Skip to content

Commit

Permalink
Add configure script checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexhuszagh committed Sep 7, 2024
1 parent 68a35db commit 7e6b1ee
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 10 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/configure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Configure

on: [push]

jobs:
theme-python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: 3.10
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install PySide2 PySide6 PyQt5 PyQt6
- name: Checking our configuration scripts.
run: |
scripts/configure.sh
26 changes: 22 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,33 @@ jobs:
scripts/lint.sh
lint-cpp:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt update
sudo apt install clang-tidy -y
python -m pip install --upgrade pip
pip install clang-tidy
- name: Analysing the code with clang-tidy
shell: bash
run: |
set -eux pipefail
clang-tidy -checks=-*,clang-analyzer-*,-clang-analyzer-cplusplus* example/breeze_theme.hpp --
# Windows oddly requires C++20 support due to internal bugs.
if [[ "${RUNNER_OS}" == "Windows" ]]; then
extra_args="-extra-arg=-std=c++20"
passthrough=""
elif [[ "${RUNNER_OS}" == "macOS" ]]; then
# NOTE: The search paths aren't added by default, and we need C then C++ by default
# for our search. This makes the process easier.
extra_args="-extra-arg=-std=c++17 -extra-arg=--stdlib=libc++"
location="$(xcrun --show-sdk-path)"
passthrough="-I${location}/usr/include/c++/v1 -I${location}/usr/include"
else
extra_args="-extra-arg=-std=c++17"
passthrough=""
fi
clang-tidy -checks=-*,clang-analyzer-*,-clang-analyzer-cplusplus* ${extra_args} example/breeze_theme.hpp -- ${passthrough}
4 changes: 2 additions & 2 deletions .github/workflows/theme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
shell: bash
run: |
python -m pip install --upgrade pip
if [[ "$RUNNER_OS" == "Windows" ]]; then
python -m pip install winrt-Windows.UI.ViewManagement winrt-Windows.UI
if [[ "${RUNNER_OS}" == "Windows" ]]; then
python -m pip install winrt-Windows.UI.ViewManagement winrt-Windows.UI
fi
- name: Checking our Python imports.
run: |
Expand Down
9 changes: 5 additions & 4 deletions example/breeze_theme.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,17 +423,18 @@ namespace breeze_stylesheets
// this will return something like `prefer - dark`, which is the true value.
// valid values are 'default', 'prefer-dark', 'prefer-light'.
const ::std::string command = "gsettings get org.gnome.desktop.interface ";
auto [stdout, code] = ::breeze_stylesheets::_run_command(command + "color-scheme");
if (code != EXIT_SUCCESS)
auto result = ::breeze_stylesheets::_run_command(command + "color-scheme");
if (::std::get<1>(result) != EXIT_SUCCESS)
{
// NOTE: We always assume this is due to invalid key, which might not be true
// since we don't check if gsettings exists first.
// if not found then trying older gtk-theme method
// this relies on the theme not lying to you : if the theme is dark, it ends in `- dark`.
auto [stdout, code] = ::breeze_stylesheets::_run_command(command + "gtk-theme");
result = ::breeze_stylesheets::_run_command(command + "gtk-theme");
}

if (code != EXIT_SUCCESS || !stdout.has_value())
auto stdout = ::std::get<0>(result);
if (::std::get<1>(result) != EXIT_SUCCESS || !stdout.has_value())
throw new ::std::runtime_error("Unable to get response for the current system theme.");

auto value = stdout.value();
Expand Down

0 comments on commit 7e6b1ee

Please sign in to comment.