Skip to content

Commit f883dd5

Browse files
committed
Update integration test to use cli-compile-flags input
A sketch was added that is designed to fail compilation if the `arduino-cli compile` command does not contain the flags specified via the input. Because the `--build-property` flag used in the test was not present in Arduino CLI 0.13.0 (the equivalent flag was `--build-properties` at that time), it was necessary to update the Arduino CLI version used by the action in the test.
1 parent 12e9ad0 commit f883dd5

File tree

4 files changed

+126
-7
lines changed

4 files changed

+126
-7
lines changed

.github/workflows/test-integration.yml

+12-3
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ on:
44
pull_request:
55
paths:
66
- '.github/workflows/test-integration.yml'
7-
- '.github/workflows/testdata'
7+
- '.github/workflows/testdata/**'
88
- 'action.yml'
99
- 'action-setup.sh'
1010
- 'compilesketches/**'
1111

1212
push:
1313
paths:
1414
- '.github/workflows/test-integration.yml'
15-
- '.github/workflows/testdata'
15+
- '.github/workflows/testdata/**'
1616
- 'action.yml'
1717
- 'action-setup.sh'
1818
- 'compilesketches/**'
@@ -78,18 +78,27 @@ jobs:
7878
# Use action from local path
7979
uses: ./
8080
with:
81-
cli-version: 0.13.0
81+
cli-version: 0.15.1
8282
platforms: ${{ matrix.board.platforms }}
8383
fqbn: ${{ matrix.board.fqbn }}
8484
libraries: ${{ matrix.board.libraries }}
8585
sketch-paths: |
8686
- ${{ env.TESTDATA_SKETCHES_PATH }}/BareMinimum
8787
- ${{ env.TESTDATA_SKETCHES_PATH }}/ServoLibrary
88+
- ${{ env.TESTDATA_SKETCHES_PATH }}/TestCompileFlags
89+
cli-compile-flags: |
90+
- --build-property
91+
- compiler.cpp.extra_flags="-DSTRING_MACRO="hello world"" -DINT_MACRO=2 -DFLAG_MACRO
92+
- --export-binaries
8893
enable-deltas-report: true
8994
enable-warnings-report: true
9095
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
9196
verbose: true
9297

98+
- name: Verify --export-binaries flag was used by compilation command
99+
run: |
100+
[ -d ${{ env.TESTDATA_SKETCHES_PATH }}/BareMinimum/build ]
101+
93102
- name: Set report artifact name
94103
id: report-artifact-name
95104
run: |

.github/workflows/testdata/reports/all-inputs/arduino-avr-uno.json

+51-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"commit_hash": "d4343a2e7d8123726f2c53d2ac186df41b59e946",
3-
"commit_url": "https://github.com/arduino/compile-sketches/commit/d4343a2e7d8123726f2c53d2ac186df41b59e946",
2+
"commit_hash": "d2ed774ec1f37e6e497b6d629963cbc79632e9f9",
3+
"commit_url": "https://github.com/arduino/compile-sketches/commit/d2ed774ec1f37e6e497b6d629963cbc79632e9f9",
44
"boards": [
55
{
66
"board": "arduino:avr:uno",
@@ -102,6 +102,55 @@
102102
"absolute": 0
103103
}
104104
}
105+
},
106+
{
107+
"name": ".github/workflows/testdata/sketches/TestCompileFlags",
108+
"compilation_success": true,
109+
"sizes": [
110+
{
111+
"name": "flash",
112+
"maximum": 32256,
113+
"current": {
114+
"absolute": 444,
115+
"relative": 1.38
116+
},
117+
"previous": {
118+
"absolute": 444,
119+
"relative": 1.38
120+
},
121+
"delta": {
122+
"absolute": 0,
123+
"relative": 0.0
124+
}
125+
},
126+
{
127+
"name": "RAM for global variables",
128+
"maximum": 2048,
129+
"current": {
130+
"absolute": 9,
131+
"relative": 0.44
132+
},
133+
"previous": {
134+
"absolute": 9,
135+
"relative": 0.44
136+
},
137+
"delta": {
138+
"absolute": 0,
139+
"relative": 0.0
140+
}
141+
}
142+
],
143+
"warnings": {
144+
"current": {
145+
"absolute": 1
146+
},
147+
"previous": {
148+
"absolute": 1
149+
},
150+
"delta": {
151+
"absolute": 0
152+
}
153+
}
105154
}
106155
],
107156
"sizes": [

.github/workflows/testdata/reports/all-inputs/esp8266-esp8266-huzzah.json

+51-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"commit_hash": "d4343a2e7d8123726f2c53d2ac186df41b59e946",
3-
"commit_url": "https://github.com/arduino/compile-sketches/commit/d4343a2e7d8123726f2c53d2ac186df41b59e946",
2+
"commit_hash": "d2ed774ec1f37e6e497b6d629963cbc79632e9f9",
3+
"commit_url": "https://github.com/arduino/compile-sketches/commit/d2ed774ec1f37e6e497b6d629963cbc79632e9f9",
44
"boards": [
55
{
66
"board": "esp8266:esp8266:huzzah",
@@ -102,6 +102,55 @@
102102
"absolute": 0
103103
}
104104
}
105+
},
106+
{
107+
"name": ".github/workflows/testdata/sketches/TestCompileFlags",
108+
"compilation_success": true,
109+
"sizes": [
110+
{
111+
"name": "flash",
112+
"maximum": 1044464,
113+
"current": {
114+
"absolute": 256684,
115+
"relative": 24.58
116+
},
117+
"previous": {
118+
"absolute": 256684,
119+
"relative": 24.58
120+
},
121+
"delta": {
122+
"absolute": 0,
123+
"relative": 0.0
124+
}
125+
},
126+
{
127+
"name": "RAM for global variables",
128+
"maximum": 81920,
129+
"current": {
130+
"absolute": 26776,
131+
"relative": 32.69
132+
},
133+
"previous": {
134+
"absolute": 26776,
135+
"relative": 32.69
136+
},
137+
"delta": {
138+
"absolute": 0,
139+
"relative": 0.0
140+
}
141+
}
142+
],
143+
"warnings": {
144+
"current": {
145+
"absolute": 1
146+
},
147+
"previous": {
148+
"absolute": 1
149+
},
150+
"delta": {
151+
"absolute": 0
152+
}
153+
}
105154
}
106155
],
107156
"sizes": [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#if INT_MACRO != 2
2+
#error
3+
#endif
4+
5+
#ifndef FLAG_MACRO
6+
#error
7+
#endif
8+
9+
void setup() {
10+
char string[]=STRING_MACRO; // Will fail if the macro is not a string literal
11+
}
12+
void loop(){}

0 commit comments

Comments
 (0)