Skip to content

Commit 98dcf55

Browse files
committed
Optimize ESP-IDF image and standardize workflows
Code changes: - Streamline ESP-IDF Dockerfile by removing duplicate tools from base image - Remove unnecessary packages (rsync, sphinx, pylint, flake8, black) - Rename workflow jobs to image-first naming pattern (esp-idf-build, esp-idf-manifest, platformio-build, platformio-manifest) - Add fork prevention checks (github.repository_owner) to all workflows - Rename ESP-Matter variable from idf_base_tag to jethome_idf_base_tag for clarity - Temporarily disable ESP-Matter jobs with if: false Documentation: - Make all READMEs version-agnostic to support build matrix - Update documentation standards to avoid hardcoded version numbers - Add job naming convention guidelines to GitHub Actions standards - Update adding-new-images guide with version handling rules
1 parent da4dc3b commit 98dcf55

File tree

8 files changed

+221
-212
lines changed

8 files changed

+221
-212
lines changed

.cursor/rules/adding-new-images.mdc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ Create new directory: `images/<image-name>/` containing:
3030

3131
Image README must include:
3232
- Overview and description
33-
- What's Inside (specific versions)
33+
- What's Inside (capabilities and tools, not specific versions)
3434
- Quick Start (pull, build, run)
3535
- Usage Examples
3636
- CI/CD Integration examples
3737
- Environment Variables
3838
- Building the Image
3939

40-
- Version Information table
40+
**Important:** Do not hardcode specific version numbers in READMEs. Focus on capabilities and tools. See [Documentation Standards](documentation-standards.mdc) for version handling guidelines.
4141

4242
## Update Root README
4343

.cursor/rules/documentation-standards.mdc

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@ Must be:
3030

3131
Required sections:
3232
1. Overview
33-
2. What's Inside (specific versions)
33+
2. What's Inside (capabilities and tools)
3434
3. Quick Start
3535
4. Usage Examples (Docker commands, CI/CD integration)
3636
5. Environment Variables
3737
6. Building the Image
38-
7. Version Information table
3938

4039
Sections to AVOID:
4140
- Framework tutorials (create project, configure, etc.)
@@ -44,10 +43,42 @@ Sections to AVOID:
4443
- Feature explanations (framework features, not image features)
4544
- Troubleshooting (users can refer to upstream documentation)
4645
- Design Decisions (keep documentation focused on usage)
46+
- Version Information tables (versions change frequently)
47+
48+
## Version Handling
49+
50+
**DO NOT** hardcode specific version numbers in README files:
51+
52+
❌ **Avoid:**
53+
- "ESP-IDF 5.4.1 Development Image"
54+
- "Python 3.12.3"
55+
- "pytest 8.4.2"
56+
- "Ubuntu 24.04 LTS (Noble)"
57+
- Version information tables with specific versions
58+
59+
✅ **Instead use:**
60+
- "ESP-IDF Development Image" (generic)
61+
- "Python" (no version)
62+
- "pytest" (no version)
63+
- "Ubuntu LTS" (generic)
64+
- Describe capabilities, not versions
65+
66+
**Why:**
67+
- Versions update automatically via dependencies
68+
- Build matrix may build multiple versions
69+
- Documentation stays accurate longer
70+
- Reduces maintenance burden
71+
- Focus on what the image provides, not exact versions
72+
73+
**Exceptions:**
74+
- Dockerfile ARG default values (needed for builds)
75+
- Build argument examples (use placeholders like `<version-tag>`)
76+
- When referencing base image tag in examples
4777

4878
## Accuracy Rules
4979

5080
- Only document what's actually in the Dockerfile
5181
- Clearly state what downloads at runtime vs pre-installed
52-
- Include actual version numbers
82+
- Focus on capabilities and tools, not specific versions
5383
- Never claim features that aren't implemented
84+
- Keep documentation flexible and version-agnostic

.cursor/rules/github-actions-standards.mdc

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,35 @@ Each image should have its own workflow file:
3838
- Images are **only pushed to GHCR from master branch**
3939
- Dev and PR branches build only (no push)
4040

