Skip to content

Commit 1621745

Browse files
committed
Give each cross target its own workflow testing wolfSSL master and latest stable
1 parent f3c18cf commit 1621745

12 files changed

Lines changed: 868 additions & 576 deletions

File tree

.github/scripts/manifest.py

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -89,30 +89,42 @@ def validate(data):
8989

9090

9191
def job_built_paths():
92-
"""Paths some cross-build job actually builds.
92+
"""Paths some cross-tier workflow actually builds.
9393
94-
Read from the workflow rather than declared in the manifest: a manifest that
95-
states its own coverage would just agree with itself.
94+
Read from the workflows rather than declared in the manifest: a manifest
95+
that states its own coverage would just agree with itself.
9696
"""
9797
import yaml
98-
wf = yaml.safe_load((REPO / ".github/workflows/cross-build.yml").read_text())
99-
jobs = wf.get("jobs") or {}
98+
wf_dir = REPO / ".github/workflows"
99+
# one workflow per target, so scan them all rather than a single file
100100
paths = set()
101-
for job in jobs.values():
102-
matrix = ((job.get("strategy") or {}).get("matrix") or {})
103-
for item in matrix.get("example") or []:
104-
paths.add(item)
105-
for item in matrix.get("include") or []:
106-
if item.get("example"):
107-
paths.add(item["example"])
108-
for sk in matrix.get("sketch") or []:
109-
paths.add("Arduino/sketches/" + sk)
101+
jobs_seen = set()
102+
for f in sorted(wf_dir.glob("*.yml")):
103+
try:
104+
wf = yaml.safe_load(f.read_text())
105+
except Exception:
106+
continue
107+
if not isinstance(wf, dict):
108+
continue
109+
for name, job in (wf.get("jobs") or {}).items():
110+
if not isinstance(job, dict):
111+
continue
112+
jobs_seen.add(name)
113+
matrix = ((job.get("strategy") or {}).get("matrix") or {})
114+
for item in matrix.get("example") or []:
115+
if isinstance(item, str):
116+
paths.add(item)
117+
for item in matrix.get("include") or []:
118+
if isinstance(item, dict) and isinstance(item.get("example"), str):
119+
paths.add(item["example"])
120+
for sk in matrix.get("sketch") or []:
121+
if isinstance(sk, str):
122+
paths.add("Arduino/sketches/" + sk)
110123
# jobs that build one hardcoded dir rather than a matrix
111124
for job, path in (("puf", "puf"), ("rpi-pico", "RPi-Pico"),
112125
("fullstack", "fullstack/freertos-wolfip-wolfssl-https"),
113-
("java", "java/https-url"),
114-
("rt1060", "RT1060")):
115-
if job in jobs:
126+
("java", "java/https-url"), ("rt1060", "RT1060")):
127+
if job in jobs_seen:
116128
paths.add(path)
117129
# the pico job builds the whole cmake tree, so its subdirs come with it
118130
pico = REPO / "RPi-Pico/CMakeLists.txt"

.github/workflows/android.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Android
2+
3+
on:
4+
push:
5+
paths:
6+
- 'android/**'
7+
- '.github/workflows/android.yml'
8+
pull_request:
9+
types: [opened, synchronize, reopened, ready_for_review]
10+
schedule:
11+
- cron: '45 6 * * *'
12+
workflow_dispatch:
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
resolve:
23+
uses: ./.github/workflows/_resolve-wolfssl.yml
24+
with:
25+
stable_count: 1
26+
27+
android:
28+
needs: resolve
29+
name: android (${{ matrix.example }}) wolfSSL ${{ matrix.wolfssl_ref }}
30+
runs-on: ubuntu-24.04
31+
timeout-minutes: 40
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
wolfssl_ref: ${{ fromJson(needs.resolve.outputs.refs_json) }}
36+
example:
37+
- android/wolfcryptjni-ndk-gradle
38+
- android/wolfssljni-ndk-gradle
39+
- android/wolfssljni-ndk-sample
40+
steps:
41+
- uses: actions/checkout@v5
42+
with:
43+
submodules: recursive
44+
45+
- uses: actions/setup-java@v4
46+
with:
47+
distribution: temurin
48+
java-version: '17'
49+
50+
# The projects pin wolfssl as a submodule; android/README.md documents
51+
# `git submodule update --remote` for tracking upstream instead. Point it
52+
# at the ref under test so this catches wolfSSL drift like every other job.
53+
- name: Check out the wolfSSL ref under test
54+
run: |
55+
set -euo pipefail
56+
cd '${{ matrix.example }}'
57+
if [ -d wolfssl/.git ]; then
58+
cd wolfssl
59+
git fetch -q --depth 1 origin '${{ matrix.wolfssl_ref }}'
60+
git checkout -q FETCH_HEAD
61+
echo "wolfssl now at ${{ matrix.wolfssl_ref }}: $(git rev-parse --short HEAD)"
62+
fi
63+
64+
# android/README.md step 3: wolfSSL release tarballs ship wolfssl/options.h
65+
# but a GitHub clone does not, and the jni sources include it.
66+
- name: Create the stub options.h the README documents
67+
run: |
68+
set -euo pipefail
69+
cd '${{ matrix.example }}'
70+
if [ -f wolfssl/wolfssl/options.h.in ] && [ ! -f wolfssl/wolfssl/options.h ]; then
71+
cp wolfssl/wolfssl/options.h.in wolfssl/wolfssl/options.h
72+
echo "created wolfssl/wolfssl/options.h"
73+
fi
74+
75+
# These are Studio projects with no instrumentation harness, so a build is
76+
# the honest ceiling.
77+
- name: Build ${{ matrix.example }}
78+
run: |
79+
set -euo pipefail
80+
cd '${{ matrix.example }}'
81+
if [ -f gradlew ]; then
82+
chmod +x gradlew
83+
./gradlew assembleDebug --no-daemon
84+
else
85+
# the older standalone-toolchain sample: Android.mk + ndk-build
86+
"${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}/ndk-build"
87+
fi
88+
89+
- name: Assert an apk or .so came out
90+
run: |
91+
set -euo pipefail
92+
cd '${{ matrix.example }}'
93+
find . \( -name '*.apk' -o -name '*.so' \) | head -n3 | grep -q . \
94+
|| { echo "FAIL: no apk/.so produced"; exit 1; }
95+
find . \( -name '*.apk' -o -name '*.so' \) | head -n3
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Arduino Sketches
2+
3+
on:
4+
push:
5+
paths:
6+
- 'Arduino/sketches/**'
7+
- '.github/workflows/arduino-sketches.yml'
8+
pull_request:
9+
types: [opened, synchronize, reopened, ready_for_review]
10+
schedule:
11+
- cron: '45 6 * * *'
12+
workflow_dispatch:
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
resolve:
23+
uses: ./.github/workflows/_resolve-wolfssl.yml
24+
with:
25+
stable_count: 1
26+
27+
arduino:
28+
needs: resolve
29+
name: arduino (${{ matrix.sketch }}) wolfSSL ${{ matrix.wolfssl_ref }}
30+
runs-on: ubuntu-24.04
31+
timeout-minutes: 30
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
wolfssl_ref: ${{ fromJson(needs.resolve.outputs.refs_json) }}
36+
# board_list.txt excludes nothing on esp32, unlike the avr/samd boards
37+
# (the networking sketches include <WiFi.h>, which only esp32 provides,
38+
# and wolfSSL overflows AVR RAM at 194%).
39+
sketch:
40+
- template
41+
- wolfssl_version
42+
- wolfssl_AES_CTR
43+
- wolfssl_client
44+
- wolfssl_server
45+
- wolfssl_client_dtls
46+
- wolfssl_server_dtls
47+
steps:
48+
- uses: actions/checkout@v5
49+
50+
# sudo drops BINDIR, so let the installer use its default $PWD/bin and put
51+
# that on PATH -- GITHUB_PATH only applies to later steps, hence the split.
52+
- name: Install arduino-cli
53+
run: |
54+
set -euo pipefail
55+
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
56+
echo "$PWD/bin" >> "$GITHUB_PATH"
57+
58+
- name: Install the esp32 core
59+
run: |
60+
set -euo pipefail
61+
arduino-cli config init
62+
arduino-cli config add board_manager.additional_urls \
63+
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
64+
arduino-cli core update-index
65+
arduino-cli core install esp32:esp32
66+
67+
# Generate the Arduino library from wolfSSL source with wolfSSL's own
68+
# script, so this tracks master rather than a published snapshot.
69+
- name: Install the wolfSSL Arduino library
70+
run: |
71+
set -euo pipefail
72+
git clone -q --depth 1 --branch '${{ matrix.wolfssl_ref }}' https://github.com/wolfSSL/wolfssl /tmp/wolfssl
73+
mkdir -p "$HOME/Arduino/libraries"
74+
cd /tmp/wolfssl/IDE/ARDUINO
75+
bash ./wolfssl-arduino.sh INSTALL "$HOME/Arduino/libraries/wolfssl"
76+
test -f "$HOME/Arduino/libraries/wolfssl/src/wolfssl.h" \
77+
|| { echo "FAIL: library not installed"; exit 1; }
78+
79+
- name: Compile ${{ matrix.sketch }}
80+
run: |
81+
set -euo pipefail
82+
cd 'Arduino/sketches/${{ matrix.sketch }}'
83+
arduino-cli compile --fqbn esp32:esp32:esp32 \
84+
--libraries "$HOME/Arduino/libraries" . --warnings none

0 commit comments

Comments
 (0)