openai-harmony/.github/actions/run-rust-python-tests/action.yml
2025-08-05 13:33:36 -07:00

69 lines
1.5 KiB
YAML

name: Run Rust and Python tests
description: Format, clippy, Rust tests (incl. doctests), build Python extension and run pytest
inputs:
python-version:
description: Python version to use
required: false
default: "3.11"
rust-toolchain:
description: Rust toolchain channel
required: false
default: stable
runs:
using: composite
steps:
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ inputs.rust-toolchain }}
components: clippy,rustfmt
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Upgrade pip
shell: bash
run: |
python -m pip install --upgrade pip
- name: Install test deps
shell: bash
run: |
python -m pip install pytest
- name: Check rustfmt
shell: bash
run: |
cargo fmt --all --check
- name: Run clippy
shell: bash
run: |
cargo clippy --all-targets --all-features -- -D warnings
- name: Run Rust tests (unit/integration)
shell: bash
run: |
cargo test --all-targets --all-features
- name: Run Rust doctests
shell: bash
run: |
cargo test --doc
- name: Build and install Python package
shell: bash
run: |
pip install .
- name: Run pytest
shell: bash
env:
PYTHONUTF8: "1"
run: |
pytest -q