Skip to content

Commit

Permalink
chore(ci): Create cmake-single-platform.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
xydan83 committed Feb 1, 2024
1 parent c950bc3 commit db30052
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/cmake-single-platform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# 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: CMake on a single platform

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug
CLANG_VERSION: 14
GCC_VERSION: 12
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-22.04
steps:
- name: Fetch
uses: actions/checkout@v4
with:
submodules: true

- name: Install System Dependencies
run: |
sudo apt-get install -y -qq curl git make cmake clang-format clang-tidy gcc-${{env.GCC_VERSION}} g++-${{env.GCC_VERSION}} libstdc++-${{env.GCC_VERSION}}-dev gdb gcovr libc-dev make jq python3 python3-pip
pip3 install --no-cache-dir "conan>=1.0,<2.0"
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-${{env.GCC_VERSION}} 100 \
--slave /usr/bin/g++ g++ /usr/bin/g++-${{env.GCC_VERSION}} \
--slave /usr/bin/gcov gcov /usr/bin/gcov-${{env.GCC_VERSION}}
- name: Install Open62541
run: |
git clone https://github.com/open62541/open62541.git
cd open62541
git checkout tags/v1.3
git submodule update --init --recursive
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ..
sudo make install
cd ..
rm build -rfd
- name: Configure CMake
# 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: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DNODESETEXPORTER_CLANG_FORMAT_ENABLE=ON -DNODESETEXPORTER_CLANG_TIDY_EXE=ON -DNODESETEXPORTER_PERFORMANCE_TIMER_ENABLED=ON -DNODESETEXPORTER_BUILD_TESTS=ON -DNODESETEXPORTER_CLI_ENABLE=ON ..
cd ..
- name: Build
# Build your program with the given configuration
run: |
ls -all
cd build
make -j
cd ..
- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}

0 comments on commit db30052

Please sign in to comment.