Skip to content

Commit 6daeb99

Browse files
committed
copy from dev-workflow-test
1 parent 67d2f37 commit 6daeb99

File tree

2 files changed

+94
-87
lines changed

2 files changed

+94
-87
lines changed

.github/workflows/arduino-release.yml

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,18 @@ concurrency:
7878
jobs:
7979
build:
8080
name: Release Compile (${{ matrix.fqbn }})
81-
if: github.repository_owner == 'wolfssl'
81+
# if: github.repository_owner == 'wolfssl'
8282
runs-on: ubuntu-latest
8383

8484
strategy:
8585
fail-fast: false
8686
matrix:
8787
fqbn:
88+
# When editing this list, be sure to also edit file: board_list.txt
89+
# The compile-all-examples.sh optionally takes a FQBN parameter to
90+
# optionally compile all examples ONLY for the respective fully qualified board name.
91+
# See https://github.com/wolfSSL/wolfssl-examples/blob/master/Arduino/sketches/board_list.txt
92+
8893
- arduino:avr:ethernet
8994
- arduino:avr:leonardoeth
9095
- arduino:avr:mega
@@ -126,7 +131,7 @@ jobs:
126131
run: |
127132
# Script to fetch and run install.sh from arduino/arduino-cli
128133
129-
# The install script will test to see if the recently installed apps in in the path
134+
# The install script will test to see if the recently installed apps in the path
130135
# So set it up in advance:
131136
mkdir -p "${PWD}/bin"
132137
echo "${PWD}/bin" >> $GITHUB_PATH
@@ -137,7 +142,7 @@ jobs:
137142
# Ensures that BINDIR exists before the installer runs
138143
mkdir -p "$ROOT_BIN"
139144
140-
# Save as a lobal environment variable
145+
# Save as a global environment variable
141146
echo "$ROOT_BIN" >> "$GITHUB_PATH"
142147
143148
# Download and run install script from Arduino:
@@ -168,9 +173,14 @@ jobs:
168173
echo "Alternative install script not needed."
169174
fi
170175
171-
- name: Confirm Arduino CLI install
176+
- name: Confirm Arduino CLI Install
172177
run: arduino-cli version
173178

179+
- name: Derive CORE_ID (vendor:arch from FQBN)
180+
run: |
181+
CORE_ID="$(echo '${{ matrix.fqbn }}' | cut -d: -f1-2)"
182+
echo "CORE_ID=$CORE_ID" >> "$GITHUB_ENV"
183+
174184
- name: Setup Arduino CLI
175185
run: |
176186
arduino-cli config init
@@ -182,29 +192,34 @@ jobs:
182192
arduino-cli config add board_manager.additional_urls https://arduino.esp8266.com/stable/package_esp8266com_index.json
183193
arduino-cli core update-index
184194
185-
# mbed nano not yet tested
186-
# sudo "/home/$USER/.arduino15/packages/arduino/hardware/mbed_nano/4.2.4/post_install.sh"
187-
188-
# Install upported boards:
189-
arduino-cli core install esp32:esp32 # ESP32
190-
arduino-cli core install esp8266:esp8266 # ESP8266
195+
echo "CORE_ID: $CORE_ID"
196+
arduino-cli core install "$CORE_ID"
191197
192-
arduino-cli core install teensy:avr # PJRC Teensy
198+
# The above is instead of:
199+
# arduino-cli core install esp32:esp32 # ESP32
200+
# arduino-cli core install arduino:avr # Arduino Uno, Mega, Nano
201+
# arduino-cli core install arduino:sam # Arduino Due
202+
# arduino-cli core install arduino:samd # Arduino Zero
203+
# arduino-cli core install teensy:avr # PJRC Teensy
204+
# arduino-cli core install esp8266:esp8266 # ESP8266
205+
# arduino-cli core install arduino:mbed_nano # nanorp2040connect
206+
# arduino-cli core install arduino:mbed_portenta # portenta_h7_m7
207+
# arduino-cli core install arduino:mbed_edge
208+
# arduino-cli core install arduino:renesas_uno
193209
194-
arduino-cli core install arduino:avr # Arduino Uno, Mega, Nano
195-
arduino-cli core install arduino:sam # Arduino Due
196-
arduino-cli core install arduino:samd # Arduino Zero
197-
arduino-cli core install arduino:mbed_nano # nanorp2040connect
198-
arduino-cli core install arduino:mbed_portenta # portenta_h7_m7
199-
arduino-cli core install arduino:mbed_edge
200-
arduino-cli core install arduino:renesas_uno
210+
# For reference:
201211
212+
# mbed nano not yet tested
213+
# sudo "/home/$USER/.arduino15/packages/arduino/hardware/mbed_nano/4.2.4/post_install.sh"
214+
215+
# Always install networking (not part of FQBN matrix)
216+
# The first one also creates directory: /home/runner/Arduino/libraries
202217
arduino-cli lib install "ArduinoJson" # Example dependency
203218
arduino-cli lib install "WiFiNINA" # ARDUINO_SAMD_NANO_33_IOT
204219
arduino-cli lib install "Ethernet" # Install Ethernet library
205220
arduino-cli lib install "Bridge" # Pseudo-network for things like arduino:samd:tian
206221

