name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
rust-test:
name: Rust Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Check formatting
run: cargo fmt --check
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Build (Rust only)
run: cargo build -p words-to-data --lib --verbose
- name: Unzip test files
run: cd tests/test_data && tar xvf test_files.tar.xz
- name: Run Rust tests
run: cargo test -p words-to-data --verbose
- name: Build with Python feature
run: cargo build -p words-to-data --lib --features python --verbose
python-test:
name: Python Tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.14"]
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Install maturin
run: pip install maturin pytest
- name: Build Python package
run: maturin build --release
- name: Unzip test files
run: cd tests/test_data && tar xvf test_files.tar.xz
- name: Install Python package
run: pip install target/wheels/words_to_data*.whl
- name: Run Python tests
run: python -m pytest python/tests/ -v
- name: Test Python import
run: python -c "from words_to_data import parse_uslm_xml, compute_diff, USLMElement, TreeDiff; print('Import successful!')"