Skip to content

Testing

Testing #1

name: Build & Test (CPU only)
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
workflow_dispatch:
jobs:
build-test-linux:
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [gcc-11, gcc-12, gcc-13, gcc-14, clang-14, clang-15, clang-16, clang-17, clang-18]
build-type: [Debug, Release]
python-version: [3.8, 3.9, 3.10, 3.11, 3.12]
include:
- compiler: gcc-11
cxx: g++-11
cc: gcc-11
- compiler: gcc-12
cxx: g++-12
cc: gcc-12
- compiler: gcc-13
cxx: g++-13
cc: gcc-13
- compiler: gcc-14
cxx: g++-14
cc: gcc-14
- compiler: clang-14
cxx: clang++-14
cc: clang-14
- compiler: clang-15
cxx: clang++-15
cc: clang-15
- compiler: clang-16
cxx: clang++-16
cc: clang-16
- compiler: clang-17
cxx: clang++-17
cc: clang-17
- compiler: clang-18
cxx: clang++-18
cc: clang-18
steps:
- name: Checkout hws
uses: actions/checkout@v4.2.0
- name: Install dependencies
run: |
sudo apt update
sudo apt-get install -y \
${{ matrix.cc }} \
${{ matrix.cxx }} \
python${{ matrix.python-version }} \
python${{ matrix.python-version }}-dev \
python3-pip \
libfmt-dev
- name: Install pytest
run: |
python${{ matrix.python-version }} -m pip install pytest numpy matplotlib
- name: Configure CMake
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DHWS_ENABLE_CPU_SAMPLING=ON \
-DHWS_ENABLE_GPU_NVIDIA_SAMPLING=OFF \
-DHWS_ENABLE_GPU_AMD_SAMPLING=OFF \
-DHWS_ENABLE_GPU_INTEL_SAMPLING=OFF \
-DHWS_ENABLE_PYTHON_BINDINGS=ON \
-DHWS_ENABLE_ERROR_CHECKS=OFF \
..
- name: Build
run: |
cd build
cmake --build .
- name: Run Python tests
run: |
cd build
python${{ matrix.python-version }} -m pytest ../bindings/tests/ 2>/dev/null || echo "No tests found"
python${{ matrix.python-version }} -c "import sys; sys.path.insert(0, '.'); import HardwareSampling" || echo "Python bindings test skipped"
- name: Run example
run: |
cd build
ctest -R example_cpp --output-on-failure
build-test-macos:
runs-on: macos-latest
strategy:
matrix:
build-type: [Debug, Release]
python-version: [3.9, 3.10, 3.11, 3.12]
steps:
- name: Checkout hws
uses: actions/checkout@v4.2.0
- name: Install dependencies
run: |
brew install fmt pybind11 python@${{ matrix.python-version }}
- name: Install pytest
run: |
python${{ matrix.python-version }} -m pip install pytest numpy matplotlib
- name: Configure CMake
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DHWS_ENABLE_CPU_SAMPLING=ON \
-DHWS_ENABLE_GPU_NVIDIA_SAMPLING=OFF \
-DHWS_ENABLE_GPU_AMD_SAMPLING=OFF \
-DHWS_ENABLE_GPU_INTEL_SAMPLING=OFF \
-DHWS_ENABLE_PYTHON_BINDINGS=ON \
-DHWS_ENABLE_ERROR_CHECKS=OFF \
-DPython_EXECUTABLE=$(which python${{ matrix.python-version }}) \
..
- name: Build
run: |
cd build
cmake --build .
- name: Run example
run: |
cd build
ctest -R example_cpp --output-on-failure
build-test-windows:
runs-on: windows-latest
strategy:
matrix:
build-type: [Debug, Release]
python-version: [3.9, 3.10, 3.11, 3.12]
steps:
- name: Checkout hws
uses: actions/checkout@v4.2.0
- name: Setup Python
uses: actions/setup-python@v5.0.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install cmake
choco install fmt -y
- name: Install pytest
run: |
python -m pip install pytest numpy matplotlib
- name: Configure CMake
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} `
-DHWS_ENABLE_CPU_SAMPLING=OFF `
-DHWS_ENABLE_GPU_NVIDIA_SAMPLING=OFF `
-DHWS_ENABLE_GPU_AMD_SAMPLING=OFF `
-DHWS_ENABLE_GPU_INTEL_SAMPLING=OFF `
-DHWS_ENABLE_PYTHON_BINDINGS=ON `
-DHWS_ENABLE_ERROR_CHECKS=OFF `
..
- name: Build
run: |
cd build
cmake --build . --config ${{ matrix.build-type }}
- name: Run example
run: |
cd build
ctest -R example_cpp --output-on-failure --build-config ${{ matrix.build-type }}