Skip to content

Commit 18e7320

Browse files
authored
Merge pull request #154 from SenaxInc/copilot/split-github-actions-compiler
Split Arduino CI workflow into platform-specific workflows (092025/112025)
2 parents f7bee58 + f25179b commit 18e7320

File tree

2 files changed

+173
-60
lines changed

2 files changed

+173
-60
lines changed
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
name: Arduino CI - TankAlarm 092025 (Hologram)
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
paths:
7+
- 'TankAlarm-092025-Client-Hologram/**'
8+
- 'TankAlarm-092025-Server-Hologram/**'
9+
- '.github/workflows/arduino-ci-092025.yml'
10+
pull_request:
11+
branches: [main, master]
12+
paths:
13+
- 'TankAlarm-092025-Client-Hologram/**'
14+
- 'TankAlarm-092025-Server-Hologram/**'
15+
- '.github/workflows/arduino-ci-092025.yml'
16+
workflow_dispatch:
17+
18+
jobs:
19+
compile-arduino-092025:
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
issues: write
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Setup Arduino CLI
29+
uses: arduino/setup-arduino-cli@v1
30+
31+
- name: Install Arduino SAMD core
32+
run: |
33+
arduino-cli core update-index
34+
arduino-cli core install arduino:samd
35+
36+
- name: Install required libraries for 092025
37+
run: |
38+
arduino-cli lib update-index
39+
arduino-cli lib install "MKRNB"
40+
arduino-cli lib install "SD"
41+
arduino-cli lib install "Arduino Low Power"
42+
arduino-cli lib install "RTCZero"
43+
44+
- name: Compile TankAlarm-092025-Client-Hologram
45+
id: compile-client
46+
continue-on-error: true
47+
run: |
48+
arduino-cli compile --fqbn arduino:samd:mkrnb1500 \
49+
TankAlarm-092025-Client-Hologram/TankAlarm-092025-Client-Hologram.ino
50+
51+
- name: Compile TankAlarm-092025-Server-Hologram
52+
id: compile-server
53+
continue-on-error: true
54+
run: |
55+
arduino-cli compile --fqbn arduino:samd:mkrnb1500 \
56+
TankAlarm-092025-Server-Hologram/TankAlarm-092025-Server-Hologram.ino
57+
58+
- name: Create issue on compilation failure
59+
if: |
60+
steps.compile-client.outcome == 'failure' ||
61+
steps.compile-server.outcome == 'failure'
62+
uses: actions/github-script@v7
63+
with:
64+
github-token: ${{ secrets.GITHUB_TOKEN }}
65+
script: |
66+
const date = new Date().toISOString().split('T')[0];
67+
68+
// Determine which sketch(es) failed
69+
const clientFailed = '${{ steps.compile-client.outcome }}' === 'failure';
70+
const serverFailed = '${{ steps.compile-server.outcome }}' === 'failure';
71+
72+
const failedSketches = [];
73+
if (clientFailed) failedSketches.push('TankAlarm-092025-Client-Hologram');
74+
if (serverFailed) failedSketches.push('TankAlarm-092025-Server-Hologram');
75+
76+
const sketchName = failedSketches.length === 1 ? failedSketches[0] :
77+
failedSketches.length > 1 ? 'Multiple Sketches (092025)' : 'Unknown';
78+
const searchPattern = 'Arduino Compilation Error - 092025';
79+
80+
const issueTitle = `Arduino Compilation Error in ${sketchName} (${date})`;
81+
const workflowUrl = '${{ github.server_url }}/' +
82+
'${{ github.repository }}/actions/runs/${{ github.run_id }}';
83+
84+
let detailsSection = '### Details\n';
85+
86+
// TankAlarm-092025 sketches
87+
detailsSection += `#### TankAlarm-092025 (MKR NB 1500)\n`;
88+
detailsSection += `- **Client Sketch:** TankAlarm-092025-Client-Hologram/` +
89+
`TankAlarm-092025-Client-Hologram.ino ${clientFailed ? '❌' : '✅'}\n`;
90+
detailsSection += `- **Server Sketch:** TankAlarm-092025-Server-Hologram/` +
91+
`TankAlarm-092025-Server-Hologram.ino ${serverFailed ? '❌' : '✅'}\n`;
92+
93+
detailsSection += `\n**Board:**\n`;
94+
detailsSection += `- Arduino MKR NB 1500 (arduino:samd:mkrnb1500)\n`;
95+
detailsSection += `\n**Triggered by:** ${{ github.event_name }}`;
96+
97+
const issueBody = `## Arduino Compilation Failed - TankAlarm 092025
98+
99+
The Arduino code compilation failed for the TankAlarm-092025 (Hologram) projects.
100+
101+
**Workflow Run:** ${workflowUrl}
102+
**Commit:** ${{ github.sha }}
103+
**Branch:** ${{ github.ref_name }}
104+
105+
${detailsSection}
106+
107+
### Next Steps
108+
1. Review the workflow logs for detailed error messages
109+
2. Fix compilation errors in the Arduino code
110+
3. Re-run the workflow to verify the fix
111+
112+
/cc @copilot`;
113+
114+
// Check if a similar open issue already exists
115+
const existingIssues = await github.rest.issues.listForRepo({
116+
owner: context.repo.owner,
117+
repo: context.repo.repo,
118+
state: 'open',
119+
labels: ['arduino', 'compilation-error'],
120+
per_page: 10
121+
});
122+
123+
const duplicateIssue = existingIssues.data.find(issue =>
124+
issue.title.includes(searchPattern)
125+
);
126+
127+
if (duplicateIssue) {
128+
// Add a comment to existing issue instead of creating new one
129+
const commentBody = `Another compilation failure detected:\n\n` +
130+
`**Workflow Run:** ${workflowUrl}\n` +
131+
`**Commit:** ${{ github.sha }}\n` +
132+
`**Branch:** ${{ github.ref_name }}\n\n` +
133+
detailsSection;
134+
await github.rest.issues.createComment({
135+
owner: context.repo.owner,
136+
repo: context.repo.repo,
137+
issue_number: duplicateIssue.number,
138+
body: commentBody
139+
});
140+
console.log(`Updated existing issue #${duplicateIssue.number}`);
141+
} else {
142+
// Create a new issue
143+
const issue = await github.rest.issues.create({
144+
owner: context.repo.owner,
145+
repo: context.repo.repo,
146+
title: issueTitle,
147+
body: issueBody,
148+
labels: ['arduino', 'compilation-error', 'bug', '092025']
149+
});
150+
console.log(`Created issue #${issue.data.number}`);
151+
}
152+
153+
- name: Fail workflow if compilation failed
154+
if: |
155+
steps.compile-client.outcome == 'failure' ||
156+
steps.compile-server.outcome == 'failure'
157+
run: exit 1
Lines changed: 16 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
1-
name: Arduino CI - TankAlarm 092025 & 112025
1+
name: Arduino CI - TankAlarm 112025 (Blues Opta)
22

