Chore/upgrade python 314 #154
This file contains hidden or 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: Continuous Integration | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| permissions: read-all | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| # Set up Python with development headers first | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| # Install Python development packages | |
| - name: Install Python dev dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y python3-dev | |
| # Install Rust toolchain | |
| - name: Install Rust toolchain | |
| run: | | |
| rustup toolchain install stable | |
| rustup default stable | |
| rustup component add clippy | |
| # Set environment variables for PyO3 | |
| - name: Configure PyO3 | |
| run: | | |
| # Find Python library path and set environment variables | |
| python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))" | |
| python -c "import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'))" | |
| # Set PyO3 environment variables | |
| echo "PYO3_PYTHON=$(which python)" >> $GITHUB_ENV | |
| # Clippy - Rust linter | |
| - name: Run Clippy | |
| run: cargo clippy -- -D warnings | |
| # Build Rust code first | |
| - name: Build | |
| run: cargo build --verbose | |
| # Set up Python virtual environment and run Python tests | |
| - name: Setup and run Python tests | |
| run: | | |
| python -m venv venv | |
| source venv/bin/activate | |
| pip install ruff maturin | |
| ruff check . | |
| maturin develop | |
| python -m unittest discover -s tests -p '*.py' | |
| # Run Rust tests with proper Python linkage | |
| - name: Run Rust tests | |
| run: | | |
| source venv/bin/activate | |
| # Ensure Python is in the path and libraries are available | |
| export PYTHON_SYS_EXECUTABLE=$(which python) | |
| # Run tests with explicit Python configuration | |
| cargo test --verbose |