Skip to content

Merge pull request #1 from djad04/test-ci-actions #8

Merge pull request #1 from djad04/test-ci-actions

Merge pull request #1 from djad04/test-ci-actions #8

Workflow file for this run

name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
qt-version: ['6.8.2']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: ${{ matrix.qt-version }}
cache: true
cache-key-prefix: install-qt-action-${{ matrix.os }}-${{ matrix.qt-version }}
- name: Configure CMake
run: |
cd tests
cmake -B build -DCMAKE_BUILD_TYPE=Release
- name: Build tests
run: |
cd tests
cmake --build build --config Release
- name: Run tests
run: |
cd tests
ctest --test-dir build --output-on-failure --timeout 300 -C Release
- name: Upload test results
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-results-${{ matrix.os }}
path: tests/build/Testing/
coverage:
name: Code Coverage
runs-on: ubuntu-latest
timeout-minutes: 20
if: github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: '6.8.2'
cache: true
cache-key-prefix: install-qt-action-ubuntu-6.8.2
- name: Install coverage tools
run: |
sudo apt-get update
sudo apt-get install -y gcc lcov
- name: Configure CMake with coverage
run: |
cd tests
cmake -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="--coverage"
- name: Build and test with coverage
run: |
cd tests
cmake --build build
ctest --test-dir build --output-on-failure
- name: Generate coverage report
run: |
cd tests
lcov --capture --directory build --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
lcov --list coverage.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: tests/coverage.info
fail_ci_if_error: false