Skip to content

.github: Run the tests in the CI #42

.github: Run the tests in the CI

.github: Run the tests in the CI #42

Workflow file for this run

name: SPDM-Utils-ci
on:
push:
pull_request:
jobs:
ci-check:
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
components: rustfmt, clippy
- name: Install dependencies
run: |
sudo apt-get install -y cmake libclang-dev libpci-dev libssl-dev python3-dev gem; \
sudo gem install cbor-diag;
- name: Build libspdm
run: |
pushd third-party/libspdm; \
mkdir build; cd build; \
cmake \
-DARCH=x64 \
-DTOOLCHAIN=GCC \
-DTARGET=Debug \
-DCRYPTO=openssl \
-DENABLE_BINARY_BUILD=1 \
-DCOMPILED_LIBCRYPTO_PATH=/usr/lib/ \
-DCOMPILED_LIBSSL_PATH=/usr/lib/ \
-DDISABLE_TESTS=1 \
-DCMAKE_C_FLAGS="-DLIBSPDM_ENABLE_CAPABILITY_EVENT_CAP=0" \
.. ; \
make -j8; \
popd;
- name: Format
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
- name: Test
run: |
cargo test; \
./target/debug/spdm_utils --socket-server response & \
./target/debug/spdm_utils --socket-client tests;
# TODO: Fixup clippy failures and enable this
# - name: Clippy
# uses: actions-rs/cargo@v1
# with:
# command: clippy
- name: Format Tock Responder
run: pushd tock-responder && cargo fmt --all -- --check && popd
- name: Install ARM toolchain
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: latest
- name: Install elf2tab
run: cargo install elf2tab
- name: Build ARM embedded libspdm
run: |
pushd third-party/libspdm; \
mkdir -p build_no_std_arm; \
cd build_no_std_arm; \
find \
../os_stub/mbedtlslib/include/mbedtls/libspdm_mbedtls_config.h \
-type f -exec \
sed -i 's|#define MBEDTLS_HAVE_TIME_DATE|// #define MBEDTLS_HAVE_TIME_DATE|g' {} + ; \
cmake \
-DARCH=arm \
-DTOOLCHAIN=ARM_GNU_BARE_METAL \
-DTARGET=Release \
-DCRYPTO=mbedtls \
-DDISABLE_TESTS=1 \
-DMARCH=armv7e-m \
-DDISABLE_LTO=1 \
-DCMAKE_C_FLAGS=" \
-DLIBSPDM_ENABLE_CAPABILITY_CHUNK_CAP=1 \
-DMBEDTLS_SKIP_TIME_CHECK \
-DLIBSPDM_ENABLE_CAPABILITY_EVENT_CAP=0 \
-DMBEDTLS_PLATFORM_MS_TIME_ALT \
" \
.. ; \
make -j8; \
popd;
- name: Build Tock Responder for nRF52840
run: pushd tock-responder && make nrf52840_spdm_responder && popd
# Ubuntu uses riscv64-unknown-elf-gcc, which isn't supported by
# the libspdm CMake TOOLCHAIN
# - name: Install RISC-V toolchain
# run: |
# sudo apt-get install -y gcc-riscv64-unknown-elf
# - name: Build RISC-V embedded libspdm
# run: |
# pushd third-party/libspdm; \
# mkdir -p build_no_std_riscv; \
# cd build_no_std_riscv; \
# cmake \
# -DARCH=riscv32 \
# -DTOOLCHAIN=RISCV_NONE \
# -DTARGET=Release \
# -DCRYPTO=mbedtls \
# -DDISABLE_TESTS=1 \
# -DCMAKE_C_FLAGS=" \
# -DLIBSPDM_ENABLE_CAPABILITY_CHUNK_CAP=1 \
# -DMBEDTLS_SKIP_TIME_CHECK \
# -DLIBSPDM_ENABLE_CAPABILITY_EVENT_CAP=0 \
# " \
# .. ; \
# make -j8; \
# popd;
# - name: Build Tock Responder for OpenTitan
# run: pushd tock-responder && make opentitan_spdm_responder && popd