Skip to content

Additions to the parallelism library. #2204

Additions to the parallelism library.

Additions to the parallelism library. #2204

Workflow file for this run

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Part of BlueTit Solver, licensed under Apache 2.0 with Commons Clause.
# Commercial use, including SaaS, requires a separate license, see /LICENSE.md
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
name: Analyze
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
# Cancel previous runs.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
analyze:
name: Analyze
strategy:
matrix:
os: [ubuntu-24.04]
compiler: [g++-14]
configuration: [Coverage]
runs-on: ${{ matrix.os }}
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory
CXX_COVERAGE_REPORT_PATH_CODECOV: cxx_coverage_codecov.xml
CXX_COVERAGE_REPORT_PATH_SONAR: cxx_coverage_sonar.xml
JS_COVERAGE_REPORT_PATH: source/titfront/coverage/lcov.info
PYTHON_COVERAGE_REPORT_PATH: python_coverage.xml
# To be set by the steps.
VCPKG_ROOT:
VCPKG_DEFAULT_BINARY_CACHE:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Fetch all history for proper analysis and coverage reports.
fetch-depth: 0
- name: Install packages and tools
run: ./build/setup-ci-runner.sh
- name: Install Sonar Scanner
uses: SonarSource/sonarcloud-github-c-cpp@v2
- name: Restore vcpkg packages cache
id: vcpkg-cache-restore
uses: actions/cache/restore@v4
with:
path: |
${{ env.VCPKG_ROOT }}/installed
${{ env.VCPKG_ROOT }}/buildtrees
${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
# Use the run ID as the cache key, this way the cache is updated
# after each run.
key: vcpkg-${{ runner.os }}-${{ matrix.compiler }}-${{ github.run_id }}
restore-keys: vcpkg-${{ runner.os }}-${{ matrix.compiler }}
- name: Install vcpkg packages
run: $VCPKG_ROOT/vcpkg install
env:
CXX: ${{ matrix.compiler }}
- name: Update vcpkg packages cache
uses: actions/cache/save@v4
with:
path: |
${{ env.VCPKG_ROOT }}/installed
${{ env.VCPKG_ROOT }}/buildtrees
${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
key: ${{ steps.vcpkg-cache-restore.outputs.cache-primary-key }}
- name: Build
run: |
build-wrapper-linux-x86-64 \
--out-dir "${{ env.BUILD_WRAPPER_OUT_DIR }}" \
./build/build.sh --force \
--compiler ${{ matrix.compiler }} \
--config ${{ matrix.configuration }}
- name: Run tests
run: ./build/test.sh
- name: Collect coverage reports
run: |
# Generate C++ coverage report.
GCOV_EXE="${{ matrix.compiler }}"
GCOV_EXE="${GCOV_EXE/g++/gcov}"
gcovr \
--gcov-executable "$GCOV_EXE" \
--exclude "output/.*" \
--exclude "tests/.*" \
--exclude ".*\.test.*" \
--exclude-unreachable-branches \
--exclude-throw-branches \
--xml "${{ env.CXX_COVERAGE_REPORT_PATH_CODECOV }}" \
--sonarqube "${{ env.CXX_COVERAGE_REPORT_PATH_SONAR }}"
# Generate Python coverage report.
find output/test_output -name ".coverage" | xargs coverage combine
coverage xml -o "${{ env.PYTHON_COVERAGE_REPORT_PATH }}"
- name: Upload test output
uses: actions/upload-artifact@v4
if: always()
with:
name: test-output-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.configuration }}
path: output/test_output
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: Jhuighuy/TitSolver
files: ${{ env.CXX_COVERAGE_REPORT_PATH_CODECOV }},${{ env.JS_COVERAGE_REPORT_PATH }},${{ env.PYTHON_COVERAGE_REPORT_PATH }}
disable_search: true
- name: Run Sonar Scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner \
--define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \
--define sonar.coverageReportPaths="${{ env.CXX_COVERAGE_REPORT_PATH_SONAR }}" \
--define sonar.javascript.lcov.reportPaths="${{ env.JS_COVERAGE_REPORT_PATH }}" \
--define sonar.python.coverage.reportPaths="${{ env.PYTHON_COVERAGE_REPORT_PATH }}"