Skip to content

Feat/rsquest

Feat/rsquest #428

Workflow file for this run

name: Python test / linting
env:
TRIGGER_ON_PR_PUSH: true # Set to true to enable triggers on PR pushes
RUSTFLAGS: -C debuginfo=0
RUST_BACKTRACE: 1
PYTHONUTF8: 1
on:
push:
branches: [ "master", "development", "dev" ]
pull_request:
branches: [ "master", "development", "dev" ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
python-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up Visual Studio environment on Windows
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: Set up Rust
run: rustup show
- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
workspaces: python/pecos-rslib
- name: Build and test PECOS (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
# Find MSVC link.exe and create cargo config
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vsPath = & $vsWhere -latest -property installationPath
$linkPath = Get-ChildItem -Path "$vsPath\VC\Tools\MSVC" -Recurse -Filter "link.exe" |
Where-Object { $_.FullName -like "*\bin\Hostx64\x64\*" } |
Select-Object -First 1 -ExpandProperty FullName
if ($linkPath) {
Write-Host "Found MSVC link.exe at: $linkPath"
# Create .cargo directory and config
New-Item -ItemType Directory -Force -Path .cargo | Out-Null
# Create config with escaped path
$escapedPath = $linkPath.Replace('\', '/')
"[target.x86_64-pc-windows-msvc]" | Out-File -FilePath ".cargo\config.toml" -Encoding UTF8
"linker = `"$escapedPath`"" | Out-File -FilePath ".cargo\config.toml" -Encoding UTF8 -Append
Write-Host "Created .cargo\config.toml:"
Get-Content .cargo\config.toml
} else {
Write-Error "Could not find MSVC link.exe"
exit 1
}
# Build and test
make build
make pytest-all
- name: Build and test PECOS (non-Windows)
if: runner.os != 'Windows'
run: |
# On macOS, set up minimal environment for matplotlib compatibility
if [[ "${{ runner.os }}" == "macOS" ]]; then
# Set matplotlib backend to avoid GUI issues
export MPLBACKEND=Agg
export MATPLOTLIB_INTERACTIVE=false
# Try to fix matplotlib segfault by limiting threading
export OPENBLAS_NUM_THREADS=1
export MKL_NUM_THREADS=1
export NUMEXPR_NUM_THREADS=1
export OMP_NUM_THREADS=1
# Disable macOS System Integrity Protection library validation
# This can help with library loading issues
export DYLD_LIBRARY_PATH=""
# Force matplotlib to use bundled libraries instead of system ones
export MPLCONFIGDIR=$PWD/.matplotlib
mkdir -p $MPLCONFIGDIR
fi
# Build and test
make build
make pytest-all
- name: Run linting
run: |
# Run all linting checks
make lint # Rust checks + Python pre-commit