From 725d76d9c5bb6a01b5b643fe1a9f1afd1b92163b Mon Sep 17 00:00:00 2001 From: suchmememanyskill <38142618+suchmememanyskill@users.noreply.github.com> Date: Wed, 7 Feb 2024 23:39:25 +0100 Subject: [PATCH] Modify CI further --- .github/workflows/compile.yaml | 4 ---- _site/index.html | 10 ++++++-- _site/manifest.json | 27 --------------------- _site/manifest_wipe.json | 10 -------- ci.py | 43 +++++++++++++++++++++++++++++++--- 5 files changed, 48 insertions(+), 46 deletions(-) delete mode 100644 _site/manifest.json delete mode 100644 _site/manifest_wipe.json diff --git a/.github/workflows/compile.yaml b/.github/workflows/compile.yaml index b20c296..fd0384b 100644 --- a/.github/workflows/compile.yaml +++ b/.github/workflows/compile.yaml @@ -29,10 +29,6 @@ jobs: - name: Build PlatformIO Project run: | python3 ci.py - - - name: Copy output to site - run: | - cp -r ./out ./_site - name: Upload artifact uses: actions/upload-artifact@v3 diff --git a/_site/index.html b/_site/index.html index aeecc14..270dbe8 100644 --- a/_site/index.html +++ b/_site/index.html @@ -24,10 +24,16 @@ GitHub repo Donate KoFi
-

Install

+

Install on ESP32-2432S028 (Resistive)

Note: You may need to hold the 'BOOT' button on the device while pressing install

+ manifest="https://suchmememanyskill.github.io/CYD-Klipper/esp32-2432S028R.json"> +
+
+

Install on ESP32-3248S035 (Capacitive)

+

Note: You may need to hold the 'BOOT' button on the device while pressing install

+
\ No newline at end of file diff --git a/_site/manifest.json b/_site/manifest.json deleted file mode 100644 index d8029dc..0000000 --- a/_site/manifest.json +++ /dev/null @@ -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 - } - ] - } - ] -} \ No newline at end of file diff --git a/_site/manifest_wipe.json b/_site/manifest_wipe.json deleted file mode 100644 index 8e471f8..0000000 --- a/_site/manifest_wipe.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "CYD-Klipper", - "new_install_prompt_erase": false, - "builds": [ - { - "path": "output/merged-firmware.bin", - "offset": 0 - } - ] -} \ No newline at end of file diff --git a/ci.py b/ci.py index 956fdbf..d339c0c 100644 --- a/ci.py +++ b/ci.py @@ -1,21 +1,58 @@ -import subprocess, os, shutil +import subprocess, os, shutil, json CYD_PORTS = ["esp32-3248S035C", "esp32-2432S028R"] 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"): shutil.rmtree("out") for port in CYD_PORTS: - port_path = os.path.join("out", port) + port_path = f"out/{port}" os.chdir(BASE_DIR) os.makedirs(port_path, exist_ok=True) os.chdir("CYD-Klipper") subprocess.run(["pio", "run", "-e", port], check=True) - os.chdir("..") + os.chdir(BASE_DIR) for file in ["bootloader.bin", "partitions.bin", "firmware.bin"]: 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") 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) + + 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")