Skip to content

Commit 4b311b6

Browse files
Merge branch 'main' into feat/i2s-move
2 parents 4f6564f + fd44c17 commit 4b311b6

File tree

336 files changed

+14347
-11093
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

336 files changed

+14347
-11093
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: API Baseline Check
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, labeled, unlabeled]
6+
7+
env:
8+
CARGO_TERM_COLOR: always
9+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10+
11+
# Cancel any currently running workflows from the same PR, branch, or
12+
# tag when a new workflow is triggered.
13+
#
14+
# https://stackoverflow.com/a/66336834
15+
concurrency:
16+
cancel-in-progress: true
17+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
18+
19+
jobs:
20+
baseline-check:
21+
runs-on: ubuntu-latest
22+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'breaking-change-esp-hal') }}
23+
env:
24+
CARGO_TARGET_DIR: ${{ github.workspace }}/target
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
# Install the Rust toolchain for Xtensa devices:
30+
- uses: esp-rs/[email protected]
31+
with:
32+
version: 1.90.0.0
33+
34+
# Install the Rust stable toolchain for RISC-V devices:
35+
- uses: dtolnay/rust-toolchain@v1
36+
with:
37+
target: riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf
38+
toolchain: stable
39+
components: rust-src
40+
41+
- name: Semver-Check
42+
shell: bash
43+
run: |
44+
cargo xcheck semver-check download-baselines
45+
cargo xcheck semver-check --chips esp32 check
46+
cargo xcheck semver-check --chips esp32s2 check
47+
cargo xcheck semver-check --chips esp32s3 check
48+
cargo xcheck semver-check --chips esp32c2 check
49+
cargo xcheck semver-check --chips esp32c3 check
50+
cargo xcheck semver-check --chips esp32c6 check
51+
cargo xcheck semver-check --chips esp32h2 check
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
name: API Baseline Generation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
inputs:
9+
source_branch:
10+
description: "Branch to generate baseline from"
11+
required: true
12+
default: "main"
13+
type: string
14+
target_repository:
15+
description: "Target repository for baseline storage (owner/repo)"
16+
required: false
17+
default: ""
18+
type: string
19+
force_regeneration:
20+
description: "Force baseline regeneration even without breaking change"
21+
required: false
22+
default: false
23+
type: boolean
24+
25+
env:
26+
CARGO_TERM_COLOR: always
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
GITHUB_REPOSITORY: ${{ github.repository }}
29+
30+
jobs:
31+
manage-baselines:
32+
runs-on: ubuntu-latest
33+
env:
34+
CARGO_TARGET_DIR: ${{ github.workspace }}/target
35+
36+
steps:
37+
- name: Checkout code
38+
uses: actions/checkout@v4
39+
with:
40+
ref: ${{ github.event.inputs.source_branch || 'main' }}
41+
fetch-depth: 10
42+
43+
- name: Set target repository
44+
if: github.event_name == 'workflow_dispatch'
45+
shell: bash
46+
run: |
47+
if [ -n "${{ github.event.inputs.target_repository }}" ]; then
48+
TARGET_REPO="${{ github.event.inputs.target_repository }}"
49+
echo "Using custom target repository: $TARGET_REPO"
50+
else
51+
TARGET_REPO="${{ github.repository }}"
52+
echo "Using current repository: $TARGET_REPO"
53+
fi
54+
echo "GITHUB_REPOSITORY=$TARGET_REPO" >> $GITHUB_ENV
55+
echo "📦 Target repository for baselines: $TARGET_REPO"
56+
57+
- name: Install Rust toolchain
58+
uses: dtolnay/rust-toolchain@v1
59+
with:
60+
toolchain: stable
61+
components: rust-src
62+
63+
- name: Install xtensa toolchain
64+
uses: esp-rs/[email protected]
65+
with:
66+
version: 1.90.0.0
67+
68+
- name: Check if baseline generation is needed
69+
id: check-generation
70+
shell: bash
71+
run: |
72+
# Always generate for manual dispatch
73+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
74+
if [ "${{ github.event.inputs.force_regeneration }}" = "true" ]; then
75+
echo "Manual baseline regeneration requested (force_regeneration=true)"
76+
echo "should_generate=true" >> $GITHUB_OUTPUT
77+
echo "trigger_reason=manual_force" >> $GITHUB_OUTPUT
78+
else
79+
echo "Manual baseline generation requested"
80+
echo "should_generate=true" >> $GITHUB_OUTPUT
81+
echo "trigger_reason=manual" >> $GITHUB_OUTPUT
82+
fi
83+
exit 0
84+
fi
85+
86+
# For push events, check for breaking changes
87+
echo "Checking for breaking change in merged PR..."
88+
89+
# Get the commit message of the last commit
90+
COMMIT_MSG=$(git log -1 --pretty=%B)
91+
echo "Last commit message: $COMMIT_MSG"
92+
93+
# Extract PR number from commit message if it follows conventional format
94+
PR_NUMBER=""
95+
if echo "$COMMIT_MSG" | grep -q "#"; then
96+
PR_NUMBER=$(echo "$COMMIT_MSG" | grep -o "#[0-9]*" | grep -o "[0-9]*")
97+
fi
98+
99+
if [ -n "$PR_NUMBER" ]; then
100+
echo "Found PR number: $PR_NUMBER"
101+
102+
# Check if the PR had the breaking-change-esp-hal label
103+
LABELS=$(gh pr view $PR_NUMBER --json labels --jq '.labels[].name' 2>/dev/null || echo "")
104+
echo "PR labels: $LABELS"
105+
106+
if echo "$LABELS" | grep -q "breaking-change-esp-hal"; then
107+
echo "Breaking change detected in PR #$PR_NUMBER"
108+
echo "should_generate=true" >> $GITHUB_OUTPUT
109+
echo "trigger_reason=breaking_change" >> $GITHUB_OUTPUT
110+
else
111+
echo "No breaking change label found in PR #$PR_NUMBER"
112+
echo "should_generate=false" >> $GITHUB_OUTPUT
113+
echo "trigger_reason=none" >> $GITHUB_OUTPUT
114+
fi
115+
else
116+
echo "No PR number found in commit message"
117+
echo "should_generate=false" >> $GITHUB_OUTPUT
118+
echo "trigger_reason=none" >> $GITHUB_OUTPUT
119+
fi
120+
121+
- name: Generate API baselines
122+
if: steps.check-generation.outputs.should_generate == 'true'
123+
shell: bash
124+
run: |
125+
echo "Starting API baseline generation..."
126+
echo "Trigger reason: ${{ steps.check-generation.outputs.trigger_reason }}"
127+
cargo xcheck semver-check generate-baseline
128+
echo "API baseline generation completed"
129+
130+
- name: Upload API baselines as artifact
131+
if: steps.check-generation.outputs.should_generate == 'true'
132+
uses: actions/upload-artifact@v4
133+
with:
134+
name: api-baselines-esp-hal
135+
path: esp-hal/api-baseline/
136+
retention-days: 90 # Maximum for public repos
137+
138+
- name: Create baseline summary
139+
if: steps.check-generation.outputs.should_generate == 'true'
140+
shell: bash
141+
run: |
142+
echo "Successfully generated and uploaded API baselines"
143+
echo "Artifact name: api-baselines-esp-hal"
144+
echo "Retention: 90 days (expires on $(date -d '+90 days' '+%Y-%m-%d'))"
145+
echo "Source branch: ${{ github.event.inputs.source_branch || 'main' }}"
146+
echo "Commit: ${{ github.sha }}"
147+
echo "Target repository: $GITHUB_REPOSITORY"
148+
149+
# Create appropriate summary based on trigger reason
150+
if [ "${{ steps.check-generation.outputs.trigger_reason }}" = "breaking_change" ]; then
151+
echo "## Breaking Change Baseline Regeneration" >> $GITHUB_STEP_SUMMARY
152+
echo "" >> $GITHUB_STEP_SUMMARY
153+
echo "This API baseline regeneration was automatically triggered due to a breaking change in the merged PR." >> $GITHUB_STEP_SUMMARY
154+
echo "" >> $GITHUB_STEP_SUMMARY
155+
elif [ "${{ steps.check-generation.outputs.trigger_reason }}" = "manual_force" ]; then
156+
echo "## Manual Baseline Regeneration (Forced)" >> $GITHUB_STEP_SUMMARY
157+
echo "" >> $GITHUB_STEP_SUMMARY
158+
echo "This API baseline regeneration was manually triggered with force regeneration enabled." >> $GITHUB_STEP_SUMMARY
159+
echo "" >> $GITHUB_STEP_SUMMARY
160+
elif [ "${{ steps.check-generation.outputs.trigger_reason }}" = "manual" ]; then
161+
echo "## Manual Baseline Generation" >> $GITHUB_STEP_SUMMARY
162+
echo "" >> $GITHUB_STEP_SUMMARY
163+
echo "This API baseline generation was manually triggered." >> $GITHUB_STEP_SUMMARY
164+
echo "" >> $GITHUB_STEP_SUMMARY
165+
else
166+
echo "## Baseline Generation Summary" >> $GITHUB_STEP_SUMMARY
167+
echo "" >> $GITHUB_STEP_SUMMARY
168+
fi
169+
170+
echo "- **Target Repository**: \`$GITHUB_REPOSITORY\`" >> $GITHUB_STEP_SUMMARY
171+
echo "- **Source Branch**: \`${{ github.event.inputs.source_branch || 'main' }}\`" >> $GITHUB_STEP_SUMMARY
172+
echo "- **Artifact Name**: \`api-baselines-esp-hal\`" >> $GITHUB_STEP_SUMMARY
173+
echo "- **Retention**: 90 days (expires $(date -d '+90 days' '+%Y-%m-%d'))" >> $GITHUB_STEP_SUMMARY
174+
echo "" >> $GITHUB_STEP_SUMMARY
175+
echo "### Baseline Files Generated" >> $GITHUB_STEP_SUMMARY
176+
echo "| Chip | File Size |" >> $GITHUB_STEP_SUMMARY
177+
echo "|------|-----------|" >> $GITHUB_STEP_SUMMARY
178+
179+
cd esp-hal/api-baseline
180+
for file in *.json.gz; do
181+
if [ -f "$file" ]; then
182+
chip=$(basename "$file" .json.gz)
183+
size=$(du -h "$file" | cut -f1)
184+
echo "| $chip | $size |" >> $GITHUB_STEP_SUMMARY
185+
fi
186+
done
187+
188+
- name: Create no-action summary
189+
if: steps.check-generation.outputs.should_generate == 'false'
190+
shell: bash
191+
run: |
192+
echo "## No Baseline Generation Needed" >> $GITHUB_STEP_SUMMARY
193+
echo "" >> $GITHUB_STEP_SUMMARY
194+
echo "No breaking change detected in the merged PR. API baselines will not be regenerated." >> $GITHUB_STEP_SUMMARY

