Skip to content

Commit ee5ba18

Browse files
authored
Merge pull request #489 from padelsbach/ci-runtime-p6-matrix
CI: reorganize workflow matrices
2 parents 6e68bb8 + 9b586b9 commit ee5ba18

3 files changed

Lines changed: 136 additions & 63 deletions

File tree

.github/workflows/build-and-run-examples.yml

Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,9 @@ jobs:
1919
strategy:
2020
matrix:
2121
transport: [ 'tcp', 'shm', 'dma', 'tls', 'psk' ]
22-
asan: [ 'ASAN=1', 'ASAN=0' ]
23-
debug: [ '', 'DEBUG_VERBOSE=1' ]
24-
test: [ '', '--test' ]
25-
auth: [ '', 'AUTH=1' ]
2622
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
2723
runs-on: ubuntu-latest
28-
timeout-minutes: 5
24+
timeout-minutes: 15
2925

3026
steps:
3127
- uses: actions/checkout@v4
@@ -37,56 +33,61 @@ jobs:
3733
repository: wolfssl/wolfssl
3834
path: wolfssl
3935

40-
- name: Set TLS Environment Variable
36+
# One job per transport; the flag combos run as a loop because a
37+
# matrix job per combo spends about half its time on runner setup.
38+
# The --test variants reuse the same binaries, so each of the 8
39+
# flag builds serves two client runs.
40+
- name: Build and run examples (all flag combos)
4141
run: |
42-
if [ "${{ matrix.transport }}" = "tls" ] || [ "${{ matrix.transport }}" = "psk" ]; then
43-
echo "TLS=1" >> $GITHUB_ENV
42+
WS="$(pwd)"
43+
SERVER_DIR="$WS/examples/posix/wh_posix_server"
44+
CLIENT_DIR="$WS/examples/posix/wh_posix_client"
45+
TRANSPORT="${{ matrix.transport }}"
46+
if [ "$TRANSPORT" = "tls" ] || [ "$TRANSPORT" = "psk" ]; then
47+
TLS=1
4448
else
45-
echo "TLS=0" >> $GITHUB_ENV
49+
TLS=0
4650
fi
47-
48-
# Build examples
49-
- name: Build POSIX server
50-
run: |
51-
if [ "${{ matrix.transport }}" = "dma" ]; then
52-
cd examples/posix/wh_posix_server && ${{ matrix.asan }} ${{ matrix.debug }} ${{ matrix.auth }} DMA=1 DEMO_KEK=1 make -j WOLFSSL_DIR=../../../wolfssl
53-
else
54-
cd examples/posix/wh_posix_server && ${{ matrix.asan }} ${{ matrix.debug }} ${{ matrix.auth }} TLS=${{ env.TLS }} DEMO_KEK=1 make -j WOLFSSL_DIR=../../../wolfssl
55-
fi
56-
57-
- name: Build POSIX client
58-
run: |
59-
if [ "${{ matrix.transport }}" = "dma" ]; then
60-
cd examples/posix/wh_posix_client && ${{ matrix.asan }} ${{ matrix.debug }} ${{ matrix.auth }} DMA=1 make -j WOLFSSL_DIR=../../../wolfssl
61-
else
62-
cd examples/posix/wh_posix_client && ${{ matrix.asan }} ${{ matrix.debug }} ${{ matrix.auth }} TLS=${{ env.TLS }} make -j WOLFSSL_DIR=../../../wolfssl
63-
fi
64-
65-
# Start the server in the background
66-
- name: Run POSIX server
67-
run: |
68-
cd examples/posix/wh_posix_server
69-
if [ "${{ matrix.transport }}" = "psk" ]; then
70-
echo "test_password" | ./Build/wh_posix_server.elf --type ${{ matrix.transport }} &
71-
else
72-
./Build/wh_posix_server.elf --type ${{ matrix.transport }} &
73-
fi
74-
POSIX_SERVER_PID=$!
75-
echo "POSIX_SERVER_PID=$POSIX_SERVER_PID" >> $GITHUB_ENV
76-
77-
# Run the client that connects to the server
78-
- name: Run POSIX client
79-
run: |
80-
cd examples/posix/wh_posix_client
81-
if [ "${{ matrix.transport }}" = "psk" ]; then
82-
echo "test_password" | ./Build/wh_posix_client.elf --type ${{ matrix.transport }} ${{ matrix.test }}
83-
else
84-
./Build/wh_posix_client.elf --type ${{ matrix.transport }} ${{ matrix.test }}
85-
fi
86-
87-
# Optional: Kill the server process if it doesn't exit on its own
88-
- name: Cleanup POSIX server
89-
if: always()
90-
run: kill $POSIX_SERVER_PID || true
91-
92-
51+
for ASAN in ASAN=1 ASAN=0; do
52+
for DEBUG in "" DEBUG_VERBOSE=1; do
53+
for AUTH in "" AUTH=1; do
54+
echo "::group::build $TRANSPORT $ASAN $DEBUG $AUTH"
55+
make -C "$SERVER_DIR" clean
56+
make -C "$CLIENT_DIR" clean
57+
if [ "$TRANSPORT" = "dma" ]; then
58+
env $ASAN $DEBUG $AUTH DMA=1 DEMO_KEK=1 \
59+
make -C "$SERVER_DIR" -j WOLFSSL_DIR=../../../wolfssl
60+
env $ASAN $DEBUG $AUTH DMA=1 \
61+
make -C "$CLIENT_DIR" -j WOLFSSL_DIR=../../../wolfssl
62+
else
63+
env $ASAN $DEBUG $AUTH TLS=$TLS DEMO_KEK=1 \
64+
make -C "$SERVER_DIR" -j WOLFSSL_DIR=../../../wolfssl
65+
env $ASAN $DEBUG $AUTH TLS=$TLS \
66+
make -C "$CLIENT_DIR" -j WOLFSSL_DIR=../../../wolfssl
67+
fi
68+
echo "::endgroup::"
69+
for TEST in "" --test; do
70+
echo "::group::run $TRANSPORT $ASAN $DEBUG $AUTH test='$TEST'"
71+
rm -f "$SERVER_DIR"/*.bin
72+
cd "$SERVER_DIR"
73+
if [ "$TRANSPORT" = "psk" ]; then
74+
echo "test_password" | ./Build/wh_posix_server.elf --type "$TRANSPORT" &
75+
else
76+
./Build/wh_posix_server.elf --type "$TRANSPORT" &
77+
fi
78+
SERVER_PID=$!
79+
sleep 1
80+
cd "$CLIENT_DIR"
81+
if [ "$TRANSPORT" = "psk" ]; then
82+
echo "test_password" | ./Build/wh_posix_client.elf --type "$TRANSPORT" $TEST
83+
else
84+
./Build/wh_posix_client.elf --type "$TRANSPORT" $TEST
85+
fi
86+
kill $SERVER_PID 2>/dev/null || true
87+
wait $SERVER_PID 2>/dev/null || true
88+
cd "$WS"
89+
echo "::endgroup::"
90+
done
91+
done
92+
done
93+
done

.github/workflows/build-and-test-refactor.yml

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,24 @@ jobs:
2323
strategy:
2424
fail-fast: false
2525
matrix:
26-
# Exclude macOS for draft PRs due to its small pool
27-
os: >-
26+
# ubuntu runs the configs as parallel groups to shorten the
27+
# critical path. macos runs only the base group: it is there to
28+
# catch platform and compiler differences, not to repeat every
29+
# config ubuntu already covers, and its org-wide runner pool is
30+
# much smaller. That same small pool is why macos is dropped
31+
# from draft PRs.
32+
include: >-
2833
${{ (github.event_name == 'pull_request' &&
2934
github.event.pull_request.draft) &&
30-
fromJSON('["ubuntu-latest"]') ||
31-
fromJSON('["ubuntu-latest", "macos-latest"]') }}
35+
fromJSON('[{"os":"ubuntu-latest","group":"pq-dma"},
36+
{"os":"ubuntu-latest","group":"wolfcrypt"},
37+
{"os":"ubuntu-latest","group":"threadsafe"},
38+
{"os":"ubuntu-latest","group":"base"}]') ||
39+
fromJSON('[{"os":"ubuntu-latest","group":"pq-dma"},
40+
{"os":"ubuntu-latest","group":"wolfcrypt"},
41+
{"os":"ubuntu-latest","group":"threadsafe"},
42+
{"os":"ubuntu-latest","group":"base"},
43+
{"os":"macos-latest","group":"base"}]') }}
3244
3345
runs-on: ${{ matrix.os }}
3446
timeout-minutes: 45
@@ -60,100 +72,123 @@ jobs:
6072

6173
# Build and test standard build
6274
- name: Build and test refactor
75+
if: matrix.group == 'base'
6376
run: cd test-refactor/posix && make clean && make -j WOLFSSL_DIR=../../wolfssl && make run
6477

6578
# Build and test standard build, with DMA and ASAN enabled
6679
- name: Build and test refactor DMA ASAN
80+
if: matrix.group == 'pq-dma'
6781
run: cd test-refactor/posix && make clean && make -j DMA=1 ASAN=1 WOLFSSL_DIR=../../wolfssl && make run
6882

6983
# Build and test with LMS and XMSS both in verify-only mode
7084
- name: Build and test refactor DMA ASAN LMS/XMSS verify-only
85+
if: matrix.group == 'pq-dma'
7186
run: cd test-refactor/posix && make clean && make -j DMA=1 ASAN=1 LMS_VERIFY_ONLY=1 XMSS_VERIFY_ONLY=1 WOLFSSL_DIR=../../wolfssl && make run
7287

7388
# Build and test mixed: LMS verify-only, XMSS full (exercises shared gating)
7489
- name: Build and test refactor DMA ASAN LMS verify-only XMSS full
90+
if: matrix.group == 'pq-dma'
7591
run: cd test-refactor/posix && make clean && make -j DMA=1 ASAN=1 LMS_VERIFY_ONLY=1 WOLFSSL_DIR=../../wolfssl && make run
7692

7793
# Build and test with ML-DSA in verify-only mode
7894
- name: Build and test refactor DMA ASAN MLDSA verify-only
95+
if: matrix.group == 'pq-dma'
7996
run: cd test-refactor/posix && make clean && make -j DMA=1 ASAN=1 MLDSA_VERIFY_ONLY=1 WOLFSSL_DIR=../../wolfssl && make run
8097

8198
# Build and test ASAN build, with wolfCrypt tests enabled.
8299
- name: Build and test refactor ASAN TESTWOLFCRYPT
100+
if: matrix.group == 'wolfcrypt'
83101
run: cd test-refactor/posix && make clean && make -j ASAN=1 TESTWOLFCRYPT=1 WOLFSSL_DIR=../../wolfssl && make run
84102

85103
# Build and test ASAN build, with wolfCrypt tests enabled and using the DMA devId.
86104
# LMS/XMSS verify-only; full PQ runs in DMA ASAN and THREADSAFE everything
87105
- name: Build and test refactor ASAN TESTWOLFCRYPT TESTWOLFCRYPT_DMA
106+
if: matrix.group == 'wolfcrypt'
88107
run: cd test-refactor/posix && make clean && make -j ASAN=1 TESTWOLFCRYPT=1 TESTWOLFCRYPT_DMA=1 DMA=1 LMS_VERIFY_ONLY=1 XMSS_VERIFY_ONLY=1 WOLFSSL_DIR=../../wolfssl && make run
89108

90109
# Build and test debug build with ASAN and NOCRYPTO
91110
- name: Build and test refactor ASAN DEBUG NOCRYPTO
111+
if: matrix.group == 'base'
92112
run: cd test-refactor/posix && make clean && make -j DEBUG=1 ASAN=1 NOCRYPTO=1 WOLFSSL_DIR=../../wolfssl && make run
93113

94114
# Build and test debug build with ASAN and DMA
95115
# LMS/XMSS verify-only; full PQ runs in DMA ASAN and THREADSAFE everything
96116
- name: Build and test refactor ASAN DEBUG DMA
117+
if: matrix.group == 'wolfcrypt'
97118
run: cd test-refactor/posix && make clean && make -j DEBUG=1 ASAN=1 DMA=1 LMS_VERIFY_ONLY=1 XMSS_VERIFY_ONLY=1 WOLFSSL_DIR=../../wolfssl && make run
98119

99120
# Build and test with SHE and ASAN
100121
- name: Build and test refactor ASAN SHE
122+
if: matrix.group == 'wolfcrypt'
101123
run: cd test-refactor/posix && make clean && make -j SHE=1 ASAN=1 WOLFSSL_DIR=../../wolfssl && make run
102124

103125
# Build and test with per-client crypto affinity enabled (runs the crypto
104126
# affinity unit test, gated behind WOLFHSM_CFG_CRYPTO_AFFINITY)
105127
- name: Build and test refactor CRYPTO_AFFINITY ASAN
128+
if: matrix.group == 'wolfcrypt'
106129
run: cd test-refactor/posix && make clean && make -j CRYPTO_AFFINITY=1 ASAN=1 WOLFSSL_DIR=../../wolfssl && make run
107130

108131
# Build and test crypto affinity alongside DMA (exercises HW-devId path)
109132
# LMS/XMSS verify-only; full PQ runs in DMA ASAN and THREADSAFE everything
110133
- name: Build and test refactor CRYPTO_AFFINITY DMA ASAN
134+
if: matrix.group == 'wolfcrypt'
111135
run: cd test-refactor/posix && make clean && make -j CRYPTO_AFFINITY=1 DMA=1 ASAN=1 LMS_VERIFY_ONLY=1 XMSS_VERIFY_ONLY=1 WOLFSSL_DIR=../../wolfssl && make run
112136

113137
# Build and test with global SHE keys (all SHE slots shared across clients)
114138
- name: Build and test refactor ASAN SHE_GLOBAL
139+
if: matrix.group == 'wolfcrypt'
115140
run: cd test-refactor/posix && make clean && make -j SHE_GLOBAL=1 ASAN=1 WOLFSSL_DIR=../../wolfssl && make run
116141

117142
# Build and test with DEBUG=1
118143
- name: Build and test refactor with DEBUG
144+
if: matrix.group == 'base'
119145
run: cd test-refactor/posix && make clean && make -j DEBUG=1 WOLFSSL_DIR=../../wolfssl && make run
120146

121147
# Build and test with DEBUG_VERBOSE=1 (includes DEBUG)
122148
- name: Build and test refactor with DEBUG_VERBOSE
149+
if: matrix.group == 'base'
123150
run: cd test-refactor/posix && make clean && make -j DEBUG_VERBOSE=1 WOLFSSL_DIR=../../wolfssl && make run
124151

125152
# Build and test in multithreaded mode with everything enabled
126153
- name: Build and test refactor with THREADSAFE and everything
154+
if: matrix.group == 'threadsafe'
127155
run: cd test-refactor/posix && make clean && make -j THREADSAFE=1 DMA=1 SHE=1 ASAN=1 WOLFSSL_DIR=../../wolfssl && make run
128156

129157
# Same, with global SHE keys
130158
- name: Build and test refactor with THREADSAFE and everything and SHE_GLOBAL
159+
if: matrix.group == 'threadsafe'
131160
run: cd test-refactor/posix && make clean && make -j THREADSAFE=1 DMA=1 SHE_GLOBAL=1 ASAN=1 WOLFSSL_DIR=../../wolfssl && make run
132161

133162
# Build and test in multithreaded mode with everything enabled and wolfCrypt tests
134163
# LMS/XMSS verify-only; full PQ runs in DMA ASAN and THREADSAFE everything
135164
- name: Build and test refactor with THREADSAFE and TESTWOLFCRYPT and everything
165+
if: matrix.group == 'threadsafe'
136166
run: cd test-refactor/posix && make clean && make -j THREADSAFE=1 TESTWOLFCRYPT=1 DMA=1 SHE=1 ASAN=1 LMS_VERIFY_ONLY=1 XMSS_VERIFY_ONLY=1 WOLFSSL_DIR=../../wolfssl && make run
137167

138168
# Build and test in multithreaded mode with everything enabled and wolfCrypt tests with dma
139169
# LMS/XMSS verify-only; full PQ runs in DMA ASAN and THREADSAFE everything
140170
- name: Build and test refactor with THREADSAFE and TESTWOLFCRYPT with DMA
171+
if: matrix.group == 'threadsafe'
141172
run: cd test-refactor/posix && make clean && make -j THREADSAFE=1 TESTWOLFCRYPT=1 TESTWOLFCRYPT_DMA=1 DMA=1 SHE=1 ASAN=1 LMS_VERIFY_ONLY=1 XMSS_VERIFY_ONLY=1 WOLFSSL_DIR=../../wolfssl && make run
142173

143174
# Build and test with AUTH=1
144175
- name: Build and test refactor with AUTH
176+
if: matrix.group == 'base'
145177
run: cd test-refactor/posix && make clean && make -j AUTH=1 WOLFSSL_DIR=../../wolfssl && make run
146178

147179
# Build and test with AUTH=1 and ASAN
148180
- name: Build and test refactor with AUTH ASAN
181+
if: matrix.group == 'base'
149182
run: cd test-refactor/posix && make clean && make -j AUTH=1 ASAN=1 WOLFSSL_DIR=../../wolfssl && make run
150183

151184
# Build and test with AUTH=1 and THREADSAFE
152185
- name: Build and test refactor with AUTH THREADSAFE ASAN
186+
if: matrix.group == 'base'
153187
run: cd test-refactor/posix && make clean && make -j AUTH=1 THREADSAFE=1 ASAN=1 WOLFSSL_DIR=../../wolfssl && make run
154188

155189
# Build and test with AUTH=1 and NOCRYPTO=1 (auth on, crypto off)
156190
- name: Build and test refactor with AUTH NOCRYPTO
191+
if: matrix.group == 'base'
157192
run: cd test-refactor/posix && make clean && make -j AUTH=1 NOCRYPTO=1 WOLFSSL_DIR=../../wolfssl && make run
158193

159194
- name: Show ccache stats

0 commit comments

Comments
 (0)