33
on:
44
push:
55
branches: [main, master]
66
paths:
7-
- 'TankAlarm-092025-Client-Hologram/**'
8-
- 'TankAlarm-092025-Server-Hologram/**'
97
- 'TankAlarm-112025-Client-BluesOpta/**'
108
- 'TankAlarm-112025-Server-BluesOpta/**'
119
- 'TankAlarm-112025-Viewer-BluesOpta/**'
12-
- '.github/workflows/arduino-ci.yml'
10+
- '.github/workflows/arduino-ci-112025.yml'
1311
pull_request:
1412
branches: [main, master]
1513
paths:
16-
- 'TankAlarm-092025-Client-Hologram/**'
17-
- 'TankAlarm-092025-Server-Hologram/**'
1814
- 'TankAlarm-112025-Client-BluesOpta/**'
1915
- 'TankAlarm-112025-Server-BluesOpta/**'
2016
- 'TankAlarm-112025-Viewer-BluesOpta/**'
21-
- '.github/workflows/arduino-ci.yml'
17+
- '.github/workflows/arduino-ci-112025.yml'
2218
workflow_dispatch:
2319

2420
jobs:
25-
compile-arduino:
21+
compile-arduino-112025:
2622
runs-on: ubuntu-latest
2723
permissions:
2824
contents: read
@@ -34,41 +30,18 @@ jobs:
3430
- name: Setup Arduino CLI
3531
uses: arduino/setup-arduino-cli@v1
3632

