Skip to content

Commit

Permalink
Extend CI for TPM2
Browse files Browse the repository at this point in the history
  • Loading branch information
atreiber94 committed Jun 12, 2024
1 parent c6a3a02 commit d1244e3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
18 changes: 13 additions & 5 deletions src/scripts/ci/setup_gh_actions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ ARCH="$2"

SCRIPT_LOCATION=$(cd "$(dirname "$0")"; pwd)

start_swtpm() {
tpm2_state="/tmp/swtpm2"
mkdir $tpm2_state
swtpm socket --tpmstate dir=$tpm2_state --tpm2 --ctrl type=tcp,port=2322 --server type=tcp,port=2321 --flags not-need-init --daemon
tpm2_startup --tcti swtpm --clear
}

if type -p "apt-get"; then

if [ "$(lsb_release -sr)" = "22.04" ]; then
Expand All @@ -33,7 +40,11 @@ if type -p "apt-get"; then
# (l)ist mode (avoiding https://github.com/actions/runner-images/issues/9996)
sudo NEEDRESTART_MODE=l apt-get -qq install valgrind

elif [ "$TARGET" = "shared" ] || [ "$TARGET" = "examples" ] || [ "$TARGET" = "tlsanvil" ] || [ "$TARGET" = "clang-tidy" ] ; then
elif [ "$TARGET" = "shared" ]; then
sudo apt-get -qq install libboost-dev tpm2-tools libtss2-dev swtpm
start_swtpm

elif [ "$TARGET" = "examples" ] || [ "$TARGET" = "tlsanvil" ] || [ "$TARGET" = "clang-tidy" ] ; then
sudo apt-get -qq install libboost-dev

elif [ "$TARGET" = "clang" ]; then
Expand Down Expand Up @@ -92,10 +103,7 @@ if type -p "apt-get"; then
softhsm2-util --init-token --free --label test --pin 123456 --so-pin 12345678
echo "PKCS11_LIB=/usr/lib/softhsm/libsofthsm2.so" >> "$GITHUB_ENV"

tpm2_state="/tmp/swtpm2"
mkdir $tpm2_state
swtpm socket --tpmstate dir=$tpm2_state --tpm2 --ctrl type=tcp,port=2322 --server type=tcp,port=2321 --flags not-need-init --daemon
tpm2_startup --tcti swtpm --clear
start_swtpm

elif [ "$TARGET" = "docs" ]; then
sudo apt-get -qq install doxygen python3-docutils python3-sphinx
Expand Down
4 changes: 3 additions & 1 deletion src/scripts/ci_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,11 @@ def add_boost_support(target, target_os):

if target_os == 'linux':
flags += ['--with-lzma']
if target in ['coverage', 'sanitizer', 'shared']:
flags += ['--with-tpm2']

if target in ['coverage']:
flags += ['--with-tpm', '--with-tpm2']
flags += ['--with-tpm']
test_cmd += ['--run-online-tests']
if pkcs11_lib and os.access(pkcs11_lib, os.R_OK):
test_cmd += ['--pkcs11-lib=%s' % (pkcs11_lib)]
Expand Down

0 comments on commit d1244e3

Please sign in to comment.