feat: add semantic similarity scoring #21
Workflow file for this run
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 | |
| # Tag pushes must be listed explicitly; branch-only `push` does not run on new tags, | |
| # so "Publish to PyPI" would always be skipped without `tags:` here. | |
| on: | |
| push: | |
| branches: [main, dev] | |
| tags: | |
| - "v*" | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| publish_to_pypi: | |
| description: "Publish to PyPI after tests (only if this version is not already on PyPI)" | |
| required: false | |
| default: false | |
| type: boolean | |
| jobs: | |
| test: | |
| name: Test (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install ctxeng + dev deps | |
| run: | | |
| pip install -e ".[dev]" | |
| - name: Lint with ruff | |
| run: ruff check ctxeng/ | |
| - name: Type check with mypy | |
| run: mypy ctxeng/ --ignore-missing-imports | |
| continue-on-error: true | |
| - name: Run tests with coverage | |
| run: | | |
| pytest tests/ --cov=ctxeng --cov-report=xml --cov-report=term-missing | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: false | |
| publish: | |
| name: Publish to PyPI | |
| runs-on: ubuntu-latest | |
| needs: test | |
| # Runs after a version tag push (e.g. v0.1.3), or manual run with publish enabled. | |
| if: | | |
| needs.test.result == 'success' && | |
| ( | |
| (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) || | |
| (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_to_pypi == 'true') | |
| ) | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Build package | |
| run: | | |
| pip install hatchling | |
| python -m hatchling build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.PYPI_API_TOKEN }} |