Skip to content

Commit 7e65d00

Browse files
authored
Merge pull request #499 from gojimmypi/pr-arduino-examples
Move Arduino examples, add GitHub workflow
2 parents e01d434 + 1aa07ac commit 7e65d00

26 files changed

+3828
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Bug Report
2+
description: File a bug report
3+
title: "[Bug]: "
4+
labels: ["bug", "triage"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: >
9+
Thanks for reporting a bug. If you would prefer a private method,
10+
or if this is a vulnerability report please email [email protected]
11+
instead. This is publicly viewable and not appropriate for vulnerability
12+
reports.
13+
- type: input
14+
id: contact
15+
attributes:
16+
label: Contact Details
17+
description: How can we get in touch with you if we need more info?
18+
placeholder: ex. [email protected]
19+
validations:
20+
required: false
21+
- type: input
22+
id: version
23+
attributes:
24+
label: Version
25+
description: What version were you using?
26+
validations:
27+
required: true
28+
- type: textarea
29+
id: details
30+
attributes:
31+
label: Description
32+
description: |
33+
Describe the issue in detail
34+
Please include:
35+
* Specific `./configure` options or `user_settings.h`
36+
* Target and build environment
37+
placeholder: |
38+
Blinded by the light!
39+
Code runs too fast. It's gone plaid!
40+
...
41+
validations:
42+
required: true
43+
- type: textarea
44+
id: reproduce
45+
attributes:
46+
label: Reproduction steps
47+
description: If possible please give instructions on how to reproduce.
48+
placeholder: |
49+
1. `./configure --enable-42`
50+
2. `make question`
51+
3.
52+
...
53+
validations:
54+
required: false
55+
- type: textarea
56+
id: logs
57+
attributes:
58+
label: Relevant log output
59+
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
60+
render: shell

.github/ISSUE_TEMPLATE/other.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: General Issue
2+
description: Request support with an issue
3+
labels: ["triage"]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: >
8+
Thanks for reporting an issue. If you would prefer a private method,
9+
or if this is a vulnerability report please email [email protected]
10+
instead. This is publicly viewable and not appropriate for vulnerability
11+
reports.
12+
- type: input
13+
id: version
14+
attributes:
15+
label: Version
16+
description: What version were you using?
17+
validations:
18+
required: true
19+
- type: textarea
20+
id: details
21+
attributes:
22+
label: Description
23+
description: |
24+
Describe the issue in detail.
25+
Please include specific configuration options or user_settings.h
26+
placeholder: |
27+
`./configure --enable-world-domination` fails
28+
...
29+
validations:
30+
required: true

.github/workflows/arduino.yml

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
name: Arduino CI Build
2+
3+
# See https://github.com/wolfSSL/Arduino-wolfSSL
4+
5+
# START OF COMMON SECTION
6+
on:
7+
push:
8+
branches: [ 'master', 'main', 'release/**' ]
9+
pull_request:
10+
branches: [ '*' ]
11+
workflow_dispatch:
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
# END OF COMMON SECTION
17+
18+
jobs:
19+
build:
20+
if: github.repository_owner == 'wolfssl'
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout Repository
24+
uses: actions/checkout@v4
25+
26+
- name: Install Arduino CLI
27+
run: |
28+
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
29+
echo "$(pwd)/bin" >> $GITHUB_PATH
30+
31+
- name: Setup Arduino CLI
32+
run: |
33+
arduino-cli config init
34+
arduino-cli core update-index
35+
arduino-cli config add board_manager.additional_urls https://www.pjrc.com/teensy/package_teensy_index.json
36+
arduino-cli core update-index
37+
arduino-cli config add board_manager.additional_urls https://arduino.esp8266.com/stable/package_esp8266com_index.json
38+
arduino-cli core update-index
39+
arduino-cli core install esp32:esp32 # ESP32
40+
arduino-cli core install arduino:avr # Arduino Uno, Mega, Nano
41+
arduino-cli core install arduino:sam # Arduino Due
42+
arduino-cli core install arduino:samd # Arduino Zero
43+
arduino-cli core install teensy:avr # PJRC Teensy
44+
arduino-cli core install esp8266:esp8266 # ESP8266
45+
arduino-cli lib install "ArduinoJson" # Example dependency
46+
arduino-cli lib install "WiFiNINA" # ARDUINO_SAMD_NANO_33_IOT
47+
arduino-cli lib install "Ethernet" # Install Ethernet library
48+
49+
# arduino-cli lib install "wolfSSL" # Install wolfSSL library from Arduino
50+
51+
# Install current wolfSSL as an Arduino library:
52+
- name: Shallow clone wolfssl
53+
run: |
54+
git clone --depth 1 https://github.com/wolfSSL/wolfssl.git
55+
echo "Checking Arduino library directories..."
56+
57+
- name: Install wolfSSL Arduino library
58+
run: |
59+
pushd wolfssl/IDE/ARDUINO
60+
61+
# Set default ARDUINO_ROOT. TODO: once script is updated, this should be removed.
62+
export ARDUINO_ROOT="$HOME/Arduino/libraries"
63+
64+
bash wolfssl-arduino.sh INSTALL # Install wolfSSL library
65+
popd
66+
67+
# This will fail with Arduino published wolfSSL v5.7.6 and older
68+
# See https://github.com/wolfSSL/wolfssl/pull/8514
69+
# Pending: "arduino:sam:arduino_due_x"
70+
- name: Compile Arduino Sketches for various boards
71+
run: |
72+
set +e
73+
SUCCESS=true
74+
for BOARD in "arduino:avr:uno" "esp32:esp32:esp32" "arduino:avr:mega" "arduino:avr:nano" "arduino:samd:arduino_zero_native" "esp8266:esp8266:generic" "teensy:avr:teensy40"; do
75+
echo "Compiling for $BOARD"
76+
for EXAMPLE in $(find Arduino/sketches -mindepth 1 -maxdepth 1 -type d); do
77+
78+
# skip known no-wifi SAMD boards
79+
if [[ "$BOARD" =~ "arduino:samd:arduino_zero_native" && ( "$EXAMPLE" =~ "wolfssl_server" || "$EXAMPLE" =~ "wolfssl_client" || "$EXAMPLE" =~ "test" ) ]]; then
80+
echo "Skipping $EXAMPLE for $BOARD (No WiFi support)"
81+
continue
82+
fi
83+
84+
# skip known no-wifi AVR boards
85+
if [[ "$BOARD" =~ ^arduino:avr:(uno|mega|nano)$ ]] && \
86+
( [[ "$EXAMPLE" =~ "wolfssl_server" ]] || \
87+
[[ "$EXAMPLE" =~ "wolfssl_client" ]] || \
88+
[[ "$EXAMPLE" =~ "test" ]] ); then
89+
echo "Skipping $EXAMPLE for $BOARD (No WiFi support)"
90+
continue
91+
fi
92+
93+
# skip known no-wifi teensy AVR boards
94+
if [[ "$BOARD" =~ ^teensy:avr:(teensy40)$ ]] && \
95+
( [[ "$EXAMPLE" =~ "wolfssl_server" ]] || \
96+
[[ "$EXAMPLE" =~ "wolfssl_client" ]] || \
97+
[[ "$EXAMPLE" =~ "test" ]] ); then
98+
echo "Skipping $EXAMPLE for $BOARD (needs ethernet update)"
99+
continue
100+
fi
101+
102+
# skip examples other than template and version for known tiny memory boards
103+
if [[ "$BOARD" =~ ( "arduino:avr:uno"|"arduino:avr:nano" ) && ( "$EXAMPLE" != "template" ) && ( "$EXAMPLE" != "wolfssl_version" ) ]]; then
104+
echo "Skipping $EXAMPLE for $BOARD (memory limited)"
105+
continue
106+
fi
107+
108+
# TODO: new template known to fail. Fixed in https://github.com/wolfSSL/wolfssl/pull/8514
109+
if [[ "$EXAMPLE" =~ "Arduino/sketches/template" ]]; then
110+
echo "Skipping $EXAMPLE for $BOARD (needs code update. see wolfssl/pull/8514)"
111+
continue
112+
fi
113+
114+
# TODO: new wolfssl_AES_CTR known to fail. Fixed in https://github.com/wolfSSL/wolfssl/pull/8514
115+
if [[ "$EXAMPLE" =~ "Arduino/sketches/wolfssl_AES_CTR" ]]; then
116+
echo "Skipping $EXAMPLE for $BOARD (needs updated user_settings.h - see wolfssl/pull/8514)"
117+
continue
118+
fi
119+
120+
# TODO skip Compiling Arduino/sketches/wolfssl_version for arduino:avr:mega
121+
if [[ "$BOARD" =~ "arduino:avr:mega" && "$EXAMPLE" =~ "Arduino/sketches/wolfssl_version" ]]; then
122+
echo "Skipping $EXAMPLE for $BOARD (needs updated code - see wolfssl/pull/8514)"
123+
continue
124+
fi
125+
126+
# TODO skip Compiling Arduino/sketches/wolfssl_version for arduino:avr:uno
127+
if [[ "$BOARD" =~ ^arduino:avr:(uno|mega|nano)$ ]] && \
128+
( [[ "$EXAMPLE" =~ "wolfssl_version" ]] ); then
129+
echo "Skipping $EXAMPLE for $BOARD (fixed in see wolfssl/pull/8514)"
130+
continue
131+
fi
132+
133+
if [[ "$BOARD" =~ "arduino:avr:uno" && "$EXAMPLE" =~ "Arduino/sketches/wolfssl_version" ]]; then
134+
echo "Skipping $EXAMPLE for $BOARD (needs updated code - see wolfssl/pull/8514)"
135+
continue
136+
fi
137+
138+
# TODO skip ESP8266
139+
if [[ "$BOARD" =~ "esp8266:esp8266:generic" ]]; then
140+
echo "Skipping $EXAMPLE for $BOARD (needs testing)"
141+
continue
142+
fi
143+
144+
# If otherwise not excluded, compile this $EXAMPLE for this $BOARD
145+
echo "Compiling $EXAMPLE for $BOARD"
146+
arduino-cli compile --fqbn $BOARD "$EXAMPLE"
147+
EXIT_CODE=$?
148+
if [ "$EXIT_CODE" -ne 0 ]; then
149+
echo "❌ Compilation failed for $EXAMPLE on $BOARD (Exit code: $EXIT_CODE)"
150+
SUCCESS=false
151+
else
152+
echo "✅ Compilation succeeded for $EXAMPLE on $BOARD"
153+
fi
154+
done
155+
done
156+
157+
if [ "$SUCCESS" = true ]; then
158+
echo "✅ All sketches compiled successfully!"
159+
else
160+
echo "❌ One or more sketches failed to compile."
161+
exit 1
162+
fi
163+
164+
- name: Upload Compilation Artifacts
165+
uses: actions/upload-artifact@v4
166+
with:
167+
name: compiled-sketch
168+
path: Arduino/sketches/template/build/*

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,3 +369,9 @@ tpm/evp_tpm
369369

370370
# MacOS
371371
.DS_Store
372+
373+
# Arduino exclusions
374+
/Arduino/**/*.bak
375+
/Arduino/**/Output/*
376+
/Arduino/**/TraceReports/*
377+
/Arduino/**/.visualgdb/*

0 commit comments

Comments
 (0)