207-
- name: Set job environment variables
222+
- name: Set Job Environment Variables
208223
run: |
209224
# Script to assign some common environment variables after everything is installed
210225
@@ -230,33 +245,25 @@ jobs:
230245
# WOLFSSL_EXAMPLES_ROOT is the report root, not example location
231246
echo "WOLFSSL_EXAMPLES_ROOT = $WOLFSSL_EXAMPLES_ROOT"
232247
233-
- name: Compute cache key parts
234-
id: parts
235-
shell: bash
236-
run: |
237-
# From FQBN "vendor:arch:board" get "vendor:arch"
238-
CORE_ID="$(echo "${{ matrix.fqbn }}" | awk -F: '{print $1 ":" $2}')"
239-
echo "CORE_ID=$CORE_ID" >> "$GITHUB_OUTPUT"
240-
241-
# Also expose vendor only for broad fallbacks
242-
VENDOR="$(echo "$CORE_ID" | cut -d: -f1)"
243-
echo "VENDOR=$VENDOR" >> "$GITHUB_OUTPUT"
244-
245-
- name: Cache Arduino packages
248+
- name: Cache Arduino Packages
246249
uses: actions/cache@v4
247250
with:
248251
path: |
249252
~/.arduino15
253+
~/.cache/arduino
250254
~/.arduino15/staging
251255
252256
# Arduino libraries
253257
# Specific to Arduino CI Build (2 of 4) Arduinbo Release wolfSSL for Local Examples
254258
# Include all libraries, as the latest Arduino-wolfSSL will only change upon release.
255259
~/Arduino/libraries
260+
# Ensure wolfssl is not cached, we're always using the latest. See separate cache.
261+
!~/Arduino/libraries/wolfssl
262+
key: arduino-${{ runner.os }}-${{ env.CORE_ID }}-${{ hashFiles('Arduino/sketches/board_list.txt') }}
256263

257-
key: arduino-${{ runner.os }}-${{ hashFiles('**/arduino-cores.lock') }}
258264
restore-keys: |
259-
arduino-${{ runner.os }}-
265+
arduino-${{ runner.os }}-${{ env.CORE_ID }}-
266+
arduino-${{ runner.os }}-
260267
261268
- name: Show wolfssl-examples
262269
run: |
@@ -305,7 +312,7 @@ jobs:
305312
chmod +x ./compile-all-examples.sh
306313
307314
# The script expects all the examples to be in the current directory.
308-
# So copy from local directory to newly instlled wolfssl arduino library to compile there.
315+
# So copy from local directory to newly installed wolfssl arduino library to compile there.
309316
cp ./compile-all-examples.sh "$ARDUINO_ROOT/wolfssl/examples/compile-all-examples.sh"
310317
cp ./board_list.txt "$ARDUINO_ROOT/wolfssl/examples/board_list.txt"
311318

.github/workflows/arduino.yml

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,25 @@ on:
6464
concurrency:
6565
# Same branch push cancels other jobs. Other PR branches untouched
6666

67-
group: ${{ github.workflow }}-${{ github.ref }}
67+
group: ${{ github.workflow }}-${{ github.ref_name }}
6868
cancel-in-progress: true
6969

7070
# END OF COMMON SECTION
7171

7272
jobs:
7373
build:
74-
name: Latest Compile (${{ matrix.fqbn }})
75-
if: github.repository_owner == 'wolfssl'
74+
name: Compile (${{ matrix.fqbn }})
75+
# if: github.repository_owner == 'wolfssl'
7676
runs-on: ubuntu-latest
7777

