Add CI that builds and runs every example#598
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a comprehensive GitHub Actions CI system to build and (where possible) run every example in this repository against wolfSSL master and the latest stable tag(s), using a manifest-driven matrix so failures are isolated to per-example jobs.
Changes:
- Introduces manifest-driven CI workflows (host/emulated/cross) plus a nightly triage workflow that retries, classifies flakes vs real failures, and can file/update issues.
- Adds Python harness/scripts to generate matrices, enforce “coverage” (no buildable example directory left unaccounted for), run examples with output assertions, and collect artifacts for triage.
- Updates many examples/Makefiles/scripts/fixtures so they build/run reliably under CI (exit statuses, paths to certs, linking flags, regenerated CRL/certs, etc.).
Reviewed changes
Copilot reviewed 62 out of 64 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| X9.146/Makefile | Makefile header tweak for X9.146 examples |
| x509_acert/README.md | Fix build/run instructions and cert paths |
| x509_acert/Makefile | Make OpenSSL prefix optional; adjust lib paths |
| uefi-static/Makefile | Make libgcc/gnu-efi paths less distro-specific |
| tls/server-tls13.c | Ensure successful exit status after shutdown |
| tls/server-tls13-certauth-clienthello.c | Ensure successful exit status after shutdown |
| tls/server-tls-posthsauth.c | Ensure successful exit status after shutdown |
| tls/client-tls13-resume.c | Load client cert/key and CA separately |
| tls/client-tls.c | Load client cert/key and CA separately |
| staticmemory/memory-bucket-optimizer/tester/Makefile | Add include/lib paths for wolfSSL |
| staticmemory/memory-bucket-optimizer/optimizer/Makefile | Add include/lib paths for wolfSSL |
| staticmemory/Makefile | Correct Makefile title/comment |
| signature/sigtest/Makefile | Make OpenSSL path optional and clearer |
| SGX_Linux/sgx_t.mk | Update SGX C++ runtime library name |
| scripts/run-all-examples.sh | Add local manifest-driven runner script |
| psa/Makefile | Fix include path and guard empty PSA_INCLUDE |
| pq/stateful_hash_sig/xmss_example.c | Remove redundant include |
| pq/stateful_hash_sig/lms_example.c | Remove redundant include |
| pq/ml_kem/README.md | Switch build instructions to make |
| pq/ml_kem/ml_kem.c | Update include/header usage; simplify main signature |
| pq/ml_kem/Makefile | Add Makefile for ML-KEM example |
| pq/ml_dsa/ml_dsa.c | Update to FIPS 204 ctx APIs; fix exit code |
| pq/ml_dsa/Makefile | Fix clean target artifacts list |
| pkcs7/scripts/runall.sh | Fix ordering + ensure failures exit non-zero |
| pkcs7/scripts/openssl-verify.sh | Gate on runall, add failure accounting, improve checks |
| pkcs7/Makefile | Correct Makefile title and zlib comment |
| pkcs11/Makefile | Correct Makefile title/comment |
| pk/srp/Makefile | Fix WOLFSSL_INSTALL_DIR prefix |
| pk/enc-through-sign-rsa/rsa-public-decrypt-app.c | Normalize return code from length-returning API |
| embedded/Makefile | Adjust linux-specific target list handling |
| ecc/ecc-params.c | Handle negative lengths; normalize exit status |
| ebpf/tls-uprobe-trace/Makefile | Add wolfSSL include/lib flags |
| dtls/server-dtls-rw-threads.c | Fix cert paths for CI execution |
| dtls/client-dtls-rw-threads.c | Fix cert paths for CI execution |
| custom-io-callbacks/file-server/file-server.c | Fix server return codes / cleanup flow |
| custom-io-callbacks/file-server/check.sh | Make server/client orchestration bounded and reliable |
| custom-io-callbacks/file-client/file-client.c | Fix client return codes |
| crypto/keywrap/Makefile | Add Makefile for keywrap example |
| crypto/aes-modes/aes-xts.c | Fix XTS key halves to be distinct |
| certvfy/Makefile | Add include/lib flags for wolfSSL |
| certs/crl/regenerate-crl.sh | Add script to regenerate CRL fixture |
| certs/crl/crl.pem | Update CRL fixture to unexpired version |
| certmanager/README.md | Fix example invocation name |
| certmanager/certverify.c | Ensure successful exit status |
| certmanager/certloadverifybuffer.c | Update embedded cert fixtures |
| certgen/Makefile | Add Makefile header/comment |
| certgen/csr_w_ed25519_example.c | Normalize return code from length-returning API |
| can-bus/Makefile | Add include/lib flags for wolfSSL |
| can-bus/generate_ssl.sh | Cap CN length to X.509 limits |
| btle/common/btle-sim.c | Ignore SIGPIPE to avoid FIFO-close crashes |
| .gitignore | Ignore new binaries/pycache; fix typo |
| .github/workflows/nightly.yml | Add scheduled nightly orchestration |
| .github/workflows/examples.yml | Add host-tier matrix workflow + coverage gate |
| .github/workflows/emulated.yml | Add emulated-tier workflow (TPM/SGX/CAN/UEFI) |
| .github/workflows/cross-build.yml | Add cross-build workflow (ESP32/Pico/etc.) |
| .github/workflows/ci-triage.yml | Add triage workflow for nightly results |
| .github/workflows/_resolve-wolfssl.yml | Add reusable wolfSSL ref resolution workflow |
| .github/scripts/run_example.py | Add example harness (build/run/assert/output/artifacts) |
| .github/scripts/manifest.py | Add manifest loader + matrix generator + coverage checker |
| .github/scripts/issue_store.py | Add issue identity/body/state machine + scrubbing |
| .github/scripts/ci_triage.py | Add triage logic (retry, classify, issues, AI advisory) |
| .github/examples-manifest.yml | Add source-of-truth manifest for CI coverage/matrix |
| .github/actions/setup-wolfssl/action.yml | Add composite action to build/cache/install wolfSSL |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
56d67ec to
f0f3a18
Compare
0ffccd5 to
f4fd5e6
Compare
| (key, heap, devId)) | ||
| WRAP_VOID(wc_MlDsaKey_Free, (wc_MlDsaKey* key), (key)) | ||
| WRAP_FUNC(int, wc_MlDsaKey_SetParams, (wc_MlDsaKey* key, byte level), (key, level)) | ||
| WRAP_FUNC(int, wc_MlDsaKey_MakeKey, (wc_MlDsaKey* key, WC_RNG* rng), (key, rng)) |
There was a problem hiding this comment.
the context-less sign and verify are only available under WOLFSSL_MLDSA_NO_CTX according to /git/wolfssl/wolfssl/wolfcrypt/wc_mldsa.h
There was a problem hiding this comment.
Thanks! Switched to wc_MlDsaKey_SignCtx/VerifyCtx with an empty context, those are always compiled in.
There was a problem hiding this comment.
AI says these values aren't big enough for RSA 2048, and the check will always fail due to input validation
There was a problem hiding this comment.
Bumped to n[256]/d[256]/p[128]/q[128] so the components fit.
| wolfssl_ref: ${{ fromJson(needs.resolve.outputs.refs_json) }} | ||
| include: | ||
| # uefi-static clones wolfSSL itself; `all` is wolfcrypt.efi | ||
| - example: uefi-static |
There was a problem hiding this comment.
uefi-static is not being run. Seems it needs to be one layer up to be part of the matrix:
| - uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: results-tpm-${{ matrix.simulator }}-attempt${{ github.run_attempt }} |
There was a problem hiding this comment.
AI says there should be another ref here, maybe {{ matrix.ref_slug }}?
same with the --results above
There was a problem hiding this comment.
Added -${{ matrix.wolfssl_ref }} to the --results file and the artifact name.
| steps: | ||
| - id: pick | ||
| run: | | ||
| case "${{ github.event_name }}" in |
There was a problem hiding this comment.
Apparently, the github.event_name is owned by the caller flow, and would be schedule in this case, which would not trigger this action.
There was a problem hiding this comment.
Seems this is still not fixed
There was a problem hiding this comment.
Keys off inputs.caller_run_id now, set by nightly.yml:104, not github.event_name.
| name: CMake | ||
|
|
||
| on: | ||
| push: |
There was a problem hiding this comment.
Lots of on: push and on: pull_request added. Questions:
- Does this trigger 2x runs?
- Can we reduce this? At minimum, add
draft == false
There was a problem hiding this comment.
ya it would run twice if on the same fork I added smoke test on draft and also filters for tests if that examples dir wasn't touched it wont run it on the pr.
There was a problem hiding this comment.
I made it push branches: [master] only so a fork PR fires once. Added draft == false and paths filters.
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - uses: ./.github/actions/apt-update | ||
| - name: Install shellcheck + cppcheck + actionlint |
There was a problem hiding this comment.
lint.sh does not actually use spellcheck
There was a problem hiding this comment.
Added codespell over the repo text.
| out=$("$WORK/wolfcrypt_test" 2>&1) || true | ||
| kill "$simpid" 2>/dev/null || true | ||
| printf '%s\n' "$out" | tail -40 | ||
| printf '%s' "$out" | grep -qiE "Ran wolfCrypt test|Test complete|error test passed" \ |
There was a problem hiding this comment.
AI says this grep will always print success
There was a problem hiding this comment.
Now fails on nonzero rc or missing string (se050-run.sh:97), and the demo returns the test result.
|
General comment: I'd argue the build+test scripts should not live in the CI dir, and should not be shell scripts. Ofc, keep the ones that don't fit that model (eg Android) |
| steps: | ||
| - id: pick | ||
| run: | | ||
| case "${{ github.event_name }}" in |
There was a problem hiding this comment.
Seems this is still not fixed
| makefail="" | ||
| for mk in $(find . -name Makefile -not -path './.git/*' -not -path '*/wolfssl/*' | sort); do | ||
| d=$(dirname "$mk") | ||
| make -n -C "$d" >/dev/null 2>&1 || makefail="$makefail $d" |
There was a problem hiding this comment.
AI sayas this will clone the repo into the tree, and will pollute the lint
| path: ecc | ||
| profile: ecc | ||
| run: | ||
| - exec: [./ecc-key-decode] |
There was a problem hiding this comment.
I think this stuff lives in the example-specific makefiles now, no need to duplicate it here.
In fact, I don't see any make check calls from .github
There was a problem hiding this comment.
run_example.py calls make check per dir now (mode: check) and the duplicated exec/expect is gone. 46 dirs...
| path: crypto/aes-modes | ||
| profile: crypto | ||
| setup: | ||
| - [sh, -c, "printf 'wolfssl-examples aes-modes CI input\\n' > in.txt"] |
There was a problem hiding this comment.
I think we need to create the inputs in the makefiles too. Eg in.txt, mem.log.
There was a problem hiding this comment.
Moved input creation into the check targets, each one is self-contained now.
| authEnvelopedDataKEKRI.der compressedData.der \ | ||
| smime-created.p7s | ||
|
|
||
| check: signedData-stream |
There was a problem hiding this comment.
I think this check is not sufficient to catch a failure. From the .c:
printf("read %d bytes from file\n", encryptedSz);
decryptedSz = signedData_verify(encrypted, encryptedSz,
cert, certSz, key, keySz,
decrypted, decryptedSz);
There was a problem hiding this comment.
Greps 'Successfully verified SignedData bundle' now, which only prints on a passing verify.
| clean: | ||
| rm -f $(TARGETS) | ||
|
|
||
| check: rsa-nb |
There was a problem hiding this comment.
I think this also does not check the verify result
There was a problem hiding this comment.
Added a 'RSA non-block verify successful' print after the XMEMCMP and grep that.
| ./ecc-key-decode | grep -q "Success" | ||
| ./ecc-params | grep -q "Gy: 32" | ||
| ./ecc-sign | grep -q "Firmware Signature 9: Ret 0" | ||
| ./ecc-stack | grep -q "stack used =" |
There was a problem hiding this comment.
AI says that ecc-stack does not return non-zero on make key failure, and this would pass
| .PHONY: all clean check | ||
|
|
||
| check: memory_bucket_optimizer | ||
| ./memory_bucket_optimizer mem.log | grep -q 'Optimization Summary:' |
There was a problem hiding this comment.
AI says this will always pass.
Can you review the Makefiles to make sure they check for actual failure?
There was a problem hiding this comment.
Every check runs under -eo pipefail now, and fixed four grep/SIGPIPE bugs that hid real failures.
| path: tpm | ||
| tier: emulated | ||
| profile: all | ||
| # emulated.yml runs it against wolfTPM's own fwTPM simulator on :2321 |
There was a problem hiding this comment.
AI says this should have a run: field to actually exercise the test. Or should it be build-only?
There was a problem hiding this comment.
good finds, fixing these now
…nputs into the check targets
Adds CI that builds and runs every example against wolfSSL master and the latest stable tag, asserting on real output — not just exit 0 — and fixes the example bugs that blocked those runs from going green.
hashfailing in the nightly aidangarske/wolfssl-examples#2CI
run_example.py+examples-manifest.yml): build → run → assert expected output.Fixes
Each is its own commit:
-1; they now fail when they should.Upstream wolfSSL bugs this CI surfaced
Examples are marked known-fail and gated per ref with
fixed_on; drop the marker when each merges:wc_ecc_verify_hashon a label-generated EC key returnsWC_HW_E(-248): Set label and ID on PKCS11 EC public key wolfssl#10954 (in review)