geocore/.github/workflows/ccpp.yml
2019-11-01 18:25:05 +03:00

58 lines
1.7 KiB
YAML

name: C/C++ CI
on: [push]
jobs:
build_gcc:
name: Ubuntu GCC build and unit tests
runs-on: ubuntu-18.04
steps:
- name: Update package index
run: sudo apt-get update
- name: Install boost and lcov
run: sudo apt install libboost-all-dev lcov
- name: Clone repo
uses: actions/checkout@v1
with:
submodules: true
- name: Configure
run: cmake -DCODE_COVERAGE=ON -DCMAKE_BUILD_TYPE=Debug .
- name: Build
run: make -j $(nproc)
env:
CLICOLOR_FORCE: 1
- name: Unit tests
run: make test
env:
CTEST_OUTPUT_ON_FAILURE: 1
- name: Coverage
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
GITHUB_REF: ${{ secrets.GITHUB_REF }}
GITHUB_SHA: ${{ secrets.GITHUB_SHA }}
run: |
lcov --capture --directory . --output-file coverage.info
lcov --remove coverage.info "/usr/*" "$(pwd)/3party/*" "*/googletest-src/*" --output-file coverage.info # filter external
lcov --list coverage.info # debug info
# Uploading report to CodeCov
curl -s https://codecov.io/bash | bash -s -- -f coverage.info -B ${GITHUB_REF#refs/heads/} -C ${GITHUB_SHA} || echo "Codecov did not collect coverage reports"
build_clang:
name: MacOS Clang build and unit tests
runs-on: macOS-latest
steps:
- name: Install Boost
run: brew install boost
- name: Clone repo
uses: actions/checkout@v1
with:
submodules: true
- name: Configure
run: cmake .
- name: Build
run: make -j $(sysctl -n hw.ncpu)
env:
CLICOLOR_FORCE: 1
- name: Unit tests
run: make test
env:
CTEST_OUTPUT_ON_FAILURE: 1