7878
strategy:
7979
fail-fast: false
8080
matrix:
8181
fqbn:
82-
- arduino:avr:ethernet
82+
# When editing this list, be sure to also edit file: board_list.txt
83+
# The compile-all-examples.sh optionally takes a FQBN parameter to
84+
# optionally compile all examples ONLY for the respective fully qualified board name.
85+
# See https://github.com/wolfSSL/wolfssl-examples/blob/master/Arduino/sketches/board_list.txt
8386
- arduino:avr:leonardoeth
8487
- arduino:avr:mega
8588
- arduino:avr:nano
@@ -120,7 +123,7 @@ jobs:
120123
run: |
121124
# Script to fetch and run install.sh from arduino/arduino-cli
122125
123-
# The install script will test to see if the recently installed apps in in the path
126+
# The install script will test to see if the recently installed apps in the path
124127
# So set it up in advance:
125128
mkdir -p "${PWD}/bin"
126129
echo "${PWD}/bin" >> $GITHUB_PATH
@@ -131,7 +134,7 @@ jobs:
131134
# Ensures that BINDIR exists before the installer runs
132135
mkdir -p "$ROOT_BIN"
133136
134-
# Save as a lobal environment variable
137+
# Save as a global environment variable
135138
echo "$ROOT_BIN" >> "$GITHUB_PATH"
136139
137140
# Download and run install script from Arduino:
@@ -162,9 +165,14 @@ jobs:
162165
echo "Alternative install script not needed."
163166
fi
164167
165-
- name: Confirm Arduino CLI install
168+
- name: Confirm Arduino CLI Install
166169
run: arduino-cli version
167170

171+
- name: Derive CORE_ID (vendor:arch from FQBN)
172+
run: |
173+
CORE_ID="$(echo '${{ matrix.fqbn }}' | cut -d: -f1-2)"
174+
echo "CORE_ID=$CORE_ID" >> "$GITHUB_ENV"
175+
168176
- name: Setup Arduino CLI
169177
run: |
170178
arduino-cli config init
@@ -176,29 +184,34 @@ jobs:
176184
arduino-cli config add board_manager.additional_urls https://arduino.esp8266.com/stable/package_esp8266com_index.json
177185
arduino-cli core update-index
178186
179-
# mbed nano not yet tested
180-
# sudo "/home/$USER/.arduino15/packages/arduino/hardware/mbed_nano/4.2.4/post_install.sh"
181-
182-
# Install upported boards:
183-
arduino-cli core install esp32:esp32 # ESP32
184-
arduino-cli core install esp8266:esp8266 # ESP8266
187+
echo "CORE_ID: $CORE_ID"
188+
arduino-cli core install "$CORE_ID"
185189
186-
arduino-cli core install teensy:avr # PJRC Teensy
190+
# The above is instead of:
191+
# arduino-cli core install esp32:esp32 # ESP32
192+
# arduino-cli core install arduino:avr # Arduino Uno, Mega, Nano
193+
# arduino-cli core install arduino:sam # Arduino Due
194+
# arduino-cli core install arduino:samd # Arduino Zero
195+
# arduino-cli core install teensy:avr # PJRC Teensy
196+
# arduino-cli core install esp8266:esp8266 # ESP8266
197+
# arduino-cli core install arduino:mbed_nano # nanorp2040connect
198+
# arduino-cli core install arduino:mbed_portenta # portenta_h7_m7
199+
# arduino-cli core install arduino:mbed_edge
200+
# arduino-cli core install arduino:renesas_uno
187201
188-
arduino-cli core install arduino:avr # Arduino Uno, Mega, Nano
189-
arduino-cli core install arduino:sam # Arduino Due
190-
arduino-cli core install arduino:samd # Arduino Zero
191-
arduino-cli core install arduino:mbed_nano # nanorp2040connect
192-
arduino-cli core install arduino:mbed_portenta # portenta_h7_m7
193-
arduino-cli core install arduino:mbed_edge
194-
arduino-cli core install arduino:renesas_uno
202+
# For reference:
195203
204+
# mbed nano not yet tested
205+
# sudo "/home/$USER/.arduino15/packages/arduino/hardware/mbed_nano/4.2.4/post_install.sh"
206+
207+
# Always install networking (not part of FQBN matrix)
208+
# The first one also creates directory: /home/runner/Arduino/libraries
196209
arduino-cli lib install "ArduinoJson" # Example dependency
197210
arduino-cli lib install "WiFiNINA" # ARDUINO_SAMD_NANO_33_IOT
198211
arduino-cli lib install "Ethernet" # Install Ethernet library
199212
arduino-cli lib install "Bridge" # Pseudo-network for things like arduino:samd:tian
200213

