Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 23 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v3.0.2
id: filter
with:
filters: |
Expand Down Expand Up @@ -44,24 +44,33 @@ jobs:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v6.1.0
with:
python-version: ${{ matrix.python-version }}

- name: Cache ccache
uses: actions/cache@v5
with:
path: ~/.ccache
key: ccache-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('CMakeLists.txt', 'pyproject.toml', '.github/workflows/ci.yml') }}
restore-keys: |
ccache-${{ runner.os }}-${{ matrix.python-version }}-
ccache-${{ runner.os }}-

- name: Install dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake lcov zlib1g-dev libsqlite3-dev pkg-config ninja-build
sudo apt-get install -y build-essential cmake ccache lcov zlib1g-dev libsqlite3-dev pkg-config ninja-build

- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew update
for f in cmake lcov zlib sqlite pkg-config ninja; do
for f in cmake ccache lcov zlib sqlite pkg-config ninja; do
if brew list --versions "$f" >/dev/null; then
echo "$f already installed"
else
Expand All @@ -80,24 +89,17 @@ jobs:
make test

- name: Run Python tests (with venv)
if: "!((matrix.os == 'ubuntu-22.04' || matrix.os == 'macos-latest') && matrix.python-version == '3.12')"
run: |
make test-py

- name: Run Python tests (without venv)
run: |
pip install --upgrade pip setuptools wheel
pip install -e ".[dev]"
pytest tests/python -v

- name: Type check (ty)
if: matrix.python-version == '3.12' && runner.os == 'Linux'
run: |
pip install ty
ty check --python "$(which python)" python/
if [ "${{ runner.os }}" = "Linux" ] && [ "${{ matrix.python-version }}" = "3.12" ]; then
make test-py RUN_TY=1
else
make test-py
fi

