Skip to content

Commit 8a68257

Browse files
committed
Add network namespace isolation, macOS CI, and Windows build support for fwTPM
Use unshare --user --net to isolate fwtpm_check.sh TCP ports in CI, eliminating flaky port conflicts on shared runners. Add macOS CI with socket transport tests. Add Windows socket portability (Winsock2) and build-only CI via CMake.
1 parent f1afb9f commit 8a68257

11 files changed

Lines changed: 273 additions & 117 deletions

File tree

.github/workflows/cmake-build.yml

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,97 +9,131 @@ on:
99
jobs:
1010
build:
1111

12-
runs-on: ubuntu-latest
12+
runs-on: ${{ matrix.config.os }}
1313
strategy:
1414
fail-fast: false
1515
matrix:
1616
config:
1717
# Default configuration (SWTPM first)
1818
- name: "Defaults"
19+
os: ubuntu-latest
1920
options: ""
2021
# ST33 supports both SPI and I2C
2122
- name: "Module ST33 SPI"
23+
os: ubuntu-latest
2224
options: "-DWOLFTPM_INTERFACE=SPI -DWOLFTPM_MODULE=st33"
2325
- name: "Module ST33 I2C"
26+
os: ubuntu-latest
2427
options: "-DWOLFTPM_INTERFACE=I2C -DWOLFTPM_MODULE=st33"
2528
# ST33 Firmware
2629
- name: "Module ST33 Firmware"
30+
os: ubuntu-latest
2731
options: "-DWOLFTPM_MODULE=st33 -DWOLFTPM_FIRMWARE=yes"
2832
# Other modules use SPI
2933
- name: "Module Microchip"
34+
os: ubuntu-latest
3035
options: "-DWOLFTPM_INTERFACE=SPI -DWOLFTPM_MODULE=microchip"
3136
- name: "Module Nuvoton"
37+
os: ubuntu-latest
3238
options: "-DWOLFTPM_INTERFACE=SPI -DWOLFTPM_MODULE=nuvoton"
3339
- name: "Module SLB9670"
40+
os: ubuntu-latest
3441
options: "-DWOLFTPM_INTERFACE=SPI -DWOLFTPM_MODULE=slb9670"
3542
- name: "Module SLB9672"
43+
os: ubuntu-latest
3644
options: "-DWOLFTPM_INTERFACE=SPI -DWOLFTPM_MODULE=slb9672"
3745
# SLB9673 is I2C
3846
- name: "Module SLB9673 I2C"
47+
os: ubuntu-latest
3948
options: "-DWOLFTPM_INTERFACE=I2C -DWOLFTPM_MODULE=slb9673"
4049
# Test wrapper disabled
4150
- name: "No Wrapper"
51+
os: ubuntu-latest
4252
options: "-DWOLFTPM_WRAPPER=no"
4353
# Test I2C support (enables ADV_IO automatically)
4454
- name: "I2C Enabled (legacy)"
55+
os: ubuntu-latest
4556
options: "-DWOLFTPM_I2C=yes"
4657
# Test interface options
4758
- name: "Interface I2C"
59+
os: ubuntu-latest
4860
options: "-DWOLFTPM_INTERFACE=I2C"
4961
- name: "Interface SPI"
62+
os: ubuntu-latest
5063
options: "-DWOLFTPM_INTERFACE=SPI"
5164
# Test Advanced IO
5265
- name: "Advanced IO"
66+
os: ubuntu-latest
5367
options: "-DWOLFTPM_INTERFACE=SPI -DWOLFTPM_ADVIO=yes"
5468
- name: "Advanced IO I2C"
69+
os: ubuntu-latest
5570
options: "-DWOLFTPM_INTERFACE=I2C -DWOLFTPM_ADVIO=yes"
5671
# Test MMIO (enables ADV_IO automatically)
5772
- name: "MMIO Enabled"
73+
os: ubuntu-latest
5874
options: "-DWOLFTPM_MMIO=yes"
5975
# Test Check Wait State
6076
- name: "Check Wait State Enabled"
77+
os: ubuntu-latest
6178
options: "-DWOLFTPM_INTERFACE=SPI -DWOLFTPM_CHECK_WAIT_STATE=yes"
6279
- name: "Check Wait State Disabled"
80+
os: ubuntu-latest
6381
options: "-DWOLFTPM_INTERFACE=SPI -DWOLFTPM_CHECK_WAIT_STATE=no"
6482
# Test TIS Lock
6583
- name: "TIS Lock Enabled"
84+
os: ubuntu-latest
6685
options: "-DWOLFTPM_INTERFACE=SPI -DWOLFTPM_TIS_LOCK=yes"
6786
# Test Small Stack
6887
- name: "Small Stack"
88+
os: ubuntu-latest
6989
options: "-DWOLFTPM_INTERFACE=SPI -DWOLFTPM_SMALL_STACK=yes"
7090
# Test HAL disabled
7191
- name: "No HAL"
92+
os: ubuntu-latest
7293
options: "-DWOLFTPM_HAL=no"
7394
# Test Firmware disabled
7495
- name: "No Firmware"
96+
os: ubuntu-latest
7597
options: "-DWOLFTPM_FIRMWARE=no"
7698
# Test Debug modes
7799
- name: "Debug Verbose"
100+
os: ubuntu-latest
78101
options: "-DWOLFTPM_DEBUG=verbose"
79102
- name: "Debug IO"
103+
os: ubuntu-latest
80104
options: "-DWOLFTPM_DEBUG=io"
81105
# Test Examples disabled
82106
- name: "No Examples"
107+
os: ubuntu-latest
83108
options: "-DWOLFTPM_EXAMPLES=no"
84109
# Test combination of options
85110
- name: "Combined Options"
111+
os: ubuntu-latest
86112
options: "-DWOLFTPM_INTERFACE=I2C -DWOLFTPM_MODULE=st33 -DWOLFTPM_ADVIO=yes -DWOLFTPM_CHECK_WAIT_STATE=yes"
87113
# fwTPM server with socket transport
88114
- name: "fwTPM Socket"
115+
os: ubuntu-latest
89116
options: "-DWOLFTPM_FWTPM=yes -DWOLFTPM_INTERFACE=SWTPM"
90117
# fwTPM server with TIS/shared-memory transport
91118
- name: "fwTPM TIS"
119+
os: ubuntu-latest
92120
options: "-DWOLFTPM_FWTPM=yes -DWOLFTPM_INTERFACE=SPI"
93121
# fwTPM server-only mode (no client library or examples)
94122
- name: "fwTPM Only"
123+
os: ubuntu-latest
95124
options: "-DWOLFTPM_FWTPM_ONLY=yes -DWOLFTPM_INTERFACE=SWTPM"
125+
# fwTPM socket on Windows (build-only)
126+
- name: "fwTPM Socket (Windows)"
127+
os: windows-latest
128+
options: "-DWOLFTPM_FWTPM=yes -DWOLFTPM_INTERFACE=SWTPM"
96129

