Skip to content

Commit

Permalink
Update github workflows
Browse files Browse the repository at this point in the history
- Make unit-test CMake workflow configurable, so it can be setup
in such a way that it preinstalls tinycbor and then uses the
preinstalled library.
- Add unit-tests run with preinstalled mbedtls and tinyCBOR on
Linux.
  • Loading branch information
Danielius1922 authored and Daniel Adam committed Feb 3, 2023
1 parent 1da9877 commit a6857b1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/cmake-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ on:
required: false
type: boolean
default: false
install_tinycbor:
description: "Install tinyCBOR and use it for the build"
required: false
type: boolean
default: false

jobs:
cmake_linux:
Expand Down Expand Up @@ -55,7 +60,7 @@ jobs:
- args: "-DOC_SECURITY_ENABLED=OFF -DOC_TCP_ENABLED=ON"
# secure off, ipv4 on, tcp on
- args: "-DOC_SECURITY_ENABLED=OFF -DOC_TCP_ENABLED=ON -DOC_IPV4_ENABLED=ON"
# collection create if on, push notification on, tcp off
# collection create if on, push notification on
- args: "-DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_PUSH_ENABLED=ON"
# everything off (dynamic allocation off, secure off, pki off, idd off, oscore off)
- args: "-DOC_DYNAMIC_ALLOCATION_ENABLED=OFF -DOC_SECURITY_ENABLED=OFF -DOC_PKI_ENABLED=OFF -DOC_IDD_API_ENABLED=OFF -DOC_OSCORE_ENABLED=OFF"
Expand All @@ -66,6 +71,18 @@ jobs:
clang: ${{ github.event_name == 'workflow_dispatch' && inputs.clang }}
coverage: false
install_mbedtls: ${{ github.event_name == 'workflow_dispatch' && inputs.install_mbedtls }}
install_tinycbor: ${{ github.event_name == 'workflow_dispatch' && inputs.install_tinycbor }}

cmake_linux_preinstalled:
uses: ./.github/workflows/unit-test-with-cfg.yml
with:
# cloud on (ipv4+tcp on), collections create on, maintenance resource on, well-known core resource on, software update on, push notification on
build_args: -DOC_CLOUD_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_MNT_ENABLED=ON -DOC_WKCORE_ENABLED=ON -DOC_SOFTWARE_UPDATE_ENABLED=ON -DOC_PUSH_ENABLED=ON
build_type: Debug
clang: ${{ github.event_name == 'workflow_dispatch' && inputs.clang }}
coverage: false
install_mbedtls: ${{ github.event_name != 'workflow_dispatch' }}
install_tinycbor: ${{ github.event_name != 'workflow_dispatch' }}

cmake_linux_sanitized:
strategy:
Expand All @@ -89,3 +106,4 @@ jobs:
clang: ${{ github.event_name == 'workflow_dispatch' && inputs.clang }}
coverage: false
install_mbedtls: ${{ github.event_name == 'workflow_dispatch' && inputs.install_mbedtls }}
install_tinycbor: ${{ github.event_name == 'workflow_dispatch' && inputs.install_tinycbor }}
15 changes: 14 additions & 1 deletion .github/workflows/unit-test-with-cfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ on:
type: boolean
required: false
default: false
install_tinycbor:
type: boolean
required: false
default: false
jobs:
unit-test-with-cfg:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -55,10 +59,19 @@ jobs:
sudo make install
fi
- name: Install tinyCBOR
if: ${{ inputs.install_tinycbor }}
run: |
mkdir build_tinycbor && cd build_tinycbor
cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} ${{ steps.cmake_flags.outputs.compiler }} ${{ inputs.build_args }} -DBUILD_TESTING=OFF ..
make tinycbor
cd deps/tinycbor
sudo make install
- name: Build unit tests
run: |
mkdir build && cd build
cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} ${{ steps.cmake_flags.outputs.compiler }} ${{ inputs.build_args }} ${{ inputs.install_mbedtls && '-DBUILD_MBEDTLS=OFF' || '' }} -DBUILD_TESTING=ON ..
cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} ${{ steps.cmake_flags.outputs.compiler }} ${{ inputs.build_args }} ${{ inputs.install_mbedtls && '-DBUILD_MBEDTLS=OFF' || '' }} ${{ inputs.install_tinycbor && '-DBUILD_TINYCBOR=OFF' || '' }} -DBUILD_TESTING=ON ..
make oc-unittests
- name: Run unit tests
Expand Down

0 comments on commit a6857b1

Please sign in to comment.