Skip to content

Commit 5499c59

Browse files
authored
Merge branch 'master' into master
2 parents da3fdd7 + 411b5b1 commit 5499c59

File tree

145 files changed

+6714
-793
lines changed

Some content is hidden

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

145 files changed

+6714
-793
lines changed

.github/CI_README.md

Lines changed: 1486 additions & 0 deletions
Large diffs are not rendered by default.

.github/ISSUE_TEMPLATE/Issue-report.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ body:
4242
options:
4343
- Please select a version from the list below
4444
- latest master (checkout manually)
45+
- v3.3.6-RC1
4546
- v3.3.5
4647
- v3.3.4
4748
- v3.3.3

.github/scripts/backlog-cleanup.js

Lines changed: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
/**
2+
* GitHub Action script for managing issue backlog.
3+
*
4+
* Behavior:
5+
* - Pull Requests are skipped (only opened issues are processed)
6+
* - Skips issues with labels defined in 'exemptLabels'
7+
* - Closes issues with labels defined in 'closeLabels' or without assignees,
8+
* with a standard closure comment.
9+
* - Sends a Friendly Reminder comment to assigned issues without
10+
* exempt labels that have been inactive for 90+ days.
11+
* - Avoids sending duplicate Friendly Reminder comments if one was
12+
* posted within the last 7 days.
13+
* - Marks issues labeled 'Type: Question' by adding the 'Move to Discussion' label.
14+
* (Actual migration to Discussions must be handled manually due to API limitations.)
15+
*/
16+
17+
const dedent = (strings, ...values) => {
18+
const raw = typeof strings === 'string' ? [strings] : strings.raw;
19+
let result = '';
20+
raw.forEach((str, i) => {
21+
result += str + (values[i] || '');
22+
});
23+
const lines = result.split('\n');
24+
if (!lines.some(l => l.trim())) return '';
25+
const minIndent = Math.min(...lines.filter(l => l.trim()).map(l => l.match(/^\s*/)[0].length));
26+
return lines.map(l => l.slice(minIndent)).join('\n').trim();
27+
};
28+
29+
30+
async function addMoveToDiscussionLabel(github, owner, repo, issue, isDryRun) {
31+
const targetLabel = "Move to Discussion";
32+
33+
const hasLabel = issue.labels.some(
34+
l => l.name.toLowerCase() === targetLabel.toLowerCase()
35+
);
36+
37+
if (hasLabel) return false;
38+
39+
if (isDryRun) {
40+
console.log(`[DRY-RUN] Would add '${targetLabel}' to issue #${issue.number}`);
41+
return true;
42+
}
43+
44+
try {
45+
await github.rest.issues.addLabels({
46+
owner,
47+
repo,
48+
issue_number: issue.number,
49+
labels: [targetLabel],
50+
});
51+
console.log(`Adding label to #${issue.number} (Move to discussion)`);
52+
return true;
53+
54+
} catch (err) {
55+
console.error(`Failed to add label to #${issue.number}`, err);
56+
return false;
57+
}
58+
}
59+
60+
61+
async function fetchAllOpenIssues(github, owner, repo) {
62+
const issues = [];
63+
let page = 1;
64+
65+
while (true) {
66+
try {
67+
const response = await github.rest.issues.listForRepo({
68+
owner,
69+
repo,
70+
state: 'open',
71+
per_page: 100,
72+
page,
73+
});
74+
const data = response.data || [];
75+
if (data.length === 0) break;
76+
const onlyIssues = data.filter(issue => !issue.pull_request);
77+
issues.push(...onlyIssues);
78+
if (data.length < 100) break;
79+
page++;
80+
} catch (err) {
81+
console.error('Error fetching issues:', err);
82+
break;
83+
}
84+
}
85+
return issues;
86+
}
87+
88+
89+
async function hasRecentFriendlyReminder(github, owner, repo, issueNumber, maxAgeMs) {
90+
let page = 1;
91+
92+
while (true) {
93+
const { data } = await github.rest.issues.listComments({
94+
owner,
95+
repo,
96+
issue_number: issueNumber,
97+
per_page: 100,
98+
page,
99+
});
100+
if (!data || data.length === 0) break;
101+
102+
for (const c of data) {
103+
if (c.user?.login === 'github-actions[bot]' &&
104+
c.body.includes('<!-- backlog-bot:friendly-reminder -->'))
105+
{
106+
const created = new Date(c.created_at).getTime();
107+
if (Date.now() - created < maxAgeMs) {
108+
return true;
109+
}
110+
}
111+
}
112+
113+
if (data.length < 100) break;
114+
page++;
115+
}
116+
return false;
117+
}
118+
119+
120+
module.exports = async ({ github, context, dryRun }) => {
121+
const now = new Date();
122+
const thresholdDays = 90;
123+
const exemptLabels = [
124+
'Status: Community help needed',
125+
'Status: Needs investigation',
126+
'Move to Discussion',
127+
'Status: Blocked upstream 🛑',
128+
'Status: Blocked by ESP-IDF 🛑'
129+
];
130+
const closeLabels = ['Status: Awaiting Response'];
131+
const questionLabel = 'Type: Question';
132+
const { owner, repo } = context.repo;
133+
const sevenDaysMs = 7 * 24 * 60 * 60 * 1000;
134+
135+
const isDryRun = dryRun === "1";
136+
if (isDryRun) {
137+
console.log("DRY-RUN mode enabled — no changes will be made.");
138+
}
139+
140+
let totalClosed = 0;
141+
let totalReminders = 0;
142+
let totalSkipped = 0;
143+
let totalMarkedToMigrate = 0;
144+
145+
let issues = [];
146+
147+
try {
148+
issues = await fetchAllOpenIssues(github, owner, repo);
149+
} catch (err) {
150+
console.error('Failed to fetch issues:', err);
151+
return;
152+
}
153+
154+
for (const issue of issues) {
155+
const isAssigned = issue.assignees && issue.assignees.length > 0;
156+
const lastUpdate = new Date(issue.updated_at);
157+
const oneDayMs = 1000 * 60 * 60 * 24;
158+
const daysSinceUpdate = Math.floor((now - lastUpdate) / oneDayMs);
159+
160+
if (issue.labels.some(label => exemptLabels.includes(label.name))) {
161+
console.log(`Skipping #${issue.number} (exempt label)`);
162+
totalSkipped++;
163+
continue;
164+
}
165+
166+
if (issue.labels.some(label => label.name === questionLabel)) {
167+
const marked = await addMoveToDiscussionLabel(github, owner, repo, issue, isDryRun);
168+
if (marked) totalMarkedToMigrate++;
169+
continue; // Do not apply reminder logic
170+
}
171+
172+
if (daysSinceUpdate < thresholdDays) {
173+
console.log(`Skipping #${issue.number} (recent activity)`);
174+
totalSkipped++;
175+
continue;
176+
}
177+
178+
if (issue.labels.some(label => closeLabels.includes(label.name)) || !isAssigned) {
179+
180+
if (isDryRun) {
181+
console.log(`[DRY-RUN] Would close issue #${issue.number}`);
182+
totalClosed++;
183+
continue;
184+
}
185+
186+
try {
187+
await github.rest.issues.createComment({
188+
owner,
189+
repo,
190+
issue_number: issue.number,
191+
body: '⚠️ This issue was closed automatically due to inactivity. Please reopen or open a new one if still relevant.',
192+
});
193+
await github.rest.issues.update({
194+
owner,
195+
repo,
196+
issue_number: issue.number,
197+
state: 'closed',
198+
});
199+
console.log(`Closing #${issue.number} (inactivity)`);
200+
totalClosed++;
201+
} catch (err) {
202+
console.error(`Error closing issue #${issue.number}:`, err);
203+
}
204+
continue;
205+
}
206+
207+
if (isAssigned) {
208+
209+
if (await hasRecentFriendlyReminder(github, owner, repo, issue.number, sevenDaysMs)) {
210+
console.log(`Skipping #${issue.number} (recent reminder)`);
211+
totalSkipped++;
212+
continue;
213+
}
214+
215+
const assignees = issue.assignees.map(u => `@${u.login}`).join(', ');
216+
const comment = dedent`
217+
<!-- backlog-bot:friendly-reminder -->
218+
⏰ Friendly Reminder
219+
220+
Hi ${assignees}!
221+
222+
This issue has had no activity for ${daysSinceUpdate} days. If it's still relevant:
223+
- Please provide a status update
224+
- Add any blocking details and labels
225+
- Or label it 'Status: Awaiting Response' if you're waiting on the user's response
226+
227+
This is just a reminder; the issue remains open for now.`;
228+
229+
if (isDryRun) {
230+
console.log(`[DRY-RUN] Would post reminder on #${issue.number}`);
231+
totalReminders++;
232+
continue;
233+
}
234+
235+
try {
236+
await github.rest.issues.createComment({
237+
owner,
238+
repo,
239+
issue_number: issue.number,
240+
body: comment,
241+
});
242+
console.log(`Sending reminder to #${issue.number}`);
243+
totalReminders++;
244+
} catch (err) {
245+
console.error(`Error sending reminder for issue #${issue.number}:`, err);
246+
}
247+
}
248+
}
249+
250+
console.log(dedent`
251+
=== Backlog cleanup summary ===
252+
Total issues processed: ${issues.length}
253+
Total issues closed: ${totalClosed}
254+
Total reminders sent: ${totalReminders}
255+
Total marked to migrate to discussions: ${totalMarkedToMigrate}
256+
Total skipped: ${totalSkipped}`);
257+
};
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
#!/bin/bash
2+
3+
#
4+
# Check if Official Variants Changed
5+
# This script determines if a workflow should run based on whether official variants were modified.
6+
#
7+
# Usage:
8+
# check_official_variants.sh <event_name> <target_list> <changed_files...>
9+
#
10+
# Arguments:
11+
# event_name: GitHub event name (pull_request, push, etc.)
12+
# target_list: Which target list to use (BUILD_TEST_TARGETS or IDF_COMPONENT_TARGETS)
13+
# changed_files: Space-separated list of changed files (all remaining arguments)
14+
#
15+
# Output:
16+
# Sets should_run=true or should_run=false to $GITHUB_OUTPUT
17+
#
18+
19+
set -e
20+
21+
# Source centralized SoC configuration
22+
SCRIPTS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
23+
source "${SCRIPTS_DIR}/socs_config.sh"
24+
25+
# Parse arguments
26+
EVENT_NAME="$1"
27+
TARGET_LIST="${2:-BUILD_TEST_TARGETS}"
28+
shift 2
29+
CHANGED_FILES="$*"
30+
31+
# Validate arguments
32+
if [ -z "$EVENT_NAME" ]; then
33+
echo "ERROR: event_name is required"
34+
exit 1
35+
fi
36+
37+
if [ -z "$CHANGED_FILES" ]; then
38+
echo "ERROR: changed_files is required"
39+
exit 1
40+
fi
41+
42+
# Select the appropriate target list
43+
case "$TARGET_LIST" in
44+
"BUILD_TEST_TARGETS")
45+
OFFICIAL_TARGETS=("${BUILD_TEST_TARGETS[@]}")
46+
;;
47+
"IDF_COMPONENT_TARGETS")
48+
OFFICIAL_TARGETS=("${IDF_COMPONENT_TARGETS[@]}")
49+
;;
50+
*)
51+
echo "ERROR: Invalid target_list: $TARGET_LIST (must be BUILD_TEST_TARGETS or IDF_COMPONENT_TARGETS)"
52+
exit 1
53+
;;
54+
esac
55+
56+
# Initialize result
57+
should_run="false"
58+
59+
# If not a PR, always run
60+
if [ "$EVENT_NAME" != "pull_request" ]; then
61+
should_run="true"
62+
echo "Not a PR, will run"
63+
else
64+
# Check each changed file
65+
for file in $CHANGED_FILES; do
66+
# Check if file is in variants/ directory
67+
if [[ "$file" == variants/* ]]; then
68+
# Extract variant name (first directory after variants/)
69+
variant=$(echo "$file" | cut -d'/' -f2)
70+
71+
# Check if this variant is in official targets
72+
for target in "${OFFICIAL_TARGETS[@]}"; do
73+
if [ "$variant" == "$target" ]; then
74+
should_run="true"
75+
echo "Official variant changed: $variant"
76+
break 2
77+
fi
78+
done
79+
fi
80+
done
81+
fi
82+
83+
# If no official variants changed, check if non-variant files changed
84+
if [ "$should_run" == "false" ]; then
85+
for file in $CHANGED_FILES; do
86+
if [[ "$file" != variants/* ]]; then
87+
should_run="true"
88+
echo "Non-variant file changed: $file"
89+
break
90+
fi
91+
done
92+
fi
93+
94+
# Output result
95+
if [ -n "$GITHUB_OUTPUT" ]; then
96+
echo "should_run=$should_run" >> "$GITHUB_OUTPUT"
97+
fi
98+
99+
if [ "$should_run" == "false" ]; then
100+
echo "Only non-official variants changed, skipping build"
101+
else
102+
echo "Will run workflow"
103+
fi
104+
105+
# Also output to stdout for easy testing
106+
echo "$should_run"
107+

.github/scripts/find_all_boards.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
#!/bin/bash
22

3+
# Source centralized SoC configuration
4+
SCRIPTS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5+
source "${SCRIPTS_DIR}/socs_config.sh"
6+
37
# Get all boards
48
boards_array=()
59

610
boards_list=$(grep '.tarch=' boards.txt)
711

812
while read -r line; do
913
board_name=$(echo "$line" | cut -d '.' -f1 | cut -d '#' -f1)
10-
# skip esp32c2 as we dont build libs for it
11-
if [ "$board_name" == "esp32c2" ] || [ "$board_name" == "esp32c61" ]; then
14+
# Skip SoCs that don't have pre-built libs
15+
if should_skip_lib_build "$board_name"; then
1216
echo "Skipping 'espressif:esp32:$board_name'"
1317
continue
1418
fi

0 commit comments

Comments
 (0)