Skip to content
This repository was archived by the owner on Aug 3, 2026. It is now read-only.

Commit 462d25c

Browse files
committed
first commit
0 parents  commit 462d25c

24 files changed

Lines changed: 2306 additions & 0 deletions
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Smartphone (please complete the following information):**
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser [e.g. stock browser, safari]
35+
- Version [e.g. 22]
36+
37+
**Additional context**
38+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/pull_request_template.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
## Summary
2+
3+
- Briefly describe the change and its motivation.
4+
- Link related issues (e.g., closes #123).
5+
6+
## Type of Change
7+
8+
- [ ] Bug fix (non-breaking change that fixes an issue)
9+
- [ ] New feature (non-breaking change that adds functionality)
10+
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
11+
- [ ] Refactor (code change that neither fixes a bug nor adds a feature)
12+
- [ ] Documentation update
13+
- [ ] Build/CI
14+
15+
## Details
16+
17+
- What does this PR change? Why?
18+
- Any context for reviewers to understand decisions and tradeoffs.
19+
20+
## Testing
21+
22+
- [ ] Builds locally
23+
- [ ] Unit tests added/updated
24+
- [ ] Tested on target hardware/device (if applicable)
25+
26+
Describe how you tested the changes. Include commands, logs, or screenshots if helpful.
27+
28+
## Compatibility / Breaking Changes
29+
30+
- Describe any API, ABI, or behavior changes.
31+
- Migration steps for users (if any).
32+
33+
## Risks and Mitigations
34+
35+
- Potential risks introduced by this change and how they’re mitigated.
36+
37+
## Checklist
38+
39+
- [ ] Code follows project style and conventions
40+
- [ ] All tests pass locally
41+
- [ ] Documentation updated (README, examples, comments)
42+
- [ ] No secrets, credentials, or sensitive data committed
43+
- [ ] Linked issue(s) and relevant context provided
44+
45+
## Environment
46+
47+
- Toolchain/SDK versions: (e.g., ESP-IDF/PlatformIO/GCC)
48+
- OS and version:
49+
- Other relevant environment details:
50+

.github/workflows/ci.yml

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
tags: ['v*']
7+
pull_request:
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ci-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
lint-metadata:
16+
name: Arduino Lint
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Arduino Lint
23+
uses: arduino/arduino-lint-action@v1
24+
with:
25+
library-manager: false
26+
project-type: library
27+
28+
build-examples:
29+
runs-on: ubuntu-latest
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
board: [esp32dev, esp32-s3-devkitc-1, esp32-c3-devkitm-1, esp32-p4-evboard]
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
38+
- name: Set up Python
39+
uses: actions/setup-python@v5
40+
with:
41+
python-version: '3.13'
42+
43+
- name: Cache PlatformIO
44+
uses: actions/cache@v4
45+
with:
46+
path: ~/.platformio
47+
key: ${{ runner.os }}-platformio-${{ hashFiles('**/library.json') }}
48+
restore-keys: |
49+
${{ runner.os }}-platformio-
50+
51+
- name: Install PIOArduino Core
52+
run: python -m pip install --upgrade https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.18.zip
53+
54+
- name: Install PIOArduino ESP32 Platform
55+
run: pio platform install https://github.com/pioarduino/platform-espressif32.git
56+
57+
- name: Build library examples (ESP32 Arduino)
58+
run: |
59+
set -e
60+
for d in examples/*; do
61+
if [ -d "$d" ]; then
62+
echo "Building $d on ${{ matrix.board }} via PlatformIO CI"
63+
pio ci "$d" \
64+
--board ${{ matrix.board }} \
65+
--lib="." \
66+
--project-option "platform=https://github.com/pioarduino/platform-espressif32.git" \
67+
--project-option "build_unflags=-std=gnu++11" \
68+
--project-option "build_flags=-std=gnu++20" \
69+
--project-option "lib_deps=ArduinoJson@>=7.0.0, https://github.com/ESPToolKit/esp-worker.git, https://github.com/ESPToolKit/esp-eventbus.git"
70+
fi
71+
done
72+
73+
arduino-cli:
74+
runs-on: ubuntu-latest
75+
needs: build-examples
76+
env:
77+
ESP32_CORE_VERSION: 3.3.3
78+
ESP32_PACKAGE_URL: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
79+
ARDUINO_BOARDS: |
80+
esp32:esp32:esp32 esp32dev
81+
esp32:esp32:esp32s3 esp32-s3-devkitc-1
82+
esp32:esp32:esp32c3 esp32-c3-devkitm-1
83+
esp32:esp32:esp32p4 esp32-p4-evboard
84+
steps:
85+
- name: Checkout
86+
uses: actions/checkout@v4
87+
88+
- name: Set up Arduino CLI
89+
uses: arduino/setup-arduino-cli@v1
90+
91+
- name: Prepare Arduino directories
92+
run: |
93+
mkdir -p "${HOME}/.arduino15"
94+
mkdir -p "${HOME}/Arduino/libraries"
95+
96+
- name: Cache Arduino dependencies
97+
uses: actions/cache@v4
98+
with:
99+
path: |
100+
~/.arduino15
101+
~/Arduino/libraries
102+
key: ${{ runner.os }}-arduino-esp32-${{ env.ESP32_CORE_VERSION }}-${{ hashFiles('library.properties') }}
103+
restore-keys: |
104+
${{ runner.os }}-arduino-esp32-${{ env.ESP32_CORE_VERSION }}-
105+
${{ runner.os }}-arduino-esp32-
106+
107+
- name: Configure board manager for ESP32
108+
run: |
109+
set -e
110+
arduino-cli config init --overwrite
111+
arduino-cli config set library.enable_unsafe_install true
112+
arduino-cli config add board_manager.additional_urls "${ESP32_PACKAGE_URL}"
113+
arduino-cli config dump
114+
115+
- name: Install ESP32 core
116+
run: |
117+
arduino-cli core update-index --additional-urls "${ESP32_PACKAGE_URL}"
118+
arduino-cli core install esp32:esp32@${ESP32_CORE_VERSION} --additional-urls "${ESP32_PACKAGE_URL}"
119+
120+
- name: Install libraries
121+
run: |
122+
arduino-cli lib update-index
123+
arduino-cli lib install "ArduinoJson"
124+
arduino-cli lib install --git-url "https://github.com/ESPToolKit/esp-worker.git"
125+
arduino-cli lib install --git-url "https://github.com/ESPToolKit/esp-eventbus.git"
126+
127+
- name: Add local library to sketchbook
128+
run: |
129+
set -e
130+
SKETCHBOOK_DIR="${HOME}/Arduino"
131+
mkdir -p "$SKETCHBOOK_DIR/libraries/ESPLifecycle"
132+
rsync -a --delete --exclude ".git" ./ "$SKETCHBOOK_DIR/libraries/ESPLifecycle/"
133+
134+
- name: Build examples
135+
env:
136+
BOARDS: ${{ env.ARDUINO_BOARDS }}
137+
run: |
138+
set -euo pipefail
139+
while read -r fqbn board_name; do
140+
if [ -z "$fqbn" ]; then
141+
continue
142+
fi
143+
echo "::group::Compiling examples for ${board_name} (${fqbn})"
144+
for d in examples/*; do
145+
if [ -d "$d" ]; then
146+
echo "Compiling $d"
147+
arduino-cli compile --fqbn "$fqbn" "$d"
148+
fi
149+
done
150+
echo "::endgroup::"
151+
done <<< "$BOARDS"
152+
153+
package-library:
154+
runs-on: ubuntu-latest
155+
needs:
156+
- build-examples
157+
- arduino-cli
158+
steps:
159+
- name: Checkout
160+
uses: actions/checkout@v4
161+
162+
- name: Set up Python
163+
uses: actions/setup-python@v5
164+
with:
165+
python-version: '3.13'
166+
167+
- name: Install PIOArduino Core
168+
run: python -m pip install --upgrade https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.18.zip
169+
170+
- name: Pack library (PlatformIO)
171+
run: |
172+
mkdir -p dist
173+
pio pkg pack --output dist
174+
175+
- name: Upload package artifact
176+
uses: actions/upload-artifact@v4
177+
with:
178+
name: esplifecycle-${{ github.sha }}
179+
path: dist/*

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
create-release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Extract changelog entry
18+
id: changelog
19+
uses: actions/github-script@v7
20+
with:
21+
result-encoding: string
22+
script: |
23+
const tag = process.env.GITHUB_REF_NAME || '';
24+
const version = tag.startsWith('v') ? tag.slice(1) : tag;
25+
const fs = require('node:fs');
26+
const changelog = fs.readFileSync('CHANGELOG.md', 'utf8');
27+
const heading = `## [${version}]`;
28+
const start = changelog.indexOf(heading);
29+
let entry;
30+
if (start === -1) {
31+
entry = `No changelog entry found for version ${version}.`;
32+
} else {
33+
const afterHeading = start + heading.length;
34+
const nextHeader = changelog.indexOf('\n## [', afterHeading);
35+
const sliceEnd = nextHeader === -1 ? changelog.length : nextHeader;
36+
entry = changelog.slice(start, sliceEnd).trim();
37+
}
38+
return entry;
39+
40+
- name: Create GitHub Release
41+
uses: softprops/action-gh-release@v2
42+
with:
43+
draft: false
44+
prerelease: false
45+
generate_release_notes: false
46+
body: ${{ steps.changelog.outputs.result }}
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.venv
2+
build/
3+
build_prev_runner/
4+
.vscode

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [Unreleased]
6+
7+
### Added
8+
- Standalone `ESPLifecycle` library scaffold with ESPToolKit metadata and workflows.
9+
- Fluent lifecycle registration API with section and node builders.
10+
- Deterministic `build()`, `initialize()`, `deinitialize()`, and scoped `reinitialize()` runtime paths.
11+
- Optional deferred sections with readiness and wait callbacks.
12+
- Snapshot/status callback plumbing for host observability.
13+
- Optional reload listener integration via `ESPEventBus` + `ESPWorker` with 25ms coalescing.
14+
- Basic and scoped-reload Arduino examples.
15+
16+
## [0.1.0] - 2026-03-05
17+
### Added
18+
- Initial stable release of ESPLifecycle.

CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# ESPLifecycle - https://github.com/ESPToolKit/esp-lifecycle
2+
# Copyright zekageri 2026
3+
# MIT License
4+
5+
cmake_minimum_required(VERSION 3.12)
6+
project(ESPLifecycle)
7+
8+
enable_testing()
9+
10+
set(CMAKE_CXX_STANDARD 20)
11+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
12+
13+
if(${COVERAGE})
14+
set(CMAKE_CXX_FLAGS "-fprofile-arcs -ftest-coverage -g -O0")
15+
endif()
16+
17+
include_directories(${CMAKE_CURRENT_LIST_DIR}/src)
18+
add_subdirectory(test)

0 commit comments

Comments
 (0)