mirror of
https://github.com/suchmememanyskill/CYD-Klipper.git
synced 2026-03-20 21:23:25 +00:00
Better CI pipeline
This commit is contained in:
61
ci.json
Normal file
61
ci.json
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"esp32-2432S024C-SD": {
|
||||
"name": "ESP32-2432S024 (2.4\" Capacitive)",
|
||||
"site": true,
|
||||
"s3": false
|
||||
},
|
||||
"esp32-2432S028R": {
|
||||
"name": "ESP32-2432S028 (2.8\" Resistive)",
|
||||
"site": true,
|
||||
"s3": false,
|
||||
"default": true
|
||||
},
|
||||
"esp32-2432S032C-SD": {
|
||||
"name": "ESP32-2432S032 (3.2\" Capacitive)",
|
||||
"site": true,
|
||||
"s3": false
|
||||
},
|
||||
"esp32-3248S035C": {
|
||||
"name": "ESP32-3248S035 (3.5\" Capacitive)",
|
||||
"site": true,
|
||||
"s3": false
|
||||
},
|
||||
"esp32-3248S035C-V": {
|
||||
"name": "ESP32-3248S035 (3.5\" Capacitive) Vertical Orientation",
|
||||
"site": true,
|
||||
"s3": false
|
||||
},
|
||||
"esp32-4827S043C-SD": {
|
||||
"name": "ESP32-4827S043 (4.3\" 480x270 Capacitive)",
|
||||
"site": true,
|
||||
"s3": true
|
||||
},
|
||||
"esp32-8048S043C-SD": {
|
||||
"name": "ESP32-8048S043 (4.3\" 800x480 Capacitive)",
|
||||
"site": true,
|
||||
"s3": true
|
||||
},
|
||||
"esp32-8048S043C-SD-alt": {
|
||||
"name": "ESP32-8048S043 Alt (4.3\" 800x480 Capacitive)",
|
||||
"site": true,
|
||||
"s3": true
|
||||
},
|
||||
"esp32-CROWPANEL-28R": {
|
||||
"name": "ESP32-CROWPANEL-28R (2.8\" Resistive)",
|
||||
"site": true,
|
||||
"s3": false,
|
||||
"brand": "CrowPanel"
|
||||
},
|
||||
"esp32-CROWPANEL-35C": {
|
||||
"name": "ESP32-CROWPANEL-35C (3.5\" Capacitive)",
|
||||
"site": true,
|
||||
"s3": true,
|
||||
"brand": "CrowPanel"
|
||||
},
|
||||
"esp32-JC8048W550": {
|
||||
"name": "Guition JC8048W550 (5\" Capacitive)",
|
||||
"site": true,
|
||||
"s3": true,
|
||||
"brand": "Guition"
|
||||
}
|
||||
}
|
||||
57
ci.py
57
ci.py
@@ -1,8 +1,8 @@
|
||||
import subprocess, os, shutil, json
|
||||
|
||||
CYD_PORTS = [
|
||||
"esp32-3248S035C",
|
||||
"esp32-2432S028R",
|
||||
"esp32-3248S035C",
|
||||
"esp32-2432S032C-SD",
|
||||
"esp32-8048S043C-SD",
|
||||
"esp32-8048S043C-SD-alt",
|
||||
@@ -25,18 +25,18 @@ ESP_S3_CHIPS = [
|
||||
|
||||
BASE_DIR = os.getcwd()
|
||||
|
||||
def get_manifest(base_path : str, device_name : str):
|
||||
def get_manifest(base_path : str, device_name : str, is_s3 : bool):
|
||||
return {
|
||||
"name": f"to {device_name}",
|
||||
"funding_url": "https://ko-fi.com/suchmememanyskill",
|
||||
"new_install_prompt_erase": True,
|
||||
"builds": [
|
||||
{
|
||||
"chipFamily": "ESP32-S3" if device_name in ESP_S3_CHIPS else "ESP32",
|
||||
"chipFamily": "ESP32-S3" if is_s3 else "ESP32",
|
||||
"parts": [
|
||||
{
|
||||
"path": f"{base_path}/bootloader.bin",
|
||||
"offset": 0 if device_name in ESP_S3_CHIPS else 0x1000
|
||||
"offset": 0 if is_s3 else 0x1000
|
||||
},
|
||||
{
|
||||
"path": f"{base_path}/partitions.bin",
|
||||
@@ -61,6 +61,7 @@ def extract_commit() -> str:
|
||||
|
||||
repo_version = extract_commit()
|
||||
configurations = []
|
||||
site_sections : dict[str, dict] = {"CYD": []}
|
||||
|
||||
def add_configuration(board : str):
|
||||
configurations.append({
|
||||
@@ -69,10 +70,32 @@ def add_configuration(board : str):
|
||||
"URL": f"https://suchmememanyskill.github.io/CYD-Klipper/out/{board}/firmware.bin"
|
||||
})
|
||||
|
||||
def add_site_section(port : str, data : dict[str, bool|str]):
|
||||
brand = data["brand"] if "brand" in data else "CYD"
|
||||
|
||||
if brand not in site_sections:
|
||||
site_sections[brand] = []
|
||||
|
||||
site_sections[brand].append({
|
||||
"name": data["name"],
|
||||
"port": port,
|
||||
"default": "default" in data and data["default"],
|
||||
})
|
||||
|
||||
if os.path.exists("out"):
|
||||
shutil.rmtree("out")
|
||||
|
||||
for port in CYD_PORTS:
|
||||
if not os.path.exists("_site"):
|
||||
os.makedirs("_site")
|
||||
|
||||
with open("./ci.json", "r") as fp:
|
||||
ci_data : dict[str, dict[str, bool|str]] = json.load(fp)
|
||||
|
||||
for port, data in ci_data.items():
|
||||
if "skip" in data and data["skip"]:
|
||||
print(f"Skipping {port}...")
|
||||
continue
|
||||
|
||||
port_path = f"out/{port}"
|
||||
os.chdir(BASE_DIR)
|
||||
os.makedirs(port_path, exist_ok=True)
|
||||
@@ -84,18 +107,21 @@ for port in CYD_PORTS:
|
||||
|
||||
shutil.copy(os.path.join(os.path.expanduser("~"), ".platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin"), f"{port_path}/boot_app0.bin")
|
||||
os.chdir(port_path)
|
||||
if (port in ESP_S3_CHIPS):
|
||||
subprocess.run(["python3", "-m", "esptool", "--chip", "esp32s3", "merge_bin", "-o", "merged_firmware.bin", "--flash_mode", "dio", "--flash_freq", "80m", "--flash_size", "16MB", "0x0000", "bootloader.bin", "0x8000", "partitions.bin", "0xe000", "boot_app0.bin", "0x10000", "firmware.bin"], check=True)
|
||||
if (bool(data["s3"])):
|
||||
subprocess.run(["esptool", "--chip", "esp32s3", "merge_bin", "-o", "merged_firmware.bin", "--flash_mode", "dio", "--flash_freq", "80m", "--flash_size", "16MB", "0x0000", "bootloader.bin", "0x8000", "partitions.bin", "0xe000", "boot_app0.bin", "0x10000", "firmware.bin"], check=True)
|
||||
else:
|
||||
subprocess.run(["python3", "-m", "esptool", "--chip", "esp32", "merge_bin", "-o", "merged_firmware.bin", "--flash_mode", "dio", "--flash_freq", "40m", "--flash_size", "4MB", "0x1000", "bootloader.bin", "0x8000", "partitions.bin", "0xe000", "boot_app0.bin", "0x10000", "firmware.bin"], check=True)
|
||||
subprocess.run(["esptool", "--chip", "esp32", "merge_bin", "-o", "merged_firmware.bin", "--flash_mode", "dio", "--flash_freq", "40m", "--flash_size", "4MB", "0x1000", "bootloader.bin", "0x8000", "partitions.bin", "0xe000", "boot_app0.bin", "0x10000", "firmware.bin"], check=True)
|
||||
|
||||
os.chdir(BASE_DIR)
|
||||
|
||||
with open(f"./_site/{port}.json", "w") as f:
|
||||
json.dump(get_manifest(port_path, port), f)
|
||||
json.dump(get_manifest(port_path, port, bool(data["s3"])), f)
|
||||
|
||||
add_configuration(port)
|
||||
|
||||
if "site" in data and data["site"]:
|
||||
add_site_section(port, data)
|
||||
|
||||
os.chdir(BASE_DIR)
|
||||
out_dir = "./_site/out"
|
||||
if os.path.exists(out_dir):
|
||||
@@ -104,3 +130,16 @@ shutil.copytree("./out", out_dir)
|
||||
|
||||
with open("./_site/OTA.json", "w") as f:
|
||||
json.dump({"Configurations": configurations}, f)
|
||||
|
||||
with open("./_site/index.html", "w") as fp:
|
||||
with open("./template.html", "r") as template_fp:
|
||||
template = template_fp.read()
|
||||
|
||||
insert_html = ""
|
||||
|
||||
for brand, sections in site_sections.items():
|
||||
option_htmls = [f"<option {'selected' if x['default'] else ''} value=\"{x['port']}\">{x['name']}</option>" for x in sections]
|
||||
section_html = f"<optgroup label=\"{brand}\">{''.join(option_htmls)}</optgroup>"
|
||||
insert_html += section_html
|
||||
|
||||
fp.write(template.replace("{{%PORTS%}}", insert_html))
|
||||
@@ -132,17 +132,7 @@
|
||||
<h3><span class="iconify" data-icon="mdi-download"></span> Install</h3>
|
||||
<p>Select your device from the list below and click 'Connect'.<br>Note: You may need to hold the 'BOOT' button on the device while pressing install.<br><br>The 2.8" Resistive and 3.5" Capacitive models are best suited (in my opinion) for CYD-Klipper.<br><br>Note for any resistive models: You can clear touch calibration by holding the BOOT button for 8 seconds while the screen is on.</p>
|
||||
<select id="select-install-btn" onchange="setInstallButton(getElementById('select-install-btn').value)">
|
||||
<option value="esp32-2432S024C-SD">ESP32-2432S024 (2.4" Capacitive)</option>
|
||||
<option selected value="esp32-2432S028R">ESP32-2432S028 (2.8" Resistive)</option>
|
||||
<option value="esp32-2432S032C-SD">ESP32-2432S032 (3.2" Capacitive)</option>
|
||||
<option value="esp32-3248S035C">ESP32-3248S035 (3.5" Capacitive)</option>
|
||||
<option value="esp32-3248S035C-V">ESP32-3248S035 (3.5" Capacitive) Vertical Orientation</option>
|
||||
<option value="esp32-4827S043C-SD">ESP32-4827S043 (4.3" 480x270 Capacitive)</option>
|
||||
<option value="esp32-8048S043C-SD">ESP32-8048S043 (4.3" 800x480 Capacitive)</option>
|
||||
<option value="esp32-8048S043C-SD-alt">ESP32-8048S043 Alt (4.3" 800x480 Capacitive)</option>
|
||||
<option value="esp32-CROWPANEL-28R">ESP32-CROWPANEL-28R (2.8" Resistive)</option>
|
||||
<option value="esp32-JC8048W550">Guition JC8048W550 (5" Capacitive)</option>
|
||||
<option value="esp32-CROWPANEL-35C">ESP32-CROWPANEL-35C (3.5" Capacitive)</option>
|
||||
{{%PORTS%}}
|
||||
</select>
|
||||
<span id="install-btn"></span>
|
||||
</section>
|
||||
Reference in New Issue
Block a user