Skip to content

Parallelism & Portability #109

Parallelism & Portability

Parallelism & Portability #109

Workflow file for this run

name: Test Python
on:
pull_request:
branches: ["main", "main-*"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
PYTHONUTF8: 1
PYTHONMALLOC: debug
jobs:
test_python:
name: Test Python ${{ matrix.python-version }} on ${{ matrix.architecture }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-15, windows-2025]
python-version: ["3.14", "3.10"]
architecture: [x64, arm64]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Print Machine Specs
shell: bash
run: |
echo "::group::Machine Information"
uname -a || true
cat /proc/cpuinfo 2>/dev/null | head -30 || sysctl -a machdep.cpu 2>/dev/null | head -30 || wmic cpu get Name,NumberOfCores,MaxClockSpeed 2>/dev/null || true
free -h 2>/dev/null || vm_stat 2>/dev/null || systeminfo 2>/dev/null | head -20 || true
echo "::endgroup::"
- name: Install Dependencies
uses: nick-fields/retry@v4
with:
max_attempts: 3
retry_wait_seconds: 10
timeout_minutes: 180
command: |
python -m pip install --no-cache-dir --upgrade pip
pip install --no-cache-dir py-cpuinfo pytest pytest-repeat pytest-randomly numpy scipy ml_dtypes tabulate
python -c "from cpuinfo import get_cpu_info; print(get_cpu_info())"
- name: Install Apt Dependencies
if: ${{ matrix.os == 'ubuntu-24.04' }}
uses: nick-fields/retry@v4
with:
max_attempts: 3
retry_wait_seconds: 10
timeout_minutes: 180
command: |
sudo apt-get update
gcc --version
# Apple Clang ships no `omp.h`; install Homebrew libomp so `pip install .`
# (which goes through setup.py and discovers libomp via `brew --prefix
# libomp`) resolves the OpenMP headers and the `-lomp` link. Unlike the
# wheel build in `pyproject.toml`'s `before-all`, this step does not go
# through `delocate-wheel`, so the bottle's deployment target doesn't
# matter β€” we just need the library present at build-and-load time.
- name: Install Brew Dependencies
if: ${{ matrix.os == 'macos-15' }}
run: brew install libomp
- name: Build Locally on Ubuntu
run: python -m pip install .
if: ${{ matrix.os == 'ubuntu-24.04' }}
- name: Build Locally on Other OS
run: python -m pip install .
if: ${{ matrix.os != 'ubuntu-24.04' }}
- name: Test with PyTest
run: |
python -c "import numkong; print(numkong.get_capabilities())"
pytest test/ -s -x -Wd -v