Skip to content

ci lint

ci lint #4

Workflow file for this run

name: CI
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
python-test:
name: Python Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Run pytest tests
run: pytest
- name: Run linting
run: |
black --check src/ tests/
flake8 src/ tests/
isort --check-only src/ tests/
rust-test:
name: Rust Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- 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: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Run tests
run: cargo test --verbose
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Check formatting
run: cargo fmt -- --check
- name: Build release
run: cargo build --release
integration-test:
name: Integration Tests
runs-on: ubuntu-latest
needs: [python-test, rust-test]
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Build Rust binary
run: cargo build --release
- name: Test Python CLI
run: |
./bin/basiccli-python version
./bin/basiccli-python hello World
- name: Test Rust CLI
run: |
./bin/basiccli-rust version
./bin/basiccli-rust hello World
- name: Compare performance
run: |
echo "Python version:"
time ./bin/basiccli-python version
echo "Rust version:"
time ./bin/basiccli-rust version