Add VSCode workspace and clang tool configs [AP-3053] #1629
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: C | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
- staging | |
tags: | |
- "*" | |
pull_request: | |
paths: | |
- "c/**" | |
- .github/workflows/c.yaml | |
jobs: | |
ubuntu-lts: | |
strategy: | |
matrix: | |
build_type: [ "Debug", "Release" ] | |
compiler: [ | |
{ c: "gcc-6", cxx: "g++-6", package: "gcc-6 g++-6" }, | |
{ c: "clang-6.0", cxx: "clang++-6.0", package: "clang-6.0" } | |
] | |
build_shared_libraries: [ true, false ] | |
exclude: [ | |
{ build_type: "Debug", compiler: { c: "gcc-6", cxx: "g++-6" }, build_shared_libraries: false } | |
] | |
name: "Ubuntu 18.04 (Build: ${{ matrix.build_type }}, Compilers: ${{ matrix.compiler.c }}/${{ matrix.compiler.cxx }}, Shared Library: ${{ matrix.build_shared_libraries }})" | |
runs-on: ubuntu-latest | |
container: ubuntu:18.04 | |
env: | |
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true | |
steps: | |
- name: Setup | |
run: | | |
apt-get -qq update | |
apt-get -qq install software-properties-common gpg wget | |
add-apt-repository -y ppa:git-core/ppa | |
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null | |
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ bionic-rc main' \ | |
| tee -a /etc/apt/sources.list.d/kitware.list >/dev/null | |
apt-get -qq update | |
apt-get -qq install libeigen3-dev libserialport-dev git cmake build-essential ${{ matrix.compiler.package }} | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Configure | |
run: | | |
cmake -S c -B build \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
-DCMAKE_C_COMPILER=${{ matrix.compiler.c }} \ | |
-DCMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} \ | |
-DBUILD_SHARED_LIBS=${{ matrix.build_shared_libraries }} \ | |
-DCMAKE_INSTALL_PREFIX="$PWD/install" \ | |
-DINSTALL_GTEST=false \ | |
-DBUILD_EXAMPLES=true | |
- name: Build | |
run: cmake --build build --parallel | |
- name: Example | |
run: cmake --build build --parallel --target examples | |
- name: Test | |
run: cmake --build build --target do-all-tests | |
- name: Install | |
run: cmake --build build --target install | |
- name: Test Package | |
run: | | |
cmake -S c/test_package -B c/test_package/build -DCMAKE_PREFIX_PATH="$PWD/install" | |
cmake --build c/test_package/build | |
macos: | |
name: macOS | |
runs-on: macos-12 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Configure | |
run: | | |
cmake -S c -B build \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_C_COMPILER=clang \ | |
-DCMAKE_CXX_COMPILER=clang++ \ | |
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" \ | |
-DINSTALL_GTEST=false | |
- name: Build | |
run: cmake --build build | |
- name: Test | |
run: cmake --build build --target do-all-tests | |
- name: Install | |
run: cmake --build build --target install | |
- name: Test Package | |
run: | | |
cmake -S c/test_package -B c/test_package/build -DCMAKE_PREFIX_PATH="${{ github.workspace }}/install" | |
cmake --build c/test_package/build | |
big-endian: | |
name: Test Big Endian | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Setup | |
run: | | |
sudo apt-get -qq update | |
sudo apt-get -qq install gcc-multilib-mips-linux-gnu gcc-mips-linux-gnu qemu-user g++-mips-linux-gnu | |
- name: Run big endian tests | |
run: make test-c-modern | |
env: | |
CC: mips-linux-gnu-gcc | |
CXX: mips-linux-gnu-g++ | |
CMAKEFLAGS: -DCMAKE_EXE_LINKER_FLAGS_RELEASE="-static" -Dgtest_disable_pthreads=ON | |
bazel: | |
name: Bazel | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: bazelbuild/setup-bazelisk@v3 | |
- name: Mount bazel cache | |
uses: actions/cache@v4 | |
with: | |
path: "~/.cache/bazel" | |
key: bazel | |
- name: Bazel Build & Test | |
run: | | |
bazel test //... | |
asan: | |
name: ASAN | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: bazelbuild/setup-bazelisk@v3 | |
- name: Mount bazel cache | |
uses: actions/cache@v4 | |
with: | |
path: "~/.cache/bazel" | |
key: bazel | |
- name: Bazel Build & Test | |
run: | | |
bazel test --config=asan //... | |
ubsan: | |
name: UBSAN | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: bazelbuild/setup-bazelisk@v3 | |
- name: Mount bazel cache | |
uses: actions/cache@v4 | |
with: | |
path: "~/.cache/bazel" | |
key: bazel | |
- name: Bazel Build & Test | |
run: | | |
bazel test --config=ubsan //... | |
windows-2019: | |
strategy: | |
matrix: | |
generator: [ "MinGW Makefiles", "Visual Studio 16 2019" ] | |
build_shared_libraries: [ true, false ] | |
name: "Windows 2019 (Generator: ${{ matrix.generator }}, Shared Library: ${{ matrix.build_shared_libraries }})" | |
runs-on: windows-2019 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Configure | |
run: | | |
cmake -G "${{ matrix.generator }}" -S c -B build ` | |
-DCMAKE_BUILD_TYPE=Release ` | |
-DBUILD_SHARED_LIBS=${{ matrix.build_shared_libraries }} ` | |
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" ` | |
-Dgtest_force_shared_crt=true ` | |
-DINSTALL_GTEST=false | |
- name: Build | |
run: cmake --build build | |
- name: Build Test | |
run: cmake --build build --target build-all-tests | |
- name: Run Test | |
run: cmake --build build --target do-all-tests | |
if: ${{ !matrix.build_shared_libraries }} | |
- name: Install | |
run: cmake --build build --target install | |
- name: Test Package | |
run: | | |
cmake -G "${{ matrix.generator }}" -S c/test_package -B c/test_package/build -DCMAKE_PREFIX_PATH="${{ github.workspace }}/install" | |
cmake --build c/test_package/build | |