Skip to content

ci(cmake): use matrix to build against one board per serie #1960

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions .github/workflows/Cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
pull_request:
paths-ignore:
- .github/**
- '!.github/workflows/Arduino-build.yml'
- '!.github/workflows/Cmake.yml'
- '*.json'
- '**.md'
- keywords.txt
Expand All @@ -28,6 +28,26 @@ jobs:
name: Check CMake usage
runs-on: ubuntu-latest

strategy:
matrix:
boardname:
- NUCLEO_F091RC
- NUCLEO_F103RB
- NUCLEO_F207ZG
- NUCLEO_F303RE
- NUCLEO_F411RE
- NUCLEO_F767ZI
- NUCLEO_G0B1RE
- NUCLEO_G474RE
- NUCLEO_H743ZI2
- NUCLEO_L073RZ
- NUCLEO_L152RE
- NUCLEO_L476RG
- NUCLEO_L552ZE_Q
- NUCLEO_U575ZI_Q
- P_NUCLEO_WB55RG
- NUCLEO_WL55JC1

steps:
- name: Checkout
uses: actions/checkout@main
Expand All @@ -38,7 +58,7 @@ jobs:
- name: Configure
run: |
mkdir build
cmake -S CI/build/examples/BareMinimum -B ./build -G Ninja
cmake -DBOARDNAME=${{ matrix.boardname }} -S CI/build/examples/BareMinimum -B ./build -G Ninja

- name: Build example
working-directory: '${{ github.workspace }}/build'
Expand Down
5 changes: 4 additions & 1 deletion CI/build/examples/BareMinimum/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ cmake_minimum_required(VERSION 3.21)
file(REAL_PATH "../../../../" CORE_PATH EXPAND_TILDE)
file(TO_CMAKE_PATH "${CORE_PATH}" CORE_PATH)

set(BOARDNAME "NUCLEO_F103RB")
if(NOT DEFINED BOARDNAME)
MESSAGE(STATUS "BOARDNAME is not defined set it to NUCLEO_F103RB")
set(BOARDNAME "NUCLEO_F103RB")
endif()

list(APPEND CMAKE_MODULE_PATH ${CORE_PATH}/cmake)
set(CMAKE_TOOLCHAIN_FILE toolchain)
Expand Down
6 changes: 3 additions & 3 deletions cmake/toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ find_program(DOT "dot")
include("${CMAKE_CURRENT_LIST_DIR}/ensure_core_deps.cmake")
ensure_core_deps()

# Setting Linux is forcing th extension to be .o instead of .obj when building on WIndows.
# Setting Linux is forcing the extension to be .o instead of .obj when building on Windows.
# It is important because armlink is failing when files have .obj extensions (error with
# scatter file section not found)
SET(CMAKE_SYSTEM_NAME Linux)
Expand All @@ -49,8 +49,8 @@ SET(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) # don't try to link when testing the compiler, it won't work anyway
set(BUILD_SHARED_LIBS false CACHE STRING "")

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD 17)

set(CMAKE_EXECUTABLE_SUFFIX .elf)
# These override CMAKE_EXECUTABLE_SUFFIX -- prevent any CMake built-in from overriding the value we want
Expand Down