.github/workflows/changelog.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ jobs:
3838
- 'esp-config/**'
3939
esp-hal:
4040
- 'esp-hal/**'
41-
esp-hal-embassy:
42-
- 'esp-hal-embassy/**'
4341
esp-hal-procmacros:
4442
- 'esp-hal-procmacros/**'
4543
esp-lp-hal:
@@ -48,8 +46,8 @@ jobs:
4846
- 'esp-metadata/**'
4947
esp-phy:
5048
- 'esp-phy/**'
51-
esp-preempt:
52-
- 'esp-preempt/**'
49+
esp-rtos:
50+
- 'esp-rtos/**'
5351
esp-println:
5452
- 'esp-println/**'
5553
esp-riscv-rt:
@@ -60,6 +58,8 @@ jobs:
6058
- 'esp-storage/**'
6159
esp-radio:
6260
- 'esp-radio/**'
61+
esp-radio-rtos-driver:
62+
- 'esp-radio-rtos-driver/**'
6363
esp-sync:
6464
- 'esp-sync/**'
6565
xtensa-lx:
@@ -115,14 +115,6 @@ jobs:
115115
skipLabels: "skip-changelog"
116116
missingUpdateErrorMessage: "Please add a changelog entry in the esp-hal/CHANGELOG.md file."
117117