- name: Upload coverage reports to Coveralls
if: (matrix.os == 'ubuntu-22.04' || matrix.os == 'macos-latest') && matrix.python-version == '3.12'
uses: coverallsapp/github-action@v2
uses: coverallsapp/github-action@v2.3.6
continue-on-error: true
with:
file: coverage/coverage_filtered.info
Expand All @@ -113,7 +115,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Coveralls finished
uses: coverallsapp/github-action@v2
uses: coverallsapp/github-action@v2.3.6
continue-on-error: true
with:
parallel-finished: true
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/format-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
cpp: ${{ steps.filter.outputs.cpp }}
python: ${{ steps.filter.outputs.python }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v3.0.2
id: filter
with:
filters: |
Expand All @@ -35,7 +35,7 @@ jobs:
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Install clang-format
run: |
Expand All @@ -54,10 +54,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Install uv
uses: astral-sh/setup-uv@v4
uses: astral-sh/setup-uv@v8.0.0

- name: Ruff check
run: uvx ruff check python/ tests/python/
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/python-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ jobs:
os: [ubuntu-22.04, macos-14]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6

- name: Build wheels
uses: pypa/cibuildwheel@v3.2.1
uses: pypa/cibuildwheel@v3.3.0
env:
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux_* *-manylinux_aarch64 *-manylinux_ppc64le *-manylinux_s390x"

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v6.0.0
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
Expand All @@ -41,12 +41,12 @@ jobs:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6.1.0
with:
python-version: '3.12'

Expand All @@ -58,7 +58,7 @@ jobs:
- name: Build sdist
run: python -m build --sdist

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v6.0.0
with:
name: cibw-sdist
path: dist/*.tar.gz
Expand All @@ -70,7 +70,7 @@ jobs:
if: github.event_name == 'release' && github.event.action == 'published'

steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v8
with:
pattern: cibw-*
path: dist
Expand Down
8 changes: 0 additions & 8 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@ build:
python: "3.11"
apt_packages:
- doxygen
- cmake
- build-essential
- zlib1g-dev
- libsqlite3-dev
- pkg-config
jobs:
pre_build:
# Run Doxygen to generate C++ API documentation
- cd docs && doxygen Doxyfile

# Build documentation in the "docs/" directory with Sphinx
Expand All @@ -35,5 +29,3 @@ formats:
python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ project(
VERSION ${DFTRACER_UTILS_VERSION}
LANGUAGES C CXX)

find_program(CCACHE_EXECUTABLE ccache)
if(CCACHE_EXECUTABLE)
foreach(lang C CXX ASM)
if(NOT CMAKE_${lang}_COMPILER_LAUNCHER)
set(CMAKE_${lang}_COMPILER_LAUNCHER
"${CCACHE_EXECUTABLE}"
CACHE STRING "Compiler launcher for ${lang}" FORCE)
endif()
endforeach()
message(STATUS "Using ccache: ${CCACHE_EXECUTABLE}")
endif()

set(DFTRACER_UTILS_PACKAGE ${PROJECT_NAME})
set(DFTRACER_UTILS_PACKAGE_NAME ${PROJECT_NAME})
set(DFTRACER_UTILS_PACKAGE_VERSION "${PROJECT_VERSION}")
Expand Down
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.PHONY: coverage coverage-clean coverage-view coverage-open test test-coverage test-py build clean format check-format cmake-format lint typecheck help

RUN_TY ?= 0

# Detect build system
BUILD_GENERATOR := $(shell command -v ninja >/dev/null 2>&1 && echo "Ninja" || echo "Unix Makefiles")
BUILD_TOOL := $(shell command -v ninja >/dev/null 2>&1 && echo "ninja" || echo "make")
Expand Down Expand Up @@ -65,8 +67,15 @@ test-py:
@rm -rf .venv_test_py
@python3 -m venv .venv_test_py
@.venv_test_py/bin/pip install --upgrade pip setuptools wheel
@.venv_test_py/bin/pip install -e .[dev]
@if [ "$(RUN_TY)" = "1" ]; then \
.venv_test_py/bin/pip install -e .[dev] ty; \
else \
.venv_test_py/bin/pip install -e .[dev]; \
fi
@.venv_test_py/bin/pytest tests/python -v
@if [ "$(RUN_TY)" = "1" ]; then \
.venv_test_py/bin/ty check --python "$$(pwd)/.venv_test_py/bin/python" python/; \
fi
@rm -rf .venv_test_py
@echo "Python tests completed successfully!"

Expand Down
26 changes: 23 additions & 3 deletions cmake/modules/CPM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
#
# SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors

set(CPM_DOWNLOAD_VERSION 0.42.0)
set(CPM_DOWNLOAD_VERSION 0.42.1)
set(CPM_HASH_SUM
"2020b4fc42dba44817983e06342e682ecfc3d2f484a581f11cc5731fbe4dce8a")
"f3a6dcc6a04ce9e7f51a127307fa4f699fb2bade357a8eb4c5b45df76e1dc6a5")
set(CPM_VENDORED_LOCATION
"${CMAKE_CURRENT_LIST_DIR}/../vendor/CPM_${CPM_DOWNLOAD_VERSION}.cmake")

if(CPM_SOURCE_CACHE)
set(CPM_DOWNLOAD_LOCATION
Expand All @@ -21,10 +23,28 @@ endif()
# (~)
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE)

if(EXISTS "${CPM_VENDORED_LOCATION}")
get_filename_component(CPM_DOWNLOAD_DIR "${CPM_DOWNLOAD_LOCATION}" DIRECTORY)
file(MAKE_DIRECTORY "${CPM_DOWNLOAD_DIR}")
file(COPY_FILE "${CPM_VENDORED_LOCATION}" "${CPM_DOWNLOAD_LOCATION}" ONLY_IF_DIFFERENT)
include("${CPM_DOWNLOAD_LOCATION}")
return()
endif()

file(
DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
${CPM_DOWNLOAD_LOCATION}
EXPECTED_HASH SHA256=${CPM_HASH_SUM})
EXPECTED_HASH SHA256=${CPM_HASH_SUM}
STATUS CPM_DOWNLOAD_STATUS)

list(GET CPM_DOWNLOAD_STATUS 0 CPM_DOWNLOAD_STATUS_CODE)
if(NOT CPM_DOWNLOAD_STATUS_CODE EQUAL 0)
list(GET CPM_DOWNLOAD_STATUS 1 CPM_DOWNLOAD_STATUS_MESSAGE)
message(
FATAL_ERROR
"Failed to download CPM.cmake v${CPM_DOWNLOAD_VERSION}: ${CPM_DOWNLOAD_STATUS_MESSAGE}. "
"Either restore network access or vendor the file at ${CPM_VENDORED_LOCATION}.")
endif()

include(${CPM_DOWNLOAD_LOCATION})
Loading
Loading