Skip to content

Commit

Permalink
feat: update CI configuration
Browse files Browse the repository at this point in the history
Update CI config for Ubuntu to run builds against multiple OS versions as well as multiple versions of `GCC` and `LLVM`.
  • Loading branch information
DeveloperPaul123 authored Apr 26, 2024
1 parent 9e94e28 commit d92a868
Showing 1 changed file with 78 additions and 39 deletions.
117 changes: 78 additions & 39 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,74 @@ env:
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules

jobs:
build:

build-gcc:
name: "gcc-${{ matrix.version }}"
runs-on: ${{ matrix.os }}
env:
CPP_STANDARD: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-latest]
version: [11]
include:
- os: ubuntu-latest
version: 12
steps:
- uses: actions/checkout@v3

- uses: actions/cache@v3
with:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}

- name: set up GCC
uses: egor-tensin/setup-gcc@v1
with:
version: ${{matrix.version}}
platform: x64

- name: configure gcc
run: cmake -S . -B build -DTP_BUILD_EXAMPLES=OFF -DTP_BUILD_BENCHMARKS=OFF -DTP_THREAD_SANITIZER=OFF -DCMAKE_BUILD_TYPE=Debug

- name: build
run: cmake --build build -j4

- name: test
run: |
cd build
ctest --build-config Debug
- name: Set up coverage tools
run: |
sudo apt-get install lcov gcovr -y
if: matrix.version == 11 && matrix.os == 'ubuntu-20.04'

- name: Generate coverage report
working-directory: ${{github.workspace}}/build/test/CMakeFiles/thread-pool-tests.dir
run: |
lcov --directory . --capture --gcov gcov-11 --output-file coverage.info
lcov --remove coverage.info '*/test/*' --output-file coverage.info
if: matrix.version == 11 && matrix.os == 'ubuntu-20.04'

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
files: ${{github.workspace}}/build/test/CMakeFiles/thread-pool-tests.dir/coverage.info
if: matrix.version == 11 && matrix.os == 'ubuntu-20.04'

build-clang:
name: "clang-${{matrix.version}}"
runs-on: ubuntu-20.04
env:
CPP_STANDARD: 20
strategy:
fail-fast: false
max-parallel: 4

env:
CPP_STANDARD: 20

matrix:
version: [14, 15, 16, 17, 18]

steps:
- uses: actions/checkout@v3

Expand All @@ -30,53 +89,33 @@ jobs:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}

- name: Set up Clang
uses: egor-tensin/setup-clang@v1
with:
version: 14
platform: x64

# clang needs GCC
- name: set up GCC
uses: egor-tensin/setup-gcc@v1
with:
version: 11
platform: x64

- name: configure gcc
run: cmake -S . -B build -DTP_BUILD_EXAMPLES=OFF -DTP_BUILD_BENCHMARKS=OFF -DTP_THREAD_SANITIZER=OFF -DCMAKE_BUILD_TYPE=Debug
- name: Install libs
run: |
sudo apt-get update
sudo apt-get install build-essential -y
- name: Set up Clang
run: |
wget -O llvm.sh https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh ${{matrix.version}}
- name: configure clang
run: cmake -S . -B build-clang -DTP_BUILD_EXAMPLES=OFF -DTP_BUILD_BENCHMARKS=OFF -DTP_THREAD_SANITIZER=OFF -DCMAKE_BUILD_TYPE=Debug
env:
CC: clang
CXX: clang++
CC: clang-${{matrix.version}}
CXX: clang++-${{matrix.version}}

- name: build
run: |
cmake --build build -j4
cmake --build build-clang -j4
- name: test
run: |
cd build
ctest --build-config Debug
run: cmake --build build-clang -j4

- name: test clang
run: |
cd build-clang
ctest --build-config Debug
- name: Set up coverage tools
run: |
sudo apt-get install lcov gcovr -y
- name: Generate coverage report
working-directory: ${{github.workspace}}/build/test/CMakeFiles/thread-pool-tests.dir
run: |
lcov --directory . --capture --gcov gcov-11 --output-file coverage.info
lcov --remove coverage.info '*/test/*' --output-file coverage.info
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
files: ${{github.workspace}}/build/test/CMakeFiles/thread-pool-tests.dir/coverage.info

0 comments on commit d92a868

Please sign in to comment.