Skip to content

Merge pull request #9 from pravirkr/ddmt #28

Merge pull request #9 from pravirkr/ddmt

Merge pull request #9 from pravirkr/ddmt #28

Workflow file for this run

name: GitHub CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
cpp-ubuntu:
name: "C++ (${{ matrix.os }}, ${{ matrix.compiler.cpp }})"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
build_type: [Debug]
compiler: [{cpp: g++-12, code-cov: true, gcov: gcov-12}, {cpp: clang++-15}]
steps:
- uses: actions/checkout@v4
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure CMake
shell: bash
id: configure
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.compiler.cpp }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DBUILD_DOCS=OFF -DBUILD_PYTHON=OFF -DBUILD_TESTING=ON
-DCODE_COVERAGE=${{ matrix.compiler.code-cov }}
- name: Build
run: >
cmake --build ${{ steps.strings.outputs.build-output-dir }}
--config ${{ matrix.build_type }} -j 4
- name: Run unit tests
run: >
ctest --build-config ${{ matrix.build_type }} --output-on-failure
--test-dir ${{ steps.strings.outputs.build-output-dir }}/tests/cpp
- name: Prepare coverage report
if: ${{ matrix.build_type == 'Debug' && matrix.compiler.code-cov }}
run: |
pip install gcovr>=7.1
gcovr -r . --cobertura -o coverage.xml --gcov-executable=${{ matrix.compiler.gcov }}
- name: Upload coverage reports to Codecov
if: ${{ matrix.build_type == 'Debug' && matrix.compiler.code-cov }}
uses: codecov/codecov-action@v4
with:
file: coverage.xml
name: codecov-umbrella
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
python:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.9', '3.10']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install it
run: |
python -m pip install -U pip setuptools wheel
python -m pip install .[tests] -v
- name: Lint with Ruff
uses: chartboost/ruff-action@v1
with:
args: "check"
continue-on-error: true
- name: Check types with mypy
run: |
mypy --strict src/dmt
continue-on-error: true
- name: Test with pytest and Generate coverage report
run: |
pytest --cov=./ --cov-report=xml tests/python
continue-on-error: false