41+
### Job Naming Convention
42+
43+
**Use image-first naming pattern:**
44+
- Format: `<image-name>-<action>`
45+
- Examples: `esp-idf-build`, `esp-idf-manifest`, `platformio-build`, `platformio-manifest`
46+
47+
**Benefits:**
48+
- Jobs for the same image group together alphabetically in GitHub UI
49+
- Clear ownership - immediately see which image each job belongs to
50+
- Scalable - easy to add more images without conflicts
51+
- Consistent across all workflows
52+
53+
**Example workflow structure:**
54+
```yaml
55+
jobs:
56+
esp-idf-build: # Builds ESP-IDF images
57+
esp-idf-manifest: # Creates ESP-IDF manifest
58+
platformio-build: # Builds PlatformIO images
59+
platformio-manifest: # Creates PlatformIO manifest
60+
```
61+
62+
When sorted alphabetically in GitHub UI:
63+
```
64+
✓ esp-idf-build
65+
✓ esp-idf-manifest ← Grouped together
66+
✓ platformio-build
67+
✓ platformio-manifest ← Grouped together
68+
```
69+
4170
### Workflow Structure
4271

4372
Standard pattern for image workflows with matrix builds:
@@ -63,8 +92,9 @@ env:
6392
IMAGE_NAME: jethome-dev-<image-name>
6493

6594
jobs:
66-
build:
95+
<image-name>-build:
6796
runs-on: ubuntu-latest
97+
if: github.repository_owner == 'jethome-iot'
6898
permissions:
6999
contents: read
70100
packages: write
@@ -107,10 +137,10 @@ jobs:
107137
build-args: |
108138
VERSION=${{ matrix.version }}
109139

