mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-05-06 06:26:17 +08:00
157 lines
3.8 KiB
YAML
157 lines
3.8 KiB
YAML
name: Build
|
|
|
|
on:
|
|
# On new commits to main:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
# On pull requests:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
|
|
test_bazel:
|
|
name: "Bazel, ${{ matrix.compiler }}, ${{ matrix.os }}"
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
compiler: gcc
|
|
|
|
- os: ubuntu-latest
|
|
compiler: llvm
|
|
|
|
- os: macos-latest
|
|
compiler: llvm
|
|
|
|
- os: macos-latest
|
|
compiler: gcc
|
|
|
|
- os: windows-latest
|
|
compiler: cl
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: "Checkout repository"
|
|
uses: actions/checkout@v3
|
|
|
|
- name: "Build with Bazel"
|
|
run: bazel build ...
|
|
|
|
- name: "Tests with Bazel"
|
|
run: bazel run tests
|
|
|
|
test_cmake:
|
|
name: "CMake, ${{ matrix.compiler }}, ${{ matrix.os }}"
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: Linux GCC
|
|
os: ubuntu-latest
|
|
compiler: gcc
|
|
|
|
- name: Linux Clang
|
|
os: ubuntu-latest
|
|
compiler: llvm
|
|
gcov_executable: "llvm-cov gcov"
|
|
|
|
- name: MacOS clang
|
|
os: macos-latest
|
|
compiler: llvm
|
|
gcov_executable: "llvm-cov gcov"
|
|
|
|
- name: Windows MSVC
|
|
os: windows-latest
|
|
compiler: cl
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Get number of CPU cores
|
|
uses: SimenB/github-actions-cpu-cores@v1
|
|
id: cpu-cores
|
|
|
|
- name: "Checkout repository"
|
|
uses: actions/checkout@v3
|
|
|
|
- name: "Setup Cpp"
|
|
uses: aminya/setup-cpp@v1
|
|
with:
|
|
compiler: ${{ matrix.compiler }}
|
|
vcvarsall: ${{ contains(matrix.os, 'windows' )}}
|
|
cmake: true
|
|
ninja: true
|
|
clangtidy: false
|
|
cppcheck: false
|
|
gcovr: "5.0"
|
|
opencppcoverage: true
|
|
|
|
# make sure coverage is only enabled for Debug builds, since it sets -O0
|
|
# to make sure coverage has meaningful results
|
|
- name: "Configure CMake"
|
|
run: >
|
|
cmake -S .
|
|
-B ./build
|
|
-DCMAKE_BUILD_TYPE:STRING=Debug
|
|
-DCMAKE_BUILD_PARALLEL_LEVEL=${{ steps.cpu-cores.outputs.count }}
|
|
-DFTXUI_ENABLE_COVERAGE:BOOL=ON
|
|
-DFTXUI_BUILD_DOCS:BOOL=OFF
|
|
-DFTXUI_BUILD_EXAMPLES:BOOL=ON
|
|
-DFTXUI_BUILD_TESTS:BOOL=ON
|
|
-DFTXUI_BUILD_TESTS_FUZZER:BOOL=OFF
|
|
-DFTXUI_ENABLE_INSTALL:BOOL=ON
|
|
-DFTXUI_DEV_WARNINGS:BOOL=ON ;
|
|
|
|
- name: "Build"
|
|
run: >
|
|
cmake
|
|
--build ./build
|
|
|
|
- name: Unix - Test
|
|
if: runner.os != 'Windows'
|
|
working-directory: ./build
|
|
run: >
|
|
ctest -C Debug --rerun-failed --output-on-failure;
|
|
|
|
- name: Unix - coverage
|
|
if: matrix.gcov_executable != ''
|
|
working-directory: ./build
|
|
run: >
|
|
gcovr
|
|
-j ${{env.nproc}}
|
|
--delete
|
|
--root ../
|
|
--exclude "../examples"
|
|
--exclude ".*google.*"
|
|
--exclude ".*test.*"
|
|
--exclude-unreachable-branches
|
|
--exclude-throw-branches
|
|
--sort-uncovered
|
|
--print-summary
|
|
--xml-pretty
|
|
--xml
|
|
coverage.xml
|
|
.
|
|
--gcov-executable '${{ matrix.gcov_executable }}';
|
|
|
|
- name: Windows - Test and coverage
|
|
if: runner.os == 'Windows'
|
|
working-directory: ./build
|
|
run: >
|
|
OpenCppCoverage.exe
|
|
--export_type cobertura:coverage.xml
|
|
--cover_children
|
|
--
|
|
ctest -C Debug --rerun-failed --output-on-failure;
|
|
|
|
- name: Publish to codecov
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
flags: ${{ runner.os }}
|
|
name: ${{ runner.os }}-coverage
|
|
files: ./build/coverage.xml
|