Modify CI further

This commit is contained in:
suchmememanyskill
2024-02-07 23:39:25 +01:00
parent e669017949
commit 725d76d9c5
5 changed files with 48 additions and 46 deletions

View File

@@ -30,10 +30,6 @@ jobs:
run: | run: |
python3 ci.py python3 ci.py
- name: Copy output to site
run: |
cp -r ./out ./_site
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:

View File

@@ -24,10 +24,16 @@
<a href="https://github.com/suchmememanyskill/CYD-Klipper"><img alt="GitHub repo" src="https://img.shields.io/badge/Source-Github-blue.svg"></a> <a href="https://github.com/suchmememanyskill/CYD-Klipper"><img alt="GitHub repo" src="https://img.shields.io/badge/Source-Github-blue.svg"></a>
<a href="https://ko-fi.com/suchmememanyskill"><img alt="Donate KoFi" src="https://img.shields.io/badge/Support%2FDonate%20On-Ko%20Fi-red"></a> <a href="https://ko-fi.com/suchmememanyskill"><img alt="Donate KoFi" src="https://img.shields.io/badge/Support%2FDonate%20On-Ko%20Fi-red"></a>
<section class="install"> <section class="install">
<h3>Install</h3> <h3>Install on ESP32-2432S028 (Resistive)</h3>
<p>Note: You may need to hold the 'BOOT' button on the device while pressing install</p> <p>Note: You may need to hold the 'BOOT' button on the device while pressing install</p>
<esp-web-install-button <esp-web-install-button
manifest="https://suchmememanyskill.github.io/CYD-Klipper/manifest.json"></esp-web-install-button> manifest="https://suchmememanyskill.github.io/CYD-Klipper/esp32-2432S028R.json"></esp-web-install-button>
</section>
<section class="install">
<h3>Install on ESP32-3248S035 (Capacitive)</h3>
<p>Note: You may need to hold the 'BOOT' button on the device while pressing install</p>
<esp-web-install-button
manifest="https://suchmememanyskill.github.io/CYD-Klipper/esp32-3248S035C.json"></esp-web-install-button>
</section> </section>
</section> </section>
</body> </body>

View File

@@ -1,27 +0,0 @@
{
"name": "CYD-Klipper",
"new_install_prompt_erase": true,
"builds": [
{
"chipFamily": "ESP32",
"parts": [
{
"path": "output/bootloader.bin",
"offset": 4096
},
{
"path": "output/partitions.bin",
"offset": 32768
},
{
"path": "output/boot_app0.bin",
"offset": 57344
},
{
"path": "output/firmware.bin",
"offset": 65536
}
]
}
]
}

View File

@@ -1,10 +0,0 @@
{
"name": "CYD-Klipper",
"new_install_prompt_erase": false,
"builds": [
{
"path": "output/merged-firmware.bin",
"offset": 0
}
]
}

43
ci.py
View File

@@ -1,21 +1,58 @@
import subprocess, os, shutil import subprocess, os, shutil, json
CYD_PORTS = ["esp32-3248S035C", "esp32-2432S028R"] CYD_PORTS = ["esp32-3248S035C", "esp32-2432S028R"]
BASE_DIR = os.getcwd() BASE_DIR = os.getcwd()
def get_manifest(base_path : str):
return {
"name": "CYD-Klipper",
"new_install_prompt_erase": True,
"builds": [
{
"chipFamily": "ESP32",
"parts": [
{
"path": f"{base_path}/bootloader.bin",
"offset": 4096
},
{
"path": f"{base_path}/partitions.bin",
"offset": 32768
},
{
"path": f"{base_path}/boot_app0.bin",
"offset": 57344
},
{
"path": f"{base_path}/firmware.bin",
"offset": 65536
}
]
}
]
}
if os.path.exists("out"): if os.path.exists("out"):
shutil.rmtree("out") shutil.rmtree("out")
for port in CYD_PORTS: for port in CYD_PORTS:
port_path = os.path.join("out", port) port_path = f"out/{port}"
os.chdir(BASE_DIR) os.chdir(BASE_DIR)
os.makedirs(port_path, exist_ok=True) os.makedirs(port_path, exist_ok=True)
os.chdir("CYD-Klipper") os.chdir("CYD-Klipper")
subprocess.run(["pio", "run", "-e", port], check=True) subprocess.run(["pio", "run", "-e", port], check=True)
os.chdir("..") os.chdir(BASE_DIR)
for file in ["bootloader.bin", "partitions.bin", "firmware.bin"]: for file in ["bootloader.bin", "partitions.bin", "firmware.bin"]:
shutil.copy(f"./CYD-Klipper/.pio/build/{port}/{file}", f"{port_path}/{file}") shutil.copy(f"./CYD-Klipper/.pio/build/{port}/{file}", f"{port_path}/{file}")
shutil.copy(os.path.join(os.path.expanduser("~"), ".platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin"), f"{port_path}/boot_app0.bin") 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) os.chdir(port_path)
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(["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)
os.chdir(BASE_DIR)
with open(f"./_site/{port}.json", "w") as f:
json.dump(get_manifest(port_path), f)
os.chdir(BASE_DIR)
shutil.copytree("./out", "./_site/out")