110-
create-manifest:
140+
<image-name>-manifest:
111141
runs-on: ubuntu-latest
112-
needs: build
113-
if: github.ref_name == 'master'
142+
needs: <image-name>-build
143+
if: github.repository_owner == 'jethome-iot' && github.ref_name == 'master'
114144
permissions:
115145
contents: read
116146
packages: write
@@ -145,12 +175,39 @@ jobs:
145175
```
146176

147177
**Critical Details:**
178+
- **Job naming**: Use `<image-name>-build` and `<image-name>-manifest` pattern (e.g., `esp-idf-build`, `esp-idf-manifest`)
179+
- **Benefits of image-first naming**: Jobs for same image group together in GitHub UI when sorted alphabetically
148180
- Matrix builds both platforms in parallel for faster CI
149181
- Platform-specific images tagged with arch suffix (e.g., `pio-6.1.18-linux-amd64`)
150182
- Manifest job combines platform images into multi-arch manifest
151183
- Only master branch pushes images; dev/PR do build-only validation
152184
- Version matrix can be expanded to build multiple versions
153185
- Simple `workflow_dispatch` trigger allows manual runs from GitHub UI (no parameters)
186+
- **Fork prevention**: `if: github.repository_owner == 'jethome-iot'` prevents builds in forks
187+
188+
### Fork Prevention
189+
190+
**Always add organization check to prevent unnecessary builds in forks:**
191+
192+
```yaml
193+
jobs:
194+
<image-name>-build:
195+
runs-on: ubuntu-latest
196+
if: github.repository_owner == 'jethome-iot' # Prevents builds in forks
197+
permissions:
198+
contents: read
199+
packages: write
200+
```
201+
202+
**Why this is important:**
203+
- ✅ **Saves Actions minutes** - Forks won't waste time building Docker images they don't need
204+
- ✅ **Clearer intent** - Only the main repository publishes images
205+
- ✅ **Still testable** - Forks can remove this line if they want to test
206+
- ✅ **Common practice** - Standard pattern for OSS projects with Docker registries
207+
208+
**Apply to all jobs:**
209+
- Build jobs (`<image-name>-build`): `if: github.repository_owner == 'jethome-iot'`
210+
- Manifest jobs (`<image-name>-manifest`): `if: github.repository_owner == 'jethome-iot' && github.ref_name == 'master'`
154211

155212
### Version Handling
156213

.github/workflows/esp-idf.yml

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,16 @@ env:
2020
IMAGE_NAME: jethome-dev-esp-idf
2121

2222
jobs:
23-
build-esp-idf:
23+
esp-idf-build:
2424
runs-on: ubuntu-latest
25+
if: github.repository_owner == 'jethome-iot'
2526
permissions:
2627
contents: read
2728
packages: write
2829
strategy:
2930
matrix:
3031
platform: [linux/amd64, linux/arm64]
31-
esp_idf_version: ['v5.4.1']
32+
idf_base_tag: ['v5.4.1']
3233
steps:
3334
- name: 📥 Checkout repository
3435
uses: actions/checkout@v4
@@ -58,22 +59,22 @@ jobs:
5859
platforms: ${{ matrix.platform }}
5960
push: ${{ github.ref_name == 'master' }}
6061
tags: |
61-
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:idf-${{ matrix.esp_idf_version }}-${{ steps.platform.outputs.tag }}
62+
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:idf-${{ matrix.idf_base_tag }}-${{ steps.platform.outputs.tag }}
6263
cache-from: type=gha,scope=${{ env.IMAGE_NAME }}-${{ steps.platform.outputs.tag }}
6364
cache-to: type=gha,mode=max,scope=${{ env.IMAGE_NAME }}-${{ steps.platform.outputs.tag }}
6465
build-args: |
65-
ESP_IDF_VERSION=${{ matrix.esp_idf_version }}
66+
IDF_BASE_TAG=${{ matrix.idf_base_tag }}
6667
67-
create-manifest:
68+
esp-idf-manifest:
6869
runs-on: ubuntu-latest
69-
needs: build-esp-idf
70-
if: github.ref_name == 'master'
70+
needs: esp-idf-build
71+
if: github.repository_owner == 'jethome-iot' && github.ref_name == 'master'
7172
permissions:
7273
contents: read
7374
packages: write
7475
strategy:
7576
matrix:
76-
esp_idf_version: ['v5.4.1']
77+
idf_base_tag: ['v5.4.1']
7778
steps:
7879
- name: 🔐 Log in to GitHub Container Registry
7980
uses: docker/login-action@v3
@@ -94,22 +95,23 @@ jobs:
9495
run: |
9596
docker buildx imagetools create -t ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest \
9697
-t ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:stable \
97-
-t ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:idf-${{ matrix.esp_idf_version }} \
98+
-t ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:idf-${{ matrix.idf_base_tag }} \
9899
-t ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.date_tag }} \
99100
-t ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:sha-${{ steps.tags.outputs.sha_short }} \
100-
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:idf-${{ matrix.esp_idf_version }}-linux-amd64 \
101-
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:idf-${{ matrix.esp_idf_version }}-linux-arm64
101+
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:idf-${{ matrix.idf_base_tag }}-linux-amd64 \
102+
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:idf-${{ matrix.idf_base_tag }}-linux-arm64
102103
103-
build-esp-matter:
104+
esp-matter-build:
104105
runs-on: ubuntu-latest
105-
needs: build-esp-idf
106+
needs: esp-idf-build
107+
if: false && github.repository_owner == 'jethome-iot' # Temporarily disabled
106108
permissions:
107109
contents: read
108110
packages: write
109111
strategy:
110112
matrix:
111113
platform: [linux/amd64, linux/arm64]
112-
esp_idf_version: ['v5.4.1']
114+
jethome_idf_base_tag: ['v5.4.1']
113115
esp_matter_version: ['v1.4.2']
114116
steps:
115117
- name: 📥 Checkout repository
@@ -140,23 +142,23 @@ jobs:
140142
platforms: ${{ matrix.platform }}
141143
push: ${{ github.ref_name == 'master' }}
142144
tags: |
143-
${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:idf-${{ matrix.esp_idf_version }}-matter-${{ matrix.esp_matter_version }}-${{ steps.platform.outputs.tag }}
145+
${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:idf-${{ matrix.jethome_idf_base_tag }}-matter-${{ matrix.esp_matter_version }}-${{ steps.platform.outputs.tag }}
144146
cache-from: type=gha,scope=esp-matter-${{ steps.platform.outputs.tag }}
145147
cache-to: type=gha,mode=max,scope=esp-matter-${{ steps.platform.outputs.tag }}
146148
build-args: |
147-
BASE_IMAGE_TAG=idf-${{ matrix.esp_idf_version }}-${{ steps.platform.outputs.tag }}
149+
BASE_IMAGE_TAG=idf-${{ matrix.jethome_idf_base_tag }}-${{ steps.platform.outputs.tag }}
148150
ESP_MATTER_VERSION=${{ matrix.esp_matter_version }}
149151
150-
create-manifest-matter:
152+
esp-matter-manifest:
151153
runs-on: ubuntu-latest
152-
needs: build-esp-matter
153-
if: github.ref_name == 'master'
154+
needs: esp-matter-build
155+
if: false && github.repository_owner == 'jethome-iot' && github.ref_name == 'master' # Temporarily disabled
154156
permissions:
155157
contents: read
156158
packages: write
157159
strategy:
158160
matrix:
159-
esp_idf_version: ['v5.4.1']
161+
jethome_idf_base_tag: ['v5.4.1']
160162
esp_matter_version: ['v1.4.2']
161163
steps:
162164
- name: 🔐 Log in to GitHub Container Registry
@@ -178,9 +180,9 @@ jobs:
178180
run: |
179181
docker buildx imagetools create -t ${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:latest \
180182
-t ${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:stable \
181-
-t ${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:idf-${{ matrix.esp_idf_version }}-matter-${{ matrix.esp_matter_version }} \
183+
-t ${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:idf-${{ matrix.jethome_idf_base_tag }}-matter-${{ matrix.esp_matter_version }} \
182184
-t ${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:matter-${{ matrix.esp_matter_version }} \
183185
-t ${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:${{ steps.tags.outputs.date_tag }} \
184186
-t ${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:sha-${{ steps.tags.outputs.sha_short }} \
185-
${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:idf-${{ matrix.esp_idf_version }}-matter-${{ matrix.esp_matter_version }}-linux-amd64 \
186-
${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:idf-${{ matrix.esp_idf_version }}-matter-${{ matrix.esp_matter_version }}-linux-arm64
187+
${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:idf-${{ matrix.jethome_idf_base_tag }}-matter-${{ matrix.esp_matter_version }}-linux-amd64 \
188+
${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:idf-${{ matrix.jethome_idf_base_tag }}-matter-${{ matrix.esp_matter_version }}-linux-arm64

.github/workflows/platformio.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ env:
1919
IMAGE_NAME: jethome-dev-platformio
2020

2121
jobs:
22-
build:
22+
platformio-build:
2323
runs-on: ubuntu-latest
24+
if: github.repository_owner == 'jethome-iot'
2425
permissions:
2526
contents: read
2627
packages: write
@@ -63,10 +64,10 @@ jobs:
6364
build-args: |
6465
PIO_VERSION=${{ matrix.pio_version }}
6566
66-
create-manifest:
67+
platformio-manifest:
6768
runs-on: ubuntu-latest
68-
needs: build
69-
if: github.ref_name == 'master'
69+
needs: platformio-build
70+
if: github.repository_owner == 'jethome-iot' && github.ref_name == 'master'
7071
permissions:
7172
contents: read
7273
packages: write

README.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Docker-based development environment for embedded systems, providing containeriz
99

1010
| Image | Description | Documentation |
1111
|-------|-------------|---------------|
12-
| [esp-idf](./images/esp-idf/) | ESP-IDF 5.4.1 with QEMU, pytest, and testing tools for all ESP32 chips | [README](./images/esp-idf/README.md) |
13-
| [esp-matter](./images/esp-matter/) | ESP-Matter v1.4.2 SDK for Matter protocol development on ESP32 | [README](./images/esp-matter/README.md) |
12+
| [esp-idf](./images/esp-idf/) | ESP-IDF with QEMU, pytest, and testing tools for all ESP32 chips | [README](./images/esp-idf/README.md) |
13+
| [esp-matter](./images/esp-matter/) | ESP-Matter SDK for Matter protocol development on ESP32 | [README](./images/esp-matter/README.md) |
1414
| [platformio](./images/platformio/) | PlatformIO with ESP32 (all variants) + ESP-IDF + Unity testing | [README](./images/platformio/README.md) |
1515

1616
## Quick Start
@@ -67,19 +67,17 @@ docker run -it --rm -v $(pwd):/workspace \
6767

6868
### ESP-IDF Image
6969

70-
- **Base**: espressif/idf:v5.4.1 (Ubuntu 24.04 LTS)
71-
- **ESP-IDF**: 5.4.1 with all ESP32 toolchains
72-
- **QEMU**: Xtensa and RISC-V emulation support
70+
- **Base**: Official espressif/idf (Ubuntu LTS)
71+
- **ESP-IDF**: All ESP32 toolchains included in base image
72+
- **QEMU**: Xtensa and RISC-V emulation support (from base image)
7373
- **Supported Chips**: ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6, ESP32-H2, ESP32-P4
74-
- **Testing**: pytest, pytest-embedded, gcovr, lcov
75-
- **Code Quality**: pylint, flake8, black, clang-format, clang-tidy
76-
- **Documentation**: Sphinx, sphinx-rtd-theme
77-
- **Tools**: jq, vim, nano, rsync, git
74+
- **Additional Tools**: jq (JSON processor), gcovr (code coverage)
75+
- **Testing**: pytest, pytest-embedded frameworks for ESP-IDF and QEMU
7876

7977
### ESP-Matter Image
8078

81-
- **Base**: jethome-dev-esp-idf:idf-v5.4.1 (inherits all ESP-IDF tools)
82-
- **ESP-Matter**: v1.4.2 with ConnectedHomeIP SDK
79+
- **Base**: jethome-dev-esp-idf (inherits all ESP-IDF tools)
80+
- **ESP-Matter**: ConnectedHomeIP SDK included
8381
- **Matter Protocol**: Support for Matter 1.0 and 1.1 (partial)
8482
- **Supported Chips**: ESP32-C3, ESP32-C6, ESP32-S3, ESP32-H2 (full Matter support)
8583
- **Features**: Matter device clusters, commissioning, OTA updates
@@ -88,12 +86,12 @@ docker run -it --rm -v $(pwd):/workspace \
8886

8987
### PlatformIO Image
9088

91-
- **Base**: Python 3.11 slim (Debian Bookworm)
89+
- **Base**: Python slim (Debian)
9290
- **PlatformIO Core**: Latest version
93-
- **Platforms**: ESP32 (6.11.0), Native (1.2.1)
91+
- **Platforms**: ESP32, Native
9492
- **Supported Chips**: ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6
9593
- **Framework**: ESP-IDF (toolchains download on first build)
96-
- **Testing**: Unity 2.6.0 (globally installed)
94+
- **Testing**: Unity (globally installed)
9795
- **Tools**: git, cmake, clang-format, curl, wget, jq
9896
- **Python**: protobuf, jinja2
9997

@@ -180,10 +178,10 @@ jethome-dev/
180178
│ ├── esp-idf.yml # ESP-IDF and ESP-Matter image workflows
181179
│ └── platformio.yml # PlatformIO image workflow
182180
├── images/
183-
│ ├── esp-idf/ # ESP-IDF 5.4.1 development image
181+
│ ├── esp-idf/ # ESP-IDF development image
184182
│ │ ├── Dockerfile # Image definition
185183
│ │ └── README.md # Detailed documentation
186-
│ ├── esp-matter/ # ESP-Matter v1.4.2 development image
184+
│ ├── esp-matter/ # ESP-Matter development image
187185
│ │ ├── Dockerfile # Image definition
188186
│ │ └── README.md # Detailed documentation
189187
│ └── platformio/ # PlatformIO development image

0 commit comments

Comments
 (0)