Skip to content

Simplify CI to basic Python 3.8 Linux build #33

Simplify CI to basic Python 3.8 Linux build

Simplify CI to basic Python 3.8 Linux build #33

Workflow file for this run

name: Build and Test Wheels
on:
push:
branches: [main, master, feature/ci-cd]
pull_request:
branches: [main, master]
workflow_dispatch:
jobs:
build_wheel:
name: Build wheel on Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Checkout CFD C library
- name: Checkout CFD C library
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/cfd
path: cfd
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build scikit-build-core setuptools-scm
- name: Build CFD library
run: |
cmake -S cfd -B cfd/build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON
cmake --build cfd/build --config Release
echo "=== CFD library built ==="
ls -la cfd/build/lib/
- name: Build wheel
env:
CFD_ROOT: ./cfd
CFD_STATIC_LINK: "ON"
CFD_USE_STABLE_ABI: "OFF"
run: |
python -m build --wheel
echo "=== Wheel built ==="
ls -la dist/
- name: Inspect wheel contents
run: |
for wheel in dist/*.whl; do
echo "=== Contents of $wheel ==="
python -m zipfile -l "$wheel"
done
- uses: actions/upload-artifact@v4
with:
name: wheel
path: dist/*.whl
test_wheel:
name: Test wheel
needs: [build_wheel]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: "3.8"
- uses: actions/download-artifact@v4
with:
name: wheel
path: dist
- name: Install wheel
run: |
python -m pip install --upgrade pip
pip install dist/*.whl
pip install pytest numpy
- name: Test import
run: |
python -c "
import cfd_python
print('Package loaded:', cfd_python.__file__)
print('Version:', cfd_python.__version__)
print('Has list_solvers:', hasattr(cfd_python, 'list_solvers'))
if hasattr(cfd_python, 'list_solvers'):
print('Solvers:', cfd_python.list_solvers())
"
- name: Run tests
run: pytest tests/ -v