Skip to content

Commit

Permalink
Create a github workflow using cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
QuangHaiNguyen committed Feb 28, 2024
1 parent 5e7a862 commit 2e3053e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/github_ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
name: Github CI CMake

on:
push:
branches: [ "**" ]
pull_request:
branches: [ "main" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Configure CMake
working-directory: ${{github.workspace}}
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake --preset=linux_debug

- name: Build
working-directory: ${{github.workspace}}/com_bus_controller_pc
# Build your program with the given configuration
run: cmake --build --preset=linux_debug

- name: Test
working-directory: ${{github.workspace}}
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest preset=github_ci --test-dir build/linux_debug/
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ tools/template_generator/*.c
tools/template_generator/*.h
tools/template_generator/CMakeLists.txt
doxygen/
tools/template_generator/__pycache__/
tools/template_generator/__pycache__/
Testing/
2 changes: 2 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"displayName": "Linux debug configuration",
"description": "Debug configuration using ninja generator on linux",
"inherits": "linux_base",
"binaryDir": "${sourceDir}/build/linux_debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
Expand All @@ -32,6 +33,7 @@
"displayName": "Linux release configuration",
"description": "Release configuration using ninja generator on linux",
"inherits": "linux_base",
"binaryDir": "${sourceDir}/build/linux_release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
Expand Down

0 comments on commit 2e3053e

Please sign in to comment.