37-
- name: Install Arduino SAMD core
38-
run: |
39-
arduino-cli core update-index
40-
arduino-cli core install arduino:samd
41-
4233
- name: Install Arduino Mbed OS Opta Boards core
4334
run: |
4435
arduino-cli core update-index
4536
arduino-cli core install arduino:mbed_opta
4637
47-
- name: Install required libraries
38+
- name: Install required libraries for 112025
4839
run: |
4940
arduino-cli lib update-index
50-
arduino-cli lib install "MKRNB"
51-
arduino-cli lib install "SD"
52-
arduino-cli lib install "Arduino Low Power"
53-
arduino-cli lib install "RTCZero"
5441
arduino-cli lib install "Ethernet"
5542
arduino-cli lib install "ArduinoJson"
5643
arduino-cli lib install "Blues Wireless Notecard"
5744
58-
- name: Compile TankAlarm-092025-Client-Hologram
59-
id: compile-client
60-
continue-on-error: true
61-
run: |
62-
arduino-cli compile --fqbn arduino:samd:mkrnb1500 \
63-
TankAlarm-092025-Client-Hologram/TankAlarm-092025-Client-Hologram.ino
64-
65-
- name: Compile TankAlarm-092025-Server-Hologram
66-
id: compile-server
67-
continue-on-error: true
68-
run: |
69-
arduino-cli compile --fqbn arduino:samd:mkrnb1500 \
70-
TankAlarm-092025-Server-Hologram/TankAlarm-092025-Server-Hologram.ino
71-
7245
- name: Compile TankAlarm-112025-Client-BluesOpta
7346
id: compile-112025-client
7447
continue-on-error: true
@@ -92,66 +65,51 @@ jobs:
9265
9366
- name: Create issue on compilation failure
9467
if: |
95-
steps.compile-client.outcome == 'failure' ||
96-
steps.compile-server.outcome == 'failure' ||
97-
steps.compile-112025-client.outcome == 'failure' ||
98-
steps.compile-112025-server.outcome == 'failure' ||
68+
steps.compile-112025-client.outcome == 'failure' ||
69+
steps.compile-112025-server.outcome == 'failure' ||
9970
steps.compile-112025-viewer.outcome == 'failure'
10071
uses: actions/github-script@v7
10172
with:
10273
github-token: ${{ secrets.GITHUB_TOKEN }}
10374
script: |
104-
const fs = require('fs');
10575
const date = new Date().toISOString().split('T')[0];
10676
10777
// Determine which sketch(es) failed
108-
const clientFailed = '${{ steps.compile-client.outcome }}' === 'failure';
109-
const serverFailed = '${{ steps.compile-server.outcome }}' === 'failure';
11078
const client112025Failed = '${{ steps.compile-112025-client.outcome }}' === 'failure';
11179
const server112025Failed = '${{ steps.compile-112025-server.outcome }}' === 'failure';
11280
const viewer112025Failed = '${{ steps.compile-112025-viewer.outcome }}' === 'failure';
11381
11482
const failedSketches = [];
115-
if (clientFailed) failedSketches.push('TankAlarm-092025-Client-Hologram');
116-
if (serverFailed) failedSketches.push('TankAlarm-092025-Server-Hologram');
11783
if (client112025Failed) failedSketches.push('TankAlarm-112025-Client-BluesOpta');
11884
if (server112025Failed) failedSketches.push('TankAlarm-112025-Server-BluesOpta');
11985
if (viewer112025Failed) failedSketches.push('TankAlarm-112025-Viewer-BluesOpta');
12086
12187
const sketchName = failedSketches.length === 1 ? failedSketches[0] :
122-
failedSketches.length > 1 ? 'Multiple Sketches' : 'Unknown';
123-
const searchPattern = 'Arduino Compilation Error';
88+
failedSketches.length > 1 ? 'Multiple Sketches (112025)' : 'Unknown';
89+
const searchPattern = 'Arduino Compilation Error - 112025';
12490
12591
const issueTitle = `Arduino Compilation Error in ${sketchName} (${date})`;
12692
const workflowUrl = '${{ github.server_url }}/' +
12793
'${{ github.repository }}/actions/runs/${{ github.run_id }}';
12894
12995
let detailsSection = '### Details\n';
13096
131-
// TankAlarm-092025 sketches
132-
detailsSection += `#### TankAlarm-092025 (MKR NB 1500)\n`;
133-
detailsSection += `- **Client Sketch:** TankAlarm-092025-Client-Hologram/` +
134-
`TankAlarm-092025-Client-Hologram.ino ${clientFailed ? '❌' : '✅'}\n`;
135-
detailsSection += `- **Server Sketch:** TankAlarm-092025-Server-Hologram/` +
136-
`TankAlarm-092025-Server-Hologram.ino ${serverFailed ? '❌' : '✅'}\n`;
137-
13897
// TankAlarm-112025 sketches
139-
detailsSection += `\n#### TankAlarm-112025 (Arduino Opta)\n`;
98+
detailsSection += `#### TankAlarm-112025 (Arduino Opta)\n`;
14099
detailsSection += `- **Client Sketch:** TankAlarm-112025-Client-BluesOpta/` +
141100
`TankAlarm-112025-Client-BluesOpta.ino ${client112025Failed ? '❌' : '✅'}\n`;
142101
detailsSection += `- **Server Sketch:** TankAlarm-112025-Server-BluesOpta/` +
143102
`TankAlarm-112025-Server-BluesOpta.ino ${server112025Failed ? '❌' : '✅'}\n`;
144103
detailsSection += `- **Viewer Sketch:** TankAlarm-112025-Viewer-BluesOpta/` +
145104
`TankAlarm-112025-Viewer-BluesOpta.ino ${viewer112025Failed ? '❌' : '✅'}\n`;
146105
147-
detailsSection += `\n**Boards:**\n`;
148-
detailsSection += `- Arduino MKR NB 1500 (arduino:samd:mkrnb1500)\n`;
106+
detailsSection += `\n**Board:**\n`;
149107
detailsSection += `- Arduino Opta (arduino:mbed_opta:opta)\n`;
150108
detailsSection += `\n**Triggered by:** ${{ github.event_name }}`;
151109
152-
const issueBody = `## Arduino Compilation Failed
110+
const issueBody = `## Arduino Compilation Failed - TankAlarm 112025
153111
154-
The Arduino code compilation failed in the CI workflow.
112+
The Arduino code compilation failed for the TankAlarm-112025 (Blues Opta) projects.
155113
156114
**Workflow Run:** ${workflowUrl}
157115
**Commit:** ${{ github.sha }}
@@ -200,16 +158,14 @@ jobs:
200158
repo: context.repo.repo,
201159
title: issueTitle,
202160
body: issueBody,
203-
labels: ['arduino', 'compilation-error', 'bug']
161+
labels: ['arduino', 'compilation-error', 'bug', '112025']
204162
});
205163
console.log(`Created issue #${issue.data.number}`);
206164
}
207165
208166
- name: Fail workflow if compilation failed
209167
if: |
210-
steps.compile-client.outcome == 'failure' ||
211-
steps.compile-server.outcome == 'failure' ||
212-
steps.compile-112025-client.outcome == 'failure' ||
213-
steps.compile-112025-server.outcome == 'failure' ||
168+
steps.compile-112025-client.outcome == 'failure' ||
169+
steps.compile-112025-server.outcome == 'failure' ||
214170
steps.compile-112025-viewer.outcome == 'failure'
215171
run: exit 1

0 commit comments

Comments
 (0)