Accept dict as preprocessor config #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: In pull request | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
check_python_linting: | |
name: Ruff Linting & Formatting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: chartboost/ruff-action@v1 | |
with: | |
src: "./src ./tests" | |
version: 0.8.6 | |
- uses: chartboost/ruff-action@v1 | |
with: | |
src: "./src ./tests" | |
version: 0.8.6 | |
args: 'format --check' | |
test_compatibility: | |
name: Test Package Compatibility | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
python-version: "3.9" | |
dependency-set: minimum | |
- os: macos-13 # macos-latest doesn't work with python 3.10 | |
# https://github.com/actions/setup-python/issues/855 | |
python-version: "3.9" | |
dependency-set: minimum | |
- os: ubuntu-latest | |
python-version: "3.12" | |
dependency-set: maximum | |
- os: macos-latest | |
python-version: "3.12" | |
dependency-set: maximum | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
- name: Generate requirements file for minimum dependencies | |
if: matrix.dependency-set == 'minimum' | |
run: | | |
python << EOF | |
import re | |
with open('pyproject.toml', 'r') as f: | |
content = f.read() | |
# Find dependencies section using regex | |
deps_match = re.search(r'dependencies\s*=\s*\[(.*?)\]', content, re.DOTALL) | |
if deps_match: | |
deps = [d.strip(' "\'') for d in deps_match.group(1).strip().split('\n') if d.strip()] | |
min_reqs = [] | |
for dep in deps: | |
match = re.match(r'([^>=<\s]+)\s*>=\s*([^,\s"\']+)', dep) | |
if match: | |
package, min_ver = match.groups() | |
min_reqs.append(f"{package}=={min_ver}") | |
with open('requirements.txt', 'w') as f: | |
f.write('\n'.join(min_reqs)) | |
EOF | |
- name: Generate requirements file for maximum dependencies | |
if: matrix.dependency-set == 'maximum' | |
run: | | |
python << EOF | |
import re | |
with open('pyproject.toml', 'r') as f: | |
content = f.read() | |
# Find dependencies section using regex | |
deps_match = re.search(r'dependencies\s*=\s*\[(.*?)\]', content, re.DOTALL) | |
if deps_match: | |
deps = [d.strip(' "\'') for d in deps_match.group(1).strip().split('\n') if d.strip()] | |
max_reqs = [] | |
for dep in deps: | |
# Check for maximum version constraint | |
max_version_match = re.search(r'([^>=<\s]+).*?<\s*([^,\s"\']+)', dep) | |
if max_version_match: | |
# If there's a max version, use the version just below it | |
package, max_ver = max_version_match.groups() | |
max_reqs.append(f"{package}<{max_ver}") | |
else: | |
# If no max version, just use the package name | |
package = re.match(r'([^>=<\s]+)', dep).group(1) | |
max_reqs.append(package) | |
with open('requirements.txt', 'w') as f: | |
f.write('\n'.join(max_reqs)) | |
EOF | |
- name: Install dependencies | |
run: | | |
uv pip install --system --no-deps . | |
uv pip install --system pytest | |
uv pip install --system -r requirements.txt | |
- name: Initialize submodules | |
run: git submodule update --init --recursive | |
- name: Run Tests | |
run: | | |
pytest tests/ |