78 lines
1.8 KiB
YAML
78 lines
1.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master]
|
|
pull_request:
|
|
branches: [main, master]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Cache pip packages
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -e ".[dev]"
|
|
pip install pytest-cov
|
|
|
|
- name: Download spaCy model
|
|
run: python -m spacy download en_core_web_sm
|
|
|
|
- name: Lint with Ruff
|
|
run: pip install ruff && ruff check src/ tests/
|
|
|
|
- name: Check formatting with Black
|
|
run: pip install black && black --check src/ tests/
|
|
|
|
- name: Type check with MyPy
|
|
run: pip install mypy && mypy src/ --python-version 3.11
|
|
|
|
- name: Run tests
|
|
run: pytest tests/ -v --tb=short
|
|
|
|
- name: Run tests with coverage
|
|
run: pytest tests/ --cov=src/nl2gherkin --cov-report=term-missing --cov-report=xml
|
|
|
|
- name: Upload coverage to Codecov
|
|
if: always()
|
|
uses: codecov/codecov-action@v4
|
|
with:
|
|
files: ./coverage.xml
|
|
fail_ci_if_error: false
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Install build dependencies
|
|
run: pip install build
|
|
|
|
- name: Build package
|
|
run: python -m build
|
|
|
|
- name: Verify package
|
|
run: pip install dist/*.whl && nl2gherkin --help
|