Skip to content

Dev/master (#197)

Dev/master (#197) #146

Workflow file for this run

name: Continuous Integration
on:
push:
branches: [ master ]
paths-ignore:
- "docs/**"
- "*.md"
pull_request:
branches: [ master ]
paths-ignore:
- "docs/**"
- "*.md"
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
os: [ubuntu-latest, macos-latest, windows-latest]
# Exclude Python 3.13 on Windows due to segmentation fault issues
exclude:
- os: windows-latest
python-version: "3.13"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y pkg-config gfortran g++
# Install OpenBLAS for scipy builds (needed for Python 3.13)
if [[ "${{ matrix.python-version }}" == "3.13" ]]; then
sudo apt-get install -y libopenblas-dev liblapack-dev
fi
- name: Install system dependencies (macOS)
if: matrix.os == 'macos-latest'
run: |
brew update
brew install pkg-config
# Install gcc, gfortran, and OpenBLAS for Python versions that need compilation
if [[ "${{ matrix.python-version }}" == "3.13" ]]; then
brew install gcc gfortran openblas
# Add Homebrew's bin directory to PATH to ensure gcc and gfortran are found
echo "$(brew --prefix)/bin" >> $GITHUB_PATH
fi
- name: Install dependencies for tox
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
pip install poetry
- name: Install project dependencies with retry
# Use poetry install with retry logic for network issues
shell: bash
run: |
# Try with system dependencies first, fall back to source if needed
poetry config virtualenvs.create true
poetry config virtualenvs.in-project false
# For Python 3.13, try to install with --no-build-isolation first
if [[ "${{ matrix.python-version }}" == "3.13" ]]; then
# Use environment variables to help with compilation
if [[ "${{ matrix.os }}" == "macos-latest" ]]; then
export LDFLAGS="-L$(brew --prefix zlib)/lib"
export CPPFLAGS="-I$(brew --prefix zlib)/include"
fi
# Try to install with system site packages enabled for system libraries
poetry install --no-root --without dev --no-interaction || \
echo "First attempt failed, retrying with different options..."
# Fallback: try using pip directly with pre-compiled wheels where possible
python -m pip install --upgrade setuptools wheel
# For problematic packages, try to get pre-compiled wheels
if [[ "${{ matrix.os }}" == "macos-latest" ]]; then
python -m pip install --only-binary :all: numpy scipy matplotlib || \
python -m pip install numpy scipy matplotlib --no-build-isolation
fi
else
poetry install --no-root --without dev --no-interaction
fi
- name: Run unit tests
shell: bash
env:
# For Python 3.13 compilation
NPY_DISTUTILS_APPEND_FLAGS: 1
run: |
# Use tox-gh-actions to select the right tox environment
tox
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies for linters
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
pip install poetry
poetry install --no-root
- name: Run linters (mypy, codespell, docs)
run: |
tox