Skip to content

refactor: single DEB for header-only lib; backend selected by consume… #85

refactor: single DEB for header-only lib; backend selected by consume…

refactor: single DEB for header-only lib; backend selected by consume… #85

Workflow file for this run

# CI: build and test both backends on every push/PR.
#
# Two test jobs run in parallel:
# test-bitexact — NUMPYCPP_STD_ONLY=OFF (default)
# All 900 tests verify IEEE-754 bit-identical results vs numpy.
# Requires: numpy .so loaded (OpenBLAS + SVML dlsym), AVX-512 capable CPU.
#
# test-std — NUMPYCPP_STD_ONLY=ON
# Same API, pure <cmath> + C++ loops. ~423 precision-independent tests.
# No external math dependencies.
#
# DEB packaging: single DEB (header-only — backend is consumer's compile choice)
# cmake .. → numpycpp-dev-<ver>-Linux.deb
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
# ── Job 1: bit-exact backend ─────────────────────────────────────────────────
test-bitexact:
name: bitexact / Python ${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install Python dependencies
run: pip install "numpy>=1.23,<2.0" pybind11 pytest cmake
- name: Install system dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y libeigen3-dev
- name: Diagnose numpy symbols
run: |
python diagnose_numpy.py
grep -q avx512f /proc/cpuinfo && echo "AVX-512: present in cpuinfo" || echo "AVX-512: NOT in cpuinfo"
working-directory: tests
- name: Configure (bitexact)
run: cmake -S tests -B tests/build -DCMAKE_BUILD_TYPE=Release -DNUMPYCPP_STD_ONLY=OFF
- name: Build
run: cmake --build tests/build -j$(nproc)
- name: Run 900 bit-exact tests
run: |
cd tests
python -m pytest test_all.py -q --tb=short --no-header
# ── Job 2: std / performance-first backend ───────────────────────────────────
test-std:
name: std / Python ${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install Python dependencies
run: pip install "numpy>=1.23,<2.0" pybind11 pytest cmake
- name: Install system dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y libeigen3-dev
- name: Configure (std)
run: cmake -S tests -B tests/build_std -DCMAKE_BUILD_TYPE=Release -DNUMPYCPP_STD_ONLY=ON
- name: Build
run: cmake --build tests/build_std -j$(nproc)
- name: Run API-compatibility tests (std mode)
# std mode: skip tests that require bit-exact transcendental / BLAS results.
# All structural, reduction, manipulation, io, comparison, astype,
# and advanced-indexing tests still run (~423 / 900).
# test_unary_math — transcendental element-wise (exp/log/sin/…)
# test_dot/norm/matmul — linalg (BLAS vs C++ loops)
# TestEinsum — einsum (BLAS vs loops)
# test_avx512_boundary — AVX-512 path not present in std build
# nan/domain/signed_zero/_inf — transcendental edge cases
run: |
cd tests
python -m pytest test_all.py -q --tb=short --no-header -k "not (test_unary_math or test_dot or test_norm or test_matmul or TestEinsum or test_avx512_boundary or test_nan_passthrough or test_nan_mixed or test_domain or signed_zero or _inf or test_sign_inf)"
# ── Job 3: package DEB ───────────────────────────────────────────────────────
package:
name: Package DEB
runs-on: ubuntu-latest
needs: [test-bitexact, test-std]
steps:
- uses: actions/checkout@v4
- name: Build DEB
# Header-only: both backends ship in one DEB.
# Backend is selected by the consumer at cmake configure time
# via -DNUMPYCPP_STD_ONLY=ON/OFF.
run: |
cmake -S . -B build_deb
cmake --build build_deb --target deb
ls build_deb/numpycpp-dev-*.deb
- name: Upload DEB as artifact
uses: actions/upload-artifact@v4
with:
name: numpycpp-dev-deb
path: build_deb/numpycpp-dev-*.deb