misc: small fix or general refactoring i did not bother commenting #213
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: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| jobs: | |
| validate: | |
| name: Validate | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
| - name: Setup Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Poetry | |
| uses: abatilo/actions-poetry@e78f54a89cb052fff327414dd9ff010b5d2b4dbd | |
| - name: Configure Poetry | |
| run: | | |
| poetry config virtualenvs.create true --local | |
| poetry config virtualenvs.in-project true --local | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ./.venv | |
| key: venv-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} | |
| restore-keys: | | |
| venv-${{ runner.os }}-py${{ matrix.python-version }}- | |
| - name: Install package | |
| run: poetry install --all-extras | |
| - name: Validate version | |
| run: | | |
| POETRY_VERSION=$(poetry version -s) | |
| INIT_VERSION=$(python -c "import nerve; print(nerve.__version__)") | |
| if [ "$POETRY_VERSION" != "$INIT_VERSION" ]; then | |
| echo "Version mismatch: pyproject.toml ($POETRY_VERSION) != __init__.py ($INIT_VERSION)" | |
| exit 1 | |
| fi | |
| - name: Lint | |
| run: poetry run ruff check --output-format=github nerve | |
| - name: Type check | |
| run: poetry run mypy --no-error-summary nerve | |
| - name: Test | |
| run: poetry run pytest nerve |