97130
steps:
98131
#pull wolfTPM
99132
- uses: actions/checkout@master
100133

101134
# Install cmake
102135
- name: Install cmake
136+
if: runner.os == 'Linux'
103137
run: |
104138
sudo apt-get update
105139
sudo apt-get install -y cmake
@@ -112,25 +146,32 @@ jobs:
112146
path: wolfssl
113147
- name: Build wolfssl
114148
working-directory: ./wolfssl
149+
shell: bash
115150
run: |
116151
mkdir build
117152
cd build
118153
# wolfSSL PR 7188 broke "make install" unless WOLFSSL_INSTALL is set
119-
cmake -DWOLFSSL_TPM=yes -DWOLFSSL_INSTALL=yes -DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install" -DCMAKE_C_FLAGS="-DWC_RSA_NO_PADDING" ..
120-
cmake --build .
121-
cmake --install .
154+
cmake -DWOLFSSL_TPM=yes -DWOLFSSL_INSTALL=yes \
155+
-DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install" \
156+
-DCMAKE_C_FLAGS="-DWC_RSA_NO_PADDING -DWOLFSSL_PUBLIC_MP" ..
157+
cmake --build . --config Release
158+
cmake --install . --config Release
122159
123160
#build wolftpm
124161
- name: Build wolfTPM (${{ matrix.config.name }})
162+
shell: bash
125163
run: |
126164
mkdir build
127165
cd build
128-
cmake ${{ matrix.config.options }} -DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install" -DWITH_WOLFSSL="$GITHUB_WORKSPACE/install" ..
129-
cmake --build .
130-
cmake --install .
166+
cmake ${{ matrix.config.options }} \
167+
-DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install" \
168+
-DWITH_WOLFSSL="$GITHUB_WORKSPACE/install" ..
169+
cmake --build . --config Release
170+
cmake --install . --config Release
131171
132172
- name: Test fwTPM
133173
if: contains(matrix.config.options, 'WOLFTPM_FWTPM')
174+
shell: bash
134175
run: |
135176
cd build
136177
LD_LIBRARY_PATH="$GITHUB_WORKSPACE/install/lib" ctest --output-on-failure

0 commit comments

Comments
 (0)