118-
- name: Check that changelog updated (esp-hal-embassy)
119-
if: steps.changes.outputs.esp-hal-embassy == 'true'
120-
uses: dangoslen/changelog-enforcer@v3
121-
with:
122-
changeLogPath: esp-hal-embassy/CHANGELOG.md
123-
skipLabels: "skip-changelog"
124-
missingUpdateErrorMessage: "Please add a changelog entry in the esp-hal-embassy/CHANGELOG.md file."
125-
126118
- name: Check that changelog updated (esp-hal-procmacros)
127119
if: steps.changes.outputs.esp-hal-procmacros == 'true'
128120
uses: dangoslen/changelog-enforcer@v3
@@ -147,13 +139,13 @@ jobs:
147139
skipLabels: "skip-changelog"
148140
missingUpdateErrorMessage: "Please add a changelog entry in the esp-phy/CHANGELOG.md file."
149141

150-
- name: Check that changelog updated (esp-preempt)
151-
if: steps.changes.outputs.esp-preempt == 'true'
142+
- name: Check that changelog updated (esp-rtos)
143+
if: steps.changes.outputs.esp-rtos == 'true'
152144
uses: dangoslen/changelog-enforcer@v3
153145
with:
154-
changeLogPath: esp-preempt/CHANGELOG.md
146+
changeLogPath: esp-rtos/CHANGELOG.md
155147
skipLabels: "skip-changelog"
156-
missingUpdateErrorMessage: "Please add a changelog entry in the esp-preempt/CHANGELOG.md file."
148+
missingUpdateErrorMessage: "Please add a changelog entry in the esp-rtos/CHANGELOG.md file."
157149