201-
- name: Set job environment variables
214+
- name: Set Job Environment Variables
202215
run: |
203216
# Script to assign some common environment variables after everything is installed
204217
@@ -224,36 +237,25 @@ jobs:
224237
# WOLFSSL_EXAMPLES_ROOT is the report root, not example location
225238
echo "WOLFSSL_EXAMPLES_ROOT = $WOLFSSL_EXAMPLES_ROOT"
226239
227-
- name: Compute cache key parts
228-
id: parts
229-
shell: bash
230-
run: |
231-
# From FQBN "vendor:arch:board" get "vendor:arch"
232-
CORE_ID="$(echo "${{ matrix.fqbn }}" | awk -F: '{print $1 ":" $2}')"
233-
echo "CORE_ID=$CORE_ID" >> "$GITHUB_OUTPUT"
234-
235-
# Also expose vendor only for broad fallbacks
236-
VENDOR="$(echo "$CORE_ID" | cut -d: -f1)"
237-
echo "VENDOR=$VENDOR" >> "$GITHUB_OUTPUT"
238-
239-
- name: Cache Arduino packages
240+
- name: Cache Arduino Packages
240241
uses: actions/cache@v4
241242
with:
242243
path: |
243244
~/.arduino15
245+
~/.cache/arduino
244246
~/.arduino15/staging
245247
246248
# Arduino libraries
247-
# Specific to Arduino CI Build (3 of 4) Latest wolfSSL for Local Examples
248-
# Include only explicit libraries, but NOT wolfssl as we are installing latest here (cache by SHA, see below)
249-
~/Arduino/libraries/ArduinoJson
250-
~/Arduino/libraries/WiFiNINA
251-
~/Arduino/libraries/Ethernet
252-
~/Arduino/libraries/Bridge
253-
254-
key: arduino-${{ runner.os }}-${{ hashFiles('**/arduino-cores.lock') }}
249+
# Specific to Arduino CI Build (2 of 4) Arduinbo Release wolfSSL for Local Examples
250+
# Include all libraries, as the latest Arduino-wolfSSL will only change upon release.
251+
~/Arduino/libraries
252+
# Ensure wolfssl is not cached, we're always using the latest. See separate cache.
253+
!~/Arduino/libraries/wolfssl
254+
key: arduino-${{ runner.os }}-${{ env.CORE_ID }}-${{ hashFiles('Arduino/sketches/board_list.txt') }}
255+
255256
restore-keys: |
256-
arduino-${{ runner.os }}-
257+
arduino-${{ runner.os }}-${{ env.CORE_ID }}-
258+
arduino-${{ runner.os }}-
257259
258260
- name: Show wolfssl-examples
259261
run: |
@@ -262,10 +264,9 @@ jobs:
262264
263265
# end Show wolfssl-examples
264266
265-
# Specific to Arduino CI Build (3 of 4) Latest wolfSSL for Local Examples
266-
- name: Shallow clone wolfssl
267+
- name: Shallow Clone wolfssl
267268
run: |
268-
# Clone the wolfssl to use for example build
269+
# Clone the latest wolfssl to use for building examples
269270
270271
git clone --depth 1 https://github.com/$REPO_OWNER/wolfssl.git
271272
@@ -287,12 +288,10 @@ jobs:
287288
fi
288289
# end wolfssl source
289290
290-
- name: Get wolfSSL commit
291+
- name: Get wolfSSL Commit
291292
id: wolfsha
292293
run: echo "sha=$(git -C wolfssl rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
293294

294-
# Specific to Arduino CI Build (3 of 4) Latest wolfSSL for Local Examples
295-
# We cache only THIS most recent install of wolfSSL (not a release)
296295
- name: Cache wolfSSL Arduino library
297296
id: cache-wolfssl
298297
uses: actions/cache@v4
@@ -356,11 +355,12 @@ jobs:
356355
chmod +x ./compile-all-examples.sh
357356
358357
# The script expects all the examples to be in the current directory.
359-
# So copy from local directory to newly instlled wolfssl arduino library to compile there.
358+
# So copy from local directory to newly installed wolfssl arduino library to compile there.
360359
cp ./compile-all-examples.sh "$ARDUINO_ROOT/wolfssl/examples/compile-all-examples.sh"
361360
cp ./board_list.txt "$ARDUINO_ROOT/wolfssl/examples/board_list.txt"
362361
363-
# Compile the Arduino library examples in-place
362+
# Compile the Arduino library examples in-place. All examples compiled for FQBN
363+
# The respective FQBN board, examples, and optional exclusions must be in board_list.txt
364364
pushd "$ARDUINO_ROOT/wolfssl/examples/"
365365
echo "PWD=$PWD"
366366
./compile-all-examples.sh ./board_list.txt "${{ matrix.fqbn }}"

0 commit comments

Comments
 (0)