Skip to content

Commit 4ff144b

Browse files
author
peng.li24
committed
ci: add GitHub Actions workflow + CI badge (closes #1)
- .github/workflows/ci.yml: Python 3.10/3.11/3.12 × GCC matrix * pip install numpy pybind11 pytest cmake * apt install libeigen3-dev libgomp1 * avx512f hardware check (required for dlsym SVML bridge) * cmake -S tests -B tests/build → build → pytest test_all.py - README: add CI badge + tests-792-bit-exact badge
1 parent c653371 commit 4ff144b

2 files changed

Lines changed: 53 additions & 32 deletions

File tree

.github/workflows/ci.yml

Lines changed: 51 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,68 @@
1+
# Bit-exact CI: every push/PR must pass all 792 IEEE-754 tests.
2+
#
3+
# Requirements driving the setup:
4+
# - numpy must be pip-installed (its bundled OpenBLAS exposes sdot_64_ /
5+
# cblas_sgemm64_ / __svml_exp8 etc. that numpycpp resolves via dlsym)
6+
# - AVX-512 hardware is required at runtime (-mavx512f compile flag +
7+
# __attribute__((target)) guards; GitHub ubuntu-latest uses Intel Xeon
8+
# which supports AVX-512)
9+
# - pybind11, Eigen3, OpenMP needed to build the test extension module
10+
111
name: CI
212

313
on:
414
push:
5-
branches: [master]
6-
tags: ['v*']
15+
branches: [ master, bit-exact ]
716
pull_request:
8-
branches: [master]
17+
branches: [ master ]
918

1019
jobs:
11-
# ---- Test: build module + run 500 precision tests --------------------------
1220
test:
13-
runs-on: ubuntu-22.04
21+
name: bit-exact tests — Python ${{ matrix.python }} / ${{ matrix.compiler }}
22+
runs-on: ubuntu-latest
23+
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
include:
28+
- python: "3.10"
29+
compiler: g++
30+
- python: "3.11"
31+
compiler: g++
32+
- python: "3.12"
33+
compiler: g++
34+
1435
steps:
1536
- uses: actions/checkout@v4
1637

17-
- name: Install dependencies
18-
run: |
19-
sudo apt-get update
20-
sudo apt-get install -y python3 python3-pip python3-dev libeigen3-dev
21-
pip3 install pybind11 numpy pytest
22-
23-
- name: Build test module
24-
run: make -C tests
38+
- name: Set up Python ${{ matrix.python }}
39+
uses: actions/setup-python@v5
40+
with:
41+
python-version: ${{ matrix.python }}
2542

26-
- name: Run tests
27-
run: make -C tests test
43+
- name: Install Python dependencies
44+
run: pip install "numpy>=1.23" pybind11 pytest cmake
2845

29-
# ---- Release: build .deb and publish on tag -------------------------------
30-
release:
31-
if: startsWith(github.ref, 'refs/tags/v')
32-
needs: test
33-
runs-on: ubuntu-22.04
34-
steps:
35-
- uses: actions/checkout@v4
46+
- name: Install system dependencies
47+
run: |
48+
sudo apt-get update -qq
49+
sudo apt-get install -y libeigen3-dev libgomp1 libgomp1-dev
3650
37-
- name: Build .deb
51+
- name: Verify AVX-512 support
3852
run: |
39-
mkdir build && cd build
40-
cmake .. -DCMAKE_BUILD_TYPE=Release
41-
make deb
53+
grep -q avx512f /proc/cpuinfo \
54+
&& echo "✓ AVX-512 supported" \
55+
|| (echo "✗ AVX-512 not detected — tests may SIGILL"; exit 1)
4256
43-
- name: Publish release
44-
uses: softprops/action-gh-release@v2
45-
with:
46-
files: build/numpycpp-dev-*.deb
47-
generate_release_notes: true
57+
- name: Configure
58+
run: cmake -S tests -B tests/build -DCMAKE_BUILD_TYPE=Release
4859
env:
49-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
CXX: ${{ matrix.compiler }}
61+
62+
- name: Build
63+
run: cmake --build tests/build -j$(nproc)
64+
65+
- name: Run bit-exact tests
66+
run: |
67+
cd tests
68+
python -m pytest test_all.py -q --tb=short --no-header

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# numpycpp
22

3+
[![CI](https://github.com/array2d/numpycpp/actions/workflows/ci.yml/badge.svg)](https://github.com/array2d/numpycpp/actions/workflows/ci.yml)
34
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
45
[![C++17](https://img.shields.io/badge/C%2B%2B-17-blue.svg)](https://en.cppreference.com/w/cpp/17)
56
[![CMake](https://img.shields.io/badge/CMake-%3E%3D3.16-green.svg)](https://cmake.org/)
7+
[![Tests](https://img.shields.io/badge/tests-792%20bit--exact-brightgreen.svg)](tests/test_all.py)
68
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md)
79

810
## Background

0 commit comments

Comments
 (0)