feat!: PreTab 1.0.0 restructure and refactoring #2
This file contains hidden or 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: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ci-${{ github.head_ref || github.sha }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| name: Lint (ruff) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install Poetry | |
| run: pipx install poetry | |
| - name: Configure Poetry | |
| run: poetry config virtualenvs.in-project true | |
| - name: Cache virtualenv | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: venv-lint-${{ runner.os }}-3.10-${{ hashFiles('poetry.lock') }} | |
| - name: Install dependencies | |
| run: poetry install | |
| - name: Run ruff check | |
| run: poetry run ruff check . | |
| - name: Run ruff format check | |
| run: poetry run ruff format --check . | |
| typecheck: | |
| name: Type check (pyright) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install Poetry | |
| run: pipx install poetry | |
| - name: Configure Poetry | |
| run: poetry config virtualenvs.in-project true | |
| - name: Cache virtualenv | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: venv-typecheck-${{ runner.os }}-3.10-${{ hashFiles('poetry.lock') }} | |
| - name: Install dependencies | |
| run: poetry install | |
| - name: Run pyright | |
| run: poetry run pyright | |
| build: | |
| name: Build package | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install Poetry | |
| run: pipx install poetry | |
| - name: Configure Poetry | |
| run: poetry config virtualenvs.in-project true | |
| - name: Cache virtualenv | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: venv-build-${{ runner.os }}-3.10-${{ hashFiles('poetry.lock') }} | |
| - name: Install dependencies | |
| run: poetry install --only main | |
| - name: Build package | |
| run: poetry build | |
| - name: Check package (twine) | |
| run: | | |
| python -m pip install --upgrade twine | |
| twine check dist/* | |
| tests: | |
| name: Tests (Python ${{ matrix.python-version }}, ${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Poetry | |
| run: pipx install poetry | |
| - name: Configure Poetry | |
| run: poetry config virtualenvs.in-project true | |
| - name: Cache virtualenv | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: venv-tests-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} | |
| - name: Install dependencies | |
| run: poetry install | |
| - name: Run unit tests | |
| run: poetry run pytest tests/ -v | |
| smoke: | |
| name: Smoke tests (Python 3.12, ubuntu) | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install Poetry | |
| run: pipx install poetry | |
| - name: Configure Poetry | |
| run: poetry config virtualenvs.in-project true | |
| - name: Cache virtualenv | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: venv-smoke-${{ runner.os }}-3.12-${{ hashFiles('poetry.lock') }} | |
| - name: Install dependencies | |
| run: poetry install | |
| - name: Run smoke tests | |
| run: poetry run pytest tests/ -v -m smoke --tb=short | |
| - name: Run quickstart | |
| run: poetry run python scripts/quickstart.py | |
| coverage: | |
| name: Coverage | |
| runs-on: ubuntu-latest | |
| needs: tests | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install Poetry | |
| run: pipx install poetry | |
| - name: Configure Poetry | |
| run: poetry config virtualenvs.in-project true | |
| - name: Cache virtualenv | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: venv-coverage-${{ runner.os }}-3.12-${{ hashFiles('poetry.lock') }} | |
| - name: Install dependencies | |
| run: poetry install | |
| - name: Run tests with coverage | |
| run: | | |
| poetry run pytest tests/ \ | |
| --cov=pretab \ | |
| --cov-branch \ | |
| --cov-report=term-missing \ | |
| --cov-report=xml:coverage.xml \ | |
| --cov-fail-under=90 \ | |
| -q | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: coverage.xml | |
| retention-days: 30 | |
| - name: Upload to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: coverage.xml | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: false | |
| optional-deps: | |
| name: Optional deps (${{ matrix.extra }}) | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - extra: embeddings | |
| module: sentence_transformers | |
| - extra: lightgbm | |
| module: lightgbm | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install Poetry | |
| run: pipx install poetry | |
| - name: Configure Poetry | |
| run: poetry config virtualenvs.in-project true | |
| - name: Cache virtualenv | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: venv-optdeps-${{ matrix.extra }}-${{ runner.os }}-3.12-${{ hashFiles('poetry.lock') }} | |
| - name: Install dependencies with the ${{ matrix.extra }} extra | |
| run: poetry install --extras "${{ matrix.extra }}" | |
| - name: Verify the optional dependency imports | |
| run: poetry run python -c "import ${{ matrix.module }}; print('${{ matrix.module }} import OK')" | |
| - name: Run the suite with the extra installed | |
| run: poetry run pytest tests/ -q |