adding requirements.txt #10
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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
permissions: | |
contents: read | |
jobs: | |
linux: | |
runs-on: ${{ matrix.platform.runner }} | |
strategy: | |
matrix: | |
platform: | |
- runner: ubuntu-latest | |
target: x86_64 | |
- runner: windows-latest | |
target: x64 | |
steps: | |
# Step 1: Set up Python environment | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Step 2: Create a virtual environment and install dependencies (including black and ruff) | |
- name: Install dependencies | |
run: | | |
python -m venv venv | |
source venv/bin/activate || .\venv\Scripts\activate # Linux/Windows compatible | |
python -m pip install --upgrade pip | |
pip install maturin black ruff pytest sphinx sphinx-rtd-theme # Install Black, Ruff, Maturin, etc. | |
pip install -r requirements.txt # Install additional project-specific dependencies | |
shell: bash | |
# Step 3: Run Ruff for linting and import sorting | |
- name: Run Ruff (Python linter) | |
run: | | |
source venv/bin/activate || .\venv\Scripts\activate | |
ruff check . --fix # Run Ruff for linting, and --fix to auto-fix issues | |
shell: bash | |
# Step 4: Run Black to ensure code formatting (non-fix mode) | |
- name: Run Black (Python formatter check) | |
run: | | |
source venv/bin/activate || .\venv\Scripts\activate | |
black --check . # Black is run in check mode to ensure formatting is correct | |
shell: bash | |
# Step 5: Build and install the Rust library using Maturin (in release mode) | |
- name: Build and install Rust library (release mode) | |
run: | | |
source venv/bin/activate || .\venv\Scripts\activate | |
maturin develop --release # Build the Rust library and install it | |
shell: bash | |
# Step 6: Run Python tests with pytest | |
- name: Run Python tests with pytest | |
run: | | |
source venv/bin/activate || .\venv\Scripts\activate | |
pytest tests/ # Run tests | |
shell: bash | |
# Step 7: Build Sphinx Documentation | |
- name: Build Sphinx Documentation | |
run: | | |
source venv/bin/activate || .\venv\Scripts\activate | |
cd docs | |
make html | |
shell: bash | |
# Step 8: Upload Documentation as an Artifact | |
- name: Upload Documentation | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sphinx-docs | |
path: docs/_build/html/ |