Skip to content

Commit 1265ec7

Browse files
committed
first commit
0 parents  commit 1265ec7

33 files changed

Lines changed: 3428 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: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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:

.github/workflows/ci.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master, 'feature/**' ]
6+
tags: ['v*']
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
build-examples:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
board: [esp32dev, esp32-s3-devkitc-1, esp32-c3-devkitm-1, esp32-p4-evboard]
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.13'
25+
26+
- name: Cache PlatformIO
27+
uses: actions/cache@v4
28+
with:
29+
path: ~/.platformio
30+
key: ${{ runner.os }}-platformio-${{ hashFiles('**/library.json') }}
31+
restore-keys: |
32+
${{ runner.os }}-platformio-
33+
34+
- name: Install PIOArduino Core
35+
run: python -m pip install --upgrade https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.18.zip
36+
37+
- name: Install PIOArduino ESP32 Platform
38+
run: pio platform install https://github.com/pioarduino/platform-espressif32.git
39+
40+
- name: Build library examples (ESP32 Arduino)
41+
run: |
42+
set -e
43+
for d in examples/*; do
44+
if [ -d "$d" ]; then
45+
echo "Building $d on ${{ matrix.board }} via PlatformIO CI"
46+
pio ci "$d" \
47+
--board ${{ matrix.board }} \
48+
--lib="." \
49+
--project-option "platform=https://github.com/pioarduino/platform-espressif32.git" \
50+
--project-option "build_unflags=-std=gnu++11" \
51+
--project-option "build_flags=-std=gnu++17" \
52+
--project-option "lib_deps=ArduinoJson@>=7.0.0"
53+
fi
54+
done
55+
56+
arduino-cli:
57+
runs-on: ubuntu-latest
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
board:
62+
- fqbn: esp32:esp32:esp32
63+
name: esp32dev
64+
- fqbn: esp32:esp32:esp32s3
65+
name: esp32-s3-devkitc-1
66+
- fqbn: esp32:esp32:esp32c3
67+
name: esp32-c3-devkitm-1
68+
- fqbn: esp32:esp32:esp32p4
69+
name: esp32-p4-evboard
70+
steps:
71+
- name: Checkout
72+
uses: actions/checkout@v4
73+
74+
- name: Set up Arduino CLI
75+
uses: arduino/setup-arduino-cli@v1
76+
77+
- name: Install ESP32 core
78+
run: |
79+
arduino-cli core update-index
80+
arduino-cli core install esp32:esp32
81+
82+
- name: Install libraries
83+
run: |
84+
arduino-cli lib update-index
85+
arduino-cli lib install "ArduinoJson"
86+
if [ ! -d "${HOME}/Arduino/libraries/ESPBufferManager" ]; then
87+
arduino-cli lib install --git-url https://github.com/ESPToolKit/esp-buffer-manager.git || \
88+
git clone --depth 1 https://github.com/ESPToolKit/esp-buffer-manager.git "${HOME}/Arduino/libraries/ESPBufferManager"
89+
fi
90+
91+
- name: Add local library to sketchbook
92+
run: |
93+
set -e
94+
SKETCHBOOK_DIR="${HOME}/Arduino"
95+
mkdir -p "$SKETCHBOOK_DIR/libraries/ESPCompressor"
96+
rsync -a --delete --exclude ".git" ./ "$SKETCHBOOK_DIR/libraries/ESPCompressor/"
97+
98+
- name: Build examples (${{ matrix.board.name }})
99+
env:
100+
FQBN: ${{ matrix.board.fqbn }}
101+
run: |
102+
set -e
103+
for d in examples/*; do
104+
if [ -d "$d" ]; then
105+
echo "Compiling $d"
106+
arduino-cli compile --fqbn "$FQBN" "$d"
107+
fi
108+
done
109+
110+
host-tests:
111+
runs-on: ubuntu-latest
112+
steps:
113+
- name: Checkout
114+
uses: actions/checkout@v4
115+
116+
- name: Configure CMake
117+
run: cmake -S . -B build
118+
119+
- name: Build tests
120+
run: cmake --build build
121+
122+
- name: Run tests
123+
run: ctest --test-dir build --output-on-failure

.github/workflows/release.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
create-release:
10+
runs-on: ubuntu-latest
11+
concurrency:
12+
group: release-${{ github.ref }}
13+
cancel-in-progress: false
14+
permissions:
15+
actions: read
16+
contents: write
17+
steps:
18+
- name: Wait for CI workflow success
19+
uses: actions/github-script@v7
20+
with:
21+
script: |
22+
const owner = context.repo.owner;
23+
const repo = context.repo.repo;
24+
const targetSha = context.sha;
25+
const targetRef = context.ref;
26+
const targetTag = targetRef.replace('refs/tags/', '');
27+
const workflowId = 'ci.yml';
28+
const pollMs = 20000;
29+
const timeoutMs = 45 * 60 * 1000;
30+
const startedAt = Date.now();
31+
const failingConclusions = new Set(['failure', 'cancelled', 'timed_out', 'action_required']);
32+
33+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
34+
35+
while (true) {
36+
const { data } = await github.rest.actions.listWorkflowRuns({
37+
owner,
38+
repo,
39+
workflow_id: workflowId,
40+
event: 'push',
41+
head_sha: targetSha,
42+
per_page: 100,
43+
});
44+
45+
const matchingRuns = data.workflow_runs
46+
.filter((run) => run.ref === targetRef)
47+
.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());
48+
49+
if (matchingRuns.length > 0) {
50+
const run = matchingRuns[0];
51+
if (run.status === 'completed') {
52+
if (run.conclusion === 'success') {
53+
return;
54+
}
55+
if (failingConclusions.has(run.conclusion)) {
56+
core.setFailed(`CI did not succeed for ${targetTag}. Conclusion: ${run.conclusion}.`);
57+
return;
58+
}
59+
core.setFailed(`CI completed without success for ${targetTag}. Conclusion: ${run.conclusion ?? 'unknown'}.`);
60+
return;
61+
}
62+
}
63+
64+
if (Date.now() - startedAt >= timeoutMs) {
65+
core.setFailed(`Timed out after ${timeoutMs / 60000} minutes waiting for successful CI on ${targetTag}.`);
66+
return;
67+
}
68+
69+
await sleep(pollMs);
70+
}
71+
72+
- name: Checkout
73+
uses: actions/checkout@v4
74+
75+
- name: Extract changelog entry
76+
id: changelog
77+
uses: actions/github-script@v7
78+
with:
79+
result-encoding: string
80+
script: |
81+
const tag = process.env.GITHUB_REF_NAME || '';
82+
const version = tag.startsWith('v') ? tag.slice(1) : tag;
83+
const fs = require('node:fs');
84+
const changelog = fs.readFileSync('CHANGELOG.md', 'utf8');
85+
const heading = `## [${version}]`;
86+
const start = changelog.indexOf(heading);
87+
let entry;
88+
if (start === -1) {
89+
entry = `No changelog entry found for version ${version}.`;
90+
} else {
91+
const afterHeading = start + heading.length;
92+
const nextHeader = changelog.indexOf('\n## [', afterHeading);
93+
const sliceEnd = nextHeader === -1 ? changelog.length : nextHeader;
94+
entry = changelog.slice(start, sliceEnd).trim();
95+
}
96+
return entry;
97+
98+
- name: Create GitHub Release
99+
uses: softprops/action-gh-release@v2
100+
with:
101+
draft: false
102+
prerelease: false
103+
generate_release_notes: false
104+
body: ${{ steps.changelog.outputs.result }}
105+
env:
106+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [1.0.0] - 2026-04-01
6+
7+
### Added
8+
- Initial `ESPCompressor` v1 release with synchronous and asynchronous compression/decompression APIs.
9+
- Stable `.esc` container with block metadata, CRC32 checks, and raw-block fallback.
10+
- Built-in buffer, file, stream, and print adapters with transactional sink behavior.
11+
- ESPBufferManager-backed staging buffers for PSRAM-aware operation.
12+
- Host test suite, Arduino examples, CI workflow, and release workflow.

CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# ESPCompressor - https://github.com/ESPToolKit/esp-compressor
2+
# Copyright ESPToolKit
3+
# MIT License
4+
5+
cmake_minimum_required(VERSION 3.12)
6+
project(ESPCompressor)
7+
8+
include(CTest)
9+
10+
set(CMAKE_CXX_STANDARD 17)
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+
19+
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/test/CMakeLists.txt")
20+
add_subdirectory(test)
21+
endif()

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 ESPToolKit
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)