88
99jobs :
1010 test-lib :
11+ # If jobs cancel, consider pinning to ubuntu-24.04
12+ # The ubuntu-latest alias can point to different images during migrations (and sometimes be extra busy),
13+ # while ubuntu-24.04 always targets the 24.04 pool
1114 runs-on : ubuntu-latest
15+
16+ # The timeout is run time after a runner starts, not time in queue
1217 timeout-minutes : 15
1318
1419 strategy :
1520 fail-fast : false
21+
22+ # Limit concurrent jobs for scheduling problem on GitHub's hosted runner pool.
23+ max-parallel : 12
24+
1625 matrix :
17- math : [SPMATH=1 WOLFBOOT_SMALL_STACK=0,
18- SPMATH=1 WOLFBOOT_SMALL_STACK=1,
19- SPMATHALL=1 WOLFBOOT_SMALL_STACK=0,
20- SPMATHALL=1 WOLFBOOT_SMALL_STACK=1,
21- SPMATH=0 SPMATHALL=0 WOLFBOOT_SMALL_STACK=0,
22- SPMATH=0 SPMATHALL=0 WOLFBOOT_SMALL_STACK=1]
26+ math :
27+ - " SPMATH=1 WOLFBOOT_SMALL_STACK=0"
28+ - " SPMATH=1 WOLFBOOT_SMALL_STACK=1"
29+ - " SPMATHALL=1 WOLFBOOT_SMALL_STACK=0"
30+ - " SPMATHALL=1 WOLFBOOT_SMALL_STACK=1"
31+ - " SPMATH=0 SPMATHALL=0 WOLFBOOT_SMALL_STACK=0"
32+ - " SPMATH=0 SPMATHALL=0 WOLFBOOT_SMALL_STACK=1"
2333 asym : [ed25519, ecc256, ecc384, ecc521, rsa2048, rsa3072, rsa4096, ed448]
2434 hash : [sha256, sha384, sha3]
35+
36+ # See https://github.com/wolfSSL/wolfBoot/issues/614 regarding exclusions:
37+ exclude :
38+ - math : " SPMATH=1 WOLFBOOT_SMALL_STACK=1"
39+ - math : " SPMATHALL=1 WOLFBOOT_SMALL_STACK=1"
40+
2541 steps :
2642 - uses : actions/checkout@v4
2743 with :
@@ -33,16 +49,50 @@ jobs:
3349
3450 - name : Build test-lib
3551 env :
52+ shell : bash
3653 ASYM : ${{ matrix.asym }}
3754 HASH : ${{ matrix.hash }}
55+ MATH : ${{ matrix.math }}
3856 run : |
57+ # Sample build
58+ build_once() {
59+ # Convert asym and hash to upper case, optionally add additional param
60+ make -j test-lib SIGN=${ASYM^^} HASH=${HASH^^} ${MATH} "$@"
61+ }
62+
63+ set -euo pipefail
64+
65+ # Get the reference config
3966 cp config/examples/library.config .config
67+
68+ # Keytools
4069 make keytools
41- ./tools/keytools/keygen --${{ matrix.asym }} -g wolfboot_signing_private_key.der
70+ ./tools/keytools/keygen --${ASYM} -g wolfboot_signing_private_key.der
71+
72+ # Sign
4273 echo "Test" > test.bin
43- ./tools/keytools/sign --${{ matrix.asym }} --${{ matrix.hash }} test.bin wolfboot_signing_private_key.der 1
44- # Convert asym and hash to upper case
45- make test-lib SIGN=${ASYM^^} HASH=${HASH^^}
74+ ./tools/keytools/sign --${ASYM} --${HASH} test.bin wolfboot_signing_private_key.der 1
75+
76+ # First attempt
77+ if build_once >build.out 2>build.err; then
78+ echo "Success on first attempt, WOLFBOOT_HUGE_STACK not applied."
79+ exit 0
80+ fi
81+
82+ # If it failed due to the TFM huge stack guard, retry with the flag
83+ if grep -Fq 'If this is OK, please compile with WOLFBOOT_HUGE_STACK=1' build.err; then
84+ echo "Retrying with WOLFBOOT_HUGE_STACK=1 due to stack requirement error."
85+
86+ # Always print the entire message
87+ grep -Fn 'If this is OK, please compile with WOLFBOOT_HUGE_STACK=1' build.err || true
88+
89+ # Try again with huge stack allowed
90+ build_once WOLFBOOT_HUGE_STACK=1
91+ else
92+ echo "Build failed for another reason:"
93+ cat build.err
94+ exit 1
95+ fi
4696
4797 - name : Run test-lib
4898 run : |
0 commit comments