diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index d2f3cf3..4213b80 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -28,6 +28,44 @@ jobs: assert parse_serial_line('garbage\n').malformed PY + - name: Compile release assembly script + run: python -m py_compile release/scripts/assemble_customer_package.py + - name: Release assembly script help + run: python release/scripts/assemble_customer_package.py --help + - name: Release assembly smoke test + run: | + set -euo pipefail + cleanup() { + rm -rf \ + release/artifacts/windows/PortableAVRControlStudio.exe \ + release/artifacts/firmware/PortableAVRControlStudio.ino.hex \ + release/customer_package/PortableAVRControlStudio-customer-handoff \ + release/customer_package/PortableAVRControlStudio-customer-handoff.zip + } + trap cleanup EXIT + + printf 'dummy exe for CI release assembly smoke test\n' > release/artifacts/windows/PortableAVRControlStudio.exe + printf ':00000001FF\n' > release/artifacts/firmware/PortableAVRControlStudio.ino.hex + + python release/scripts/assemble_customer_package.py + + test -d release/customer_package/PortableAVRControlStudio-customer-handoff + test -f release/customer_package/PortableAVRControlStudio-customer-handoff.zip + test -f release/customer_package/PortableAVRControlStudio-customer-handoff/PortableAVRControlStudio.exe + test -f release/customer_package/PortableAVRControlStudio-customer-handoff/PortableAVRControlStudio.ino.hex + test -f release/customer_package/PortableAVRControlStudio-customer-handoff/README.md + test -f release/customer_package/PortableAVRControlStudio-customer-handoff/docs/customer_handoff.md + test -f release/customer_package/PortableAVRControlStudio-customer-handoff/docs/PROTOCOL.md + test -f release/customer_package/PortableAVRControlStudio-customer-handoff/docs/product_spec.md + test -f release/customer_package/PortableAVRControlStudio-customer-handoff/docs/testing.md + test -f release/customer_package/PortableAVRControlStudio-customer-handoff/docs/profiles/arduino_uno_avr.json + + git check-ignore \ + release/artifacts/windows/PortableAVRControlStudio.exe \ + release/artifacts/firmware/PortableAVRControlStudio.ino.hex \ + release/customer_package/PortableAVRControlStudio-customer-handoff \ + release/customer_package/PortableAVRControlStudio-customer-handoff.zip + avr-compile: name: Arduino AVR Uno compile runs-on: ubuntu-latest diff --git a/docs/PACKAGING.md b/docs/PACKAGING.md index f602116..70bf731 100644 --- a/docs/PACKAGING.md +++ b/docs/PACKAGING.md @@ -1,6 +1,6 @@ # Release Packaging -See `release/README.md` for the proposed customer handoff folder layout. Generated EXE and HEX artifacts should be staged under `release/artifacts/` and copied into `release/customer_package/` only when preparing a customer ZIP. +See `release/README.md` and `release/BUILD_VERIFICATION.md` for the customer handoff folder layout and artifact verification workflow. Generated EXE and HEX artifacts should be staged under `release/artifacts/` and copied into `release/customer_package/` only when preparing a customer ZIP. ## Portable Windows Packaging @@ -34,16 +34,22 @@ py -m pip install --upgrade pyinstaller pyserial py -m PyInstaller --noconfirm --onefile --windowed --name PortableAVRControlStudio --distpath release\artifacts\windows --workpath build\pyinstaller --specpath build\pyinstaller-spec gui\portable_avr_control_studio.py ``` -Copy these items into the customer handoff folder after the build and checks pass: +After the build and checks pass, the customer handoff package can be assembled with: + +```bash +python release/scripts/assemble_customer_package.py +``` + +The script copies these items into `release/customer_package/PortableAVRControlStudio-customer-handoff/`: 1. `release\artifacts\windows\PortableAVRControlStudio.exe` -2. `README.md` -3. `docs\PROTOCOL.md` -4. `docs\product_spec.md` -5. `docs\testing.md` -6. `docs\customer_handoff.md` -7. `docs\profiles\*.json` -8. Prepared Arduino Uno `.hex` firmware artifacts from `release/artifacts/firmware/` +2. `release/artifacts/firmware/PortableAVRControlStudio.ino.hex` +3. `README.md` +4. `docs\customer_handoff.md` +5. `docs\PROTOCOL.md` +6. `docs\product_spec.md` +7. `docs\testing.md` +8. `docs\profiles\arduino_uno_avr.json` The firmware upload tab is a placeholder workflow for prepared `.hex` artifacts. A production package should bundle and test the selected uploader, target MCU flags, COM-port behavior, and profile-specific firmware before presenting upload as a one-click customer feature. @@ -68,4 +74,4 @@ The expected primary HEX output is `release/artifacts/firmware/PortableAVRContro ## Developer customer ZIP checklist -Use `release/checklists/customer_zip_checklist.md` before sending a customer ZIP. It covers software checks, Uno HEX generation, staging contents, and release-claim review. +Use `release/checklists/customer_zip_checklist.md` before sending a customer ZIP. Use `release/templates/maintainer_release_notes.md` to record software checks, Uno compile evidence, EXE build evidence, HEX artifact evidence, ZIP evidence, and explicit physical hardware test status. diff --git a/docs/customer_handoff.md b/docs/customer_handoff.md index c435f47..17c6816 100644 --- a/docs/customer_handoff.md +++ b/docs/customer_handoff.md @@ -7,7 +7,7 @@ This guide explains how a customer can run Portable AVR Control Studio with an A A prepared customer ZIP should contain: - `PortableAVRControlStudio.exe` — Windows desktop app. -- `firmware/PortableAVRControlStudio.ino.hex` — prepared Arduino Uno firmware artifact, if firmware delivery is included. +- `PortableAVRControlStudio.ino.hex` — prepared Arduino Uno firmware artifact, if firmware delivery is included. - `docs/` — protocol, product settings, testing notes, and hardware profile documents. - `docs/profiles/arduino_uno_avr.json` — the default documented wiring/profile for Arduino Uno. @@ -93,7 +93,7 @@ EEPROM persistence still requires validation on the target physical board before ## Firmware artifact and upload boundary -The release package may include `firmware/PortableAVRControlStudio.ino.hex` as a prepared Arduino Uno firmware artifact. This repository documents how to build the artifact, but firmware upload should remain a maintainer/developer workflow unless the customer package also includes a tested uploader, exact command flags, target MCU settings, and COM-port procedure. +The release package may include `PortableAVRControlStudio.ino.hex` at the customer package root as a prepared Arduino Uno firmware artifact. This repository documents how to build the artifact, but firmware upload should remain a maintainer/developer workflow unless the customer package also includes a tested uploader, exact command flags, target MCU settings, and COM-port procedure. ## What still requires physical hardware validation diff --git a/release/BUILD_VERIFICATION.md b/release/BUILD_VERIFICATION.md new file mode 100644 index 0000000..6f01508 --- /dev/null +++ b/release/BUILD_VERIFICATION.md @@ -0,0 +1,157 @@ +# Release Build Verification + +This document records the maintainer workflow for producing and checking the Portable AVR Control Studio release artifacts for the Arduino Uno / ATmega328P AVR target. + +These are software build checks only. They do not prove operation on physical Arduino Uno hardware, relay drivers, buzzer circuitry, sensors, wiring, power supply, or enclosure. + +## Prerequisites + +### Windows EXE build host + +- Windows with PowerShell. +- Python available as `py`. +- Internet access or pre-populated Python package cache for `pyinstaller` and `pyserial`. + +### Arduino Uno HEX build host + +- `arduino-cli` installed and available on `PATH`. +- Internet access or a configured Arduino CLI package cache for the `arduino:avr` core. +- Bash-compatible shell for `release/scripts/build_uno_firmware_hex.sh`. + +## 1. Optional clean start + +Generated build outputs are ignored by git. To start from a clean artifact area, remove generated files while keeping the tracked `.gitkeep` placeholders: + +```bash +find release/artifacts/windows -mindepth 1 ! -name .gitkeep -delete +find release/artifacts/firmware -mindepth 1 ! -name .gitkeep -delete +find release/customer_package -mindepth 1 ! -name .gitkeep -delete +``` + +## 2. Build the Windows EXE artifact + +Run from the repository root on Windows PowerShell: + +```powershell +powershell -ExecutionPolicy Bypass -File .\release\scripts\build_windows_exe.ps1 +``` + +The script installs or updates the Python packaging dependencies it needs, then runs PyInstaller against `gui\portable_avr_control_studio.py`. + +Expected output file: + +```text +release\artifacts\windows\PortableAVRControlStudio.exe +``` + +Verify the EXE exists: + +```powershell +Test-Path .\release\artifacts\windows\PortableAVRControlStudio.exe +Get-Item .\release\artifacts\windows\PortableAVRControlStudio.exe | Select-Object FullName,Length,LastWriteTime +``` + +Record the command output in the maintainer release notes template before publishing any customer handoff package. + +## 3. Build the Arduino Uno HEX artifact + +Run from the repository root in Bash: + +```bash +bash release/scripts/build_uno_firmware_hex.sh +``` + +The script updates the Arduino CLI index, installs the `arduino:avr` core if needed, and compiles the firmware with `--fqbn arduino:avr:uno`. + +Expected primary output file: + +```text +release/artifacts/firmware/PortableAVRControlStudio.ino.hex +``` + +Arduino CLI may also emit related metadata files in `release/artifacts/firmware/`; those generated files are ignored by git. + +Verify the HEX exists: + +```bash +test -f release/artifacts/firmware/PortableAVRControlStudio.ino.hex +ls -lh release/artifacts/firmware/PortableAVRControlStudio.ino.hex +``` + +Record the full compile command and result in the maintainer release notes template. This compile check is not a physical hardware validation. + +## 4. Assemble the customer package staging folder and ZIP + +After both expected artifacts exist, run the assembly script from the repository root: + +```bash +python release/scripts/assemble_customer_package.py +``` + +The script copies the customer handoff files into: + +```text +release/customer_package/PortableAVRControlStudio-customer-handoff/ +``` + +It also creates this generated ZIP by default: + +```text +release/customer_package/PortableAVRControlStudio-customer-handoff.zip +``` + +Expected staged contents: + +```text +release/customer_package/PortableAVRControlStudio-customer-handoff/ + PortableAVRControlStudio.exe + PortableAVRControlStudio.ino.hex + README.md + docs/ + customer_handoff.md + PROTOCOL.md + product_spec.md + testing.md + profiles/ + arduino_uno_avr.json +``` + +Verify the required staged files exist: + +```bash +test -f release/customer_package/PortableAVRControlStudio-customer-handoff/PortableAVRControlStudio.exe +test -f release/customer_package/PortableAVRControlStudio-customer-handoff/PortableAVRControlStudio.ino.hex +test -f release/customer_package/PortableAVRControlStudio-customer-handoff/README.md +test -f release/customer_package/PortableAVRControlStudio-customer-handoff/docs/customer_handoff.md +test -f release/customer_package/PortableAVRControlStudio-customer-handoff/docs/PROTOCOL.md +test -f release/customer_package/PortableAVRControlStudio-customer-handoff/docs/product_spec.md +test -f release/customer_package/PortableAVRControlStudio-customer-handoff/docs/testing.md +test -f release/customer_package/PortableAVRControlStudio-customer-handoff/docs/profiles/arduino_uno_avr.json +test -f release/customer_package/PortableAVRControlStudio-customer-handoff.zip +``` + +For a readable inventory, run: + +```bash +find release/customer_package/PortableAVRControlStudio-customer-handoff -type f | sort +``` + +## 5. Confirm generated artifacts are not staged for git + +Before committing release workflow changes, confirm generated EXE, HEX, and ZIP files are not staged: + +```bash +git status --short --ignored release/artifacts release/customer_package +``` + +Expected behavior: + +- Tracked `.gitkeep` files may appear only if intentionally changed. +- Generated files under `release/artifacts/windows/`, `release/artifacts/firmware/`, and `release/customer_package/` should be ignored. +- Do not commit generated `.exe`, `.hex`, or `.zip` artifacts. + +## 6. Release-claim boundaries + +- Document software checks separately from physical Arduino Uno hardware validation. +- Do not claim physical hardware testing unless a human maintainer provides evidence for the exact board, wiring, power, enclosure, and hardware profile. +- Do not claim one-click production upload unless uploader tooling is bundled, configured, and tested with the final artifact and customer environment. diff --git a/release/README.md b/release/README.md index 25e8714..3b7bf34 100644 --- a/release/README.md +++ b/release/README.md @@ -13,20 +13,22 @@ release/ artifacts/ windows/ # Generated PortableAVRControlStudio.exe (not committed) firmware/ # Generated Arduino Uno .hex files (not committed) - customer_package/ # Staging area for files copied into the customer ZIP + customer_package/ # Generated staging folder and ZIP (not committed) + templates/ + maintainer_release_notes.md # Evidence template for release candidates + BUILD_VERIFICATION.md # Maintainer artifact build and verification steps checklists/ customer_zip_checklist.md # Developer checklist for assembling the ZIP ``` ## Intended customer ZIP contents -A customer ZIP should be assembled from the staging area after the documented checks pass. Recommended contents: +A customer ZIP should be assembled from the staging area after the documented checks pass. The assembly script stages these contents: ```text PortableAVRControlStudio-customer-handoff/ PortableAVRControlStudio.exe - firmware/ - PortableAVRControlStudio.ino.hex + PortableAVRControlStudio.ino.hex docs/ customer_handoff.md PROTOCOL.md @@ -37,6 +39,18 @@ PortableAVRControlStudio-customer-handoff/ README.md ``` +## Build verification and package assembly + +Use `release/BUILD_VERIFICATION.md` for the maintainer build verification workflow. After building the EXE and Uno HEX artifacts, run: + +```bash +python release/scripts/assemble_customer_package.py +``` + +The script stages `release/customer_package/PortableAVRControlStudio-customer-handoff/` and creates `release/customer_package/PortableAVRControlStudio-customer-handoff.zip`. Both generated outputs are ignored by git. + +Record release evidence in `release/templates/maintainer_release_notes.md`. + ## Important release boundaries - The primary firmware artifact is for Arduino Uno / ATmega328P AVR using `arduino:avr:uno`. diff --git a/release/checklists/customer_zip_checklist.md b/release/checklists/customer_zip_checklist.md index 295aa12..00084d9 100644 --- a/release/checklists/customer_zip_checklist.md +++ b/release/checklists/customer_zip_checklist.md @@ -1,6 +1,6 @@ # Developer Checklist: Customer ZIP Package -Use this checklist before preparing a customer handoff ZIP for Portable AVR Control Studio. +Use this checklist before preparing a customer handoff ZIP for Portable AVR Control Studio. Keep software build evidence separate from any physical Arduino Uno hardware validation evidence. ## 1. Confirm source and target @@ -25,6 +25,7 @@ Use this checklist before preparing a customer handoff ZIP for Portable AVR Cont - [ ] Confirm `release\artifacts\windows\PortableAVRControlStudio.exe` exists. - [ ] Open the EXE on a Windows test machine and confirm the GUI launches. This is a software launch check only unless a real board is connected and separately recorded. +- [ ] Record EXE build evidence in `release/templates/maintainer_release_notes.md`. ## 3. Build the Arduino Uno firmware artifact @@ -36,20 +37,27 @@ Use this checklist before preparing a customer handoff ZIP for Portable AVR Cont ``` - [ ] Confirm `release/artifacts/firmware/PortableAVRControlStudio.ino.hex` exists. -- [ ] Record the Arduino CLI version and command output in maintainer notes. +- [ ] Record the Arduino CLI version, AVR core version, command output, and artifact details in `release/templates/maintainer_release_notes.md`. ## 4. Stage the customer ZIP -- [ ] Create or clean `release/customer_package/PortableAVRControlStudio-customer-handoff/`. -- [ ] Copy `PortableAVRControlStudio.exe` into the package root. -- [ ] Copy the Uno HEX artifact into `firmware/` inside the package. -- [ ] Copy these docs into `docs/` inside the package: +- [ ] Assemble the package after the EXE and HEX artifacts exist: + + ```bash + python release/scripts/assemble_customer_package.py + ``` + +- [ ] Confirm `release/customer_package/PortableAVRControlStudio-customer-handoff.zip` exists. +- [ ] Confirm the staged folder contains exactly the required release files: + - [ ] `PortableAVRControlStudio.exe` + - [ ] `PortableAVRControlStudio.ino.hex` + - [ ] `README.md` - [ ] `docs/customer_handoff.md` - [ ] `docs/PROTOCOL.md` - [ ] `docs/product_spec.md` - [ ] `docs/testing.md` - [ ] `docs/profiles/arduino_uno_avr.json` -- [ ] Copy the repository `README.md` into the package root. +- [ ] Record ZIP evidence in `release/templates/maintainer_release_notes.md`. ## 5. Verify customer-facing claims @@ -60,6 +68,6 @@ Use this checklist before preparing a customer handoff ZIP for Portable AVR Cont ## 6. Final package review -- [ ] ZIP the staged folder using a customer-visible version/date naming scheme. - [ ] Open the ZIP and confirm the expected files are present. +- [ ] Confirm generated EXE, HEX, and ZIP artifacts are ignored and not staged for git. - [ ] Keep the GitHub PR as Draft until Python smoke checks and Uno AVR compile checks are documented and reproducible in CI or maintainer notes. diff --git a/release/scripts/assemble_customer_package.py b/release/scripts/assemble_customer_package.py new file mode 100755 index 0000000..6ec99d6 --- /dev/null +++ b/release/scripts/assemble_customer_package.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +"""Assemble the generated customer handoff staging folder and ZIP. + +This script copies already-built release artifacts and documentation into +release/customer_package/PortableAVRControlStudio-customer-handoff/ and creates +release/customer_package/PortableAVRControlStudio-customer-handoff.zip. +""" + +from __future__ import annotations + +import argparse +import shutil +import sys +from pathlib import Path + +PACKAGE_NAME = "PortableAVRControlStudio-customer-handoff" + +REQUIRED_COPIES = ( + (Path("release/artifacts/windows/PortableAVRControlStudio.exe"), Path("PortableAVRControlStudio.exe")), + (Path("release/artifacts/firmware/PortableAVRControlStudio.ino.hex"), Path("PortableAVRControlStudio.ino.hex")), + (Path("README.md"), Path("README.md")), + (Path("docs/customer_handoff.md"), Path("docs/customer_handoff.md")), + (Path("docs/PROTOCOL.md"), Path("docs/PROTOCOL.md")), + (Path("docs/product_spec.md"), Path("docs/product_spec.md")), + (Path("docs/testing.md"), Path("docs/testing.md")), + (Path("docs/profiles/arduino_uno_avr.json"), Path("docs/profiles/arduino_uno_avr.json")), +) + + +def parse_args() -> argparse.Namespace: + parser = argparse.ArgumentParser( + description="Assemble the Portable AVR Control Studio customer handoff package." + ) + parser.add_argument( + "--no-zip", + action="store_true", + help="Only stage the package folder; do not create the ZIP archive.", + ) + return parser.parse_args() + + +def copy_required_files(repo_root: Path, package_dir: Path) -> None: + missing_sources = [str(src) for src, _ in REQUIRED_COPIES if not (repo_root / src).is_file()] + if missing_sources: + missing_list = "\n".join(f" - {path}" for path in missing_sources) + raise FileNotFoundError( + "Required release inputs are missing. Build the EXE and HEX artifacts first.\n" + f"Missing files:\n{missing_list}" + ) + + if package_dir.exists(): + shutil.rmtree(package_dir) + package_dir.mkdir(parents=True) + + for src, dest in REQUIRED_COPIES: + dest_path = package_dir / dest + dest_path.parent.mkdir(parents=True, exist_ok=True) + shutil.copy2(repo_root / src, dest_path) + + +def create_zip(package_dir: Path) -> Path: + zip_base = package_dir.parent / PACKAGE_NAME + zip_path = zip_base.with_suffix(".zip") + if zip_path.exists(): + zip_path.unlink() + shutil.make_archive(str(zip_base), "zip", root_dir=package_dir.parent, base_dir=PACKAGE_NAME) + return zip_path + + +def print_inventory(package_dir: Path) -> None: + print(f"Staged customer package: {package_dir}") + for path in sorted(package_dir.rglob("*")): + if path.is_file(): + print(f" {path.relative_to(package_dir)}") + + +def main() -> int: + args = parse_args() + repo_root = Path(__file__).resolve().parents[2] + package_root = repo_root / "release" / "customer_package" + package_dir = package_root / PACKAGE_NAME + + try: + copy_required_files(repo_root, package_dir) + print_inventory(package_dir) + if not args.no_zip: + zip_path = create_zip(package_dir) + print(f"Created ZIP: {zip_path}") + except FileNotFoundError as exc: + print(exc, file=sys.stderr) + return 1 + + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/release/templates/maintainer_release_notes.md b/release/templates/maintainer_release_notes.md new file mode 100644 index 0000000..c605ba7 --- /dev/null +++ b/release/templates/maintainer_release_notes.md @@ -0,0 +1,105 @@ +# Maintainer Release Notes Template + +Release candidate/tag: +Maintainer: +Date: +Source commit: + +## Artifact summary + +- Windows EXE artifact: `release/artifacts/windows/PortableAVRControlStudio.exe` +- Arduino Uno HEX artifact: `release/artifacts/firmware/PortableAVRControlStudio.ino.hex` +- Customer package staging folder: `release/customer_package/PortableAVRControlStudio-customer-handoff/` +- Customer package ZIP: `release/customer_package/PortableAVRControlStudio-customer-handoff.zip` + +## Software checks performed + +Record software-only checks here. Include commands, host OS, tool versions, and pass/fail status. + +| Check | Command | Host/tool versions | Result | Evidence location or notes | +| --- | --- | --- | --- | --- | +| Python syntax check | `python -m py_compile gui/portable_avr_control_studio.py` | | | | +| Parser smoke check | Paste command from `docs/testing.md` | | | | +| Git ignored-artifact check | `git status --short --ignored release/artifacts release/customer_package` | | | | + +## Arduino Uno compile evidence + +This section is for Arduino Uno / ATmega328P AVR software compile evidence only. It is not physical board validation. + +| Item | Value | +| --- | --- | +| Command | `bash release/scripts/build_uno_firmware_hex.sh` | +| FQBN | `arduino:avr:uno` | +| Arduino CLI version | | +| AVR core version | | +| Build host OS | | +| Result | | +| Log or CI link | | + +## EXE build evidence + +| Item | Value | +| --- | --- | +| Command | `powershell -ExecutionPolicy Bypass -File .\release\scripts\build_windows_exe.ps1` | +| Python version | | +| PyInstaller version | | +| pyserial version | | +| Build host OS | | +| Result | | +| Log or CI link | | + +## HEX artifact evidence + +| Item | Value | +| --- | --- | +| Expected file | `release/artifacts/firmware/PortableAVRControlStudio.ino.hex` | +| Exists check command | `test -f release/artifacts/firmware/PortableAVRControlStudio.ino.hex` | +| File size | | +| SHA-256 checksum | | +| Notes | | + +## EXE artifact evidence + +| Item | Value | +| --- | --- | +| Expected file | `release/artifacts/windows/PortableAVRControlStudio.exe` | +| Exists check command | `Test-Path .\release\artifacts\windows\PortableAVRControlStudio.exe` | +| File size | | +| SHA-256 checksum | | +| Notes | | + +## Customer ZIP evidence + +| Item | Value | +| --- | --- | +| Assembly command | `python release/scripts/assemble_customer_package.py` | +| Expected ZIP | `release/customer_package/PortableAVRControlStudio-customer-handoff.zip` | +| Required contents verified | | +| ZIP file size | | +| ZIP SHA-256 checksum | | +| Notes | | + +## Explicit physical hardware test status + +Choose one and attach evidence if applicable: + +- [ ] Not performed. No physical Arduino Uno hardware validation is claimed for this release candidate. +- [ ] Performed by a human maintainer. Evidence is attached for the exact Arduino Uno / ATmega328P AVR board, wiring, drivers, sensors, power supply, enclosure, firmware artifact, and hardware profile. + +Physical test evidence summary: + +- Tester: +- Date: +- Board and MCU: +- Hardware profile: +- Firmware artifact checksum: +- Wiring/load notes: +- Result: +- Evidence link or attachment: + +## Release-claim review + +- [ ] Customer-facing notes distinguish software build checks from physical hardware validation. +- [ ] No claim of physical hardware testing is made unless evidence is attached above. +- [ ] No one-click production upload claim is made unless uploader tooling is bundled and tested. +- [ ] Generated EXE, HEX, and ZIP artifacts are not committed to git.