158150
- name: Check that changelog updated (esp-println)
159151
if: steps.changes.outputs.esp-println == 'true'
@@ -187,6 +179,14 @@ jobs:
187179
skipLabels: "skip-changelog"
188180
missingUpdateErrorMessage: "Please add a changelog entry in the esp-radio/CHANGELOG.md file."
189181

182+
- name: Check that changelog updated (esp-radio-rtos-driver)
183+
if: steps.changes.outputs.esp-radio-rtos-driver == 'true'
184+
uses: dangoslen/changelog-enforcer@v3
185+
with:
186+
changeLogPath: esp-radio-rtos-driver/CHANGELOG.md
187+
skipLabels: "skip-changelog"
188+
missingUpdateErrorMessage: "Please add a changelog entry in the esp-radio-rtos-driver/CHANGELOG.md file."
189+
190190
- name: Check that changelog updated (esp-sync)
191191
if: steps.changes.outputs.esp-sync == 'true'
192192
uses: dangoslen/changelog-enforcer@v3

.github/workflows/ci.yml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# updates which must be made to the CI workflow in order to reflect this; the
55
# changes are:
66
#
7-
# 1.) In the 'esp-hal' job, add the appropriate build and semver-check command.
7+
# 1.) In the 'esp-hal' job, add the appropriate build command.
88
# 1a.) If the device has a low-power core (which is supported in
99
# `esp-lp-hal`), then update the `if` condition to build prerequisites.
1010
# 2.) In the 'msrv' job, add checks as needed for the new chip.
@@ -56,7 +56,7 @@ jobs:
5656
# Install the Rust toolchain for Xtensa devices:
5757
- uses: esp-rs/[email protected]
5858
with:
59-
version: 1.89.0.0
59+
version: 1.90.0.0
6060

6161
# Install the Rust stable toolchain for RISC-V devices:
6262
- uses: dtolnay/rust-toolchain@v1
@@ -83,18 +83,6 @@ jobs:
8383
cargo xcheck ci esp32c6 --toolchain stable --no-lint --no-docs
8484
cargo xcheck ci esp32h2 --toolchain stable --no-lint --no-docs
8585
86-
- name: Semver-Check
87-
shell: bash
88-
# always invokes +esp internally
89-
run: |
90-
cargo xcheck semver-check --chips esp32 check
91-
cargo xcheck semver-check --chips esp32s2 check
92-
cargo xcheck semver-check --chips esp32s3 check
93-
cargo xcheck semver-check --chips esp32c2 check
94-
cargo xcheck semver-check --chips esp32c3 check
95-
cargo xcheck semver-check --chips esp32c6 check
96-
cargo xcheck semver-check --chips esp32h2 check
97-
9886
detect-extras-runner:
9987
uses: ./.github/workflows/check_runner.yml
10088
with:
@@ -223,14 +211,15 @@ jobs:
223211
- uses: actions/checkout@v4
224212
- uses: lycheeverse/lychee-action@v2
225213
with:
226-
args: |
214+
args: >
227215
--verbose
228216
--no-progress
229217
--format detailed
230218
--timeout 7
231219
--max-concurrency 6
232220
--accept "200,301,302"
233221
--exclude-path ".*/target/.*|.*/static\.files/.*|.*/docs/.*"
222+
--remap "https://github.com/${{ github.repository }}/(?:blob|tree)/[^/]+/(.+) file://$GITHUB_WORKSPACE/\$1"
234223
'./**/*.rs'
235224
'./**/*.md'
236-
'./**/*.toml'
225+
'./**/*.toml'

0 commit comments

Comments
 (0)