Merge pull request #20414 from Ultimaker/CURA-12469_colors_for_dev_builds

[CURA-12469] Have developer/tester/etc. builds be distinct per biweekly day.
This commit is contained in:
Remco Burema 2025-03-27 07:47:35 +01:00 committed by GitHub
commit fbb15db9e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 46 additions and 1 deletions

View File

@ -10,7 +10,7 @@ requirements:
- "pynest2d/5.10.0"
requirements_internal:
- "fdm_materials/5.11.0-alpha.0@ultimaker/testing"
- "cura_private_data/5.10.0-alpha.0@internal/testing"
- "cura_private_data/5.11.0-alpha.0@internal/testing"
requirements_enterprise:
- "native_cad_plugin/2.0.0"
urls:

View File

@ -1,8 +1,10 @@
import json
import os
import requests
import yaml
import tempfile
import tarfile
from datetime import datetime
from io import StringIO
from pathlib import Path
from git import Repo
@ -562,6 +564,30 @@ class CuraConan(ConanFile):
self.cpp.package.bindirs = ["bin"]
self.cpp.package.resdirs = ["resources", "plugins", "packaging"]
def _make_internal_distinct(self):
test_colors_path = Path(self.source_folder, "resources", "themes", "daily_test_colors.json")
if not test_colors_path.exists():
print(f"Could not find '{str(test_colors_path)}'. Won't generate rotating colors for alpha builds.")
return
if "alpha" in self.version:
biweekly_day = (datetime.now() - datetime(2025, 3, 14)).days
with test_colors_path.open("r") as test_colors_file:
test_colors = json.load(test_colors_file)
for theme_dir in Path(self.source_folder, "resources", "themes").iterdir():
if not theme_dir.is_dir():
continue
theme_path = Path(theme_dir, "theme.json")
if not theme_path.exists():
print(f"('Colorize-by-day' alpha builds): Skipping {str(theme_path)}, could not find file.")
continue
with theme_path.open("r") as theme_file:
theme = json.load(theme_file)
if theme["colors"]:
theme["colors"]["main_window_header_background"] = test_colors[biweekly_day]
with theme_path.open("w") as theme_file:
json.dump(theme, theme_file)
test_colors_path.unlink()
def generate(self):
copy(self, "cura_app.py", self.source_folder, str(self._script_dir))
@ -581,6 +607,9 @@ class CuraConan(ConanFile):
copy(self, "bundled_*.json", native_cad_plugin.resdirs[1],
str(Path(self.source_folder, "resources", "bundled_packages")), keep_path = False)
# Make internal versions built on different days distinct, so people don't get confused while testing.
self._make_internal_distinct()
# Copy resources of cura_binary_data
cura_binary_data = self.dependencies["cura_binary_data"].cpp_info
copy(self, "*", cura_binary_data.resdirs[0], str(self._share_dir.joinpath("cura")), keep_path = True)

View File

@ -0,0 +1,16 @@
[
[ 62, 33, 55, 255],
[126, 196, 193, 255],
[126, 196, 193, 255],
[215, 155, 125, 255],
[228, 148, 58, 255],
[192, 199, 65, 255],
[157, 48, 59, 255],
[140, 143, 174, 255],
[ 23, 67, 75, 255],
[ 23, 67, 75, 255],
[154, 99, 72, 255],
[112, 55, 127, 255],
[100, 125, 52, 255],
[210, 100, 113, 255]
]