Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 53 additions & 53 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.11", "3.12", "3.13", "3.14"]
fail-fast: false

steps:
- uses: actions/checkout@v6

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pytest

- name: Test
run: python -m pytest tests/ -v

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- uses: actions/setup-python@v6
with:
python-version: "3.12"

- name: Cursor rules drift check
run: python tools/sync_cursor_rules.py --check

- name: Ruff
run: |
pip install ruff
ruff check src/ tests/
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.11", "3.12", "3.13", "3.14"]
fail-fast: false
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pytest pytest-cov
- name: Test
run: python -m pytest tests/ -v --cov=instinct --cov-fail-under=60 --cov-report=term-missing
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Cursor rules drift check
run: python tools/sync_cursor_rules.py --check
- name: Ruff
run: |
pip install ruff
ruff check src/ tests/
224 changes: 123 additions & 101 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,101 +1,123 @@
name: Release

on:
push:
tags:
- "v*.*.*"

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"

- name: Validate tag/version alignment
shell: bash
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
PACKAGE_VERSION="$(python - <<'PY'
import tomllib
from pathlib import Path
data = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))
print(data["project"]["version"])
PY
)"

echo "Tag version: $TAG_VERSION"
echo "Package version: $PACKAGE_VERSION"

if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
echo "::error::Tag version (v$TAG_VERSION) does not match pyproject version ($PACKAGE_VERSION)."
exit 1
fi

- name: Build distributions
shell: bash
run: |
python -m pip install --upgrade pip build twine
python -m build
python -m twine check dist/*

- name: Upload distributions
uses: actions/upload-artifact@v7
with:
name: python-dist
path: dist/*

publish-pypi:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Download distributions
uses: actions/download-artifact@v8
with:
name: python-dist
path: dist

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true

create-release:
needs: [build, publish-pypi]
if: ${{ always() && needs.build.result == 'success' && needs.publish-pypi.result == 'success' }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download distributions
uses: actions/download-artifact@v8
with:
name: python-dist
path: dist

- name: Create or update GitHub release
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
if gh release view "${GITHUB_REF_NAME}" --repo "${GITHUB_REPOSITORY}" >/dev/null 2>&1; then
gh release upload "${GITHUB_REF_NAME}" dist/* --clobber --repo "${GITHUB_REPOSITORY}"
else
gh release create "${GITHUB_REF_NAME}" dist/* \
--title "${GITHUB_REF_NAME}" \
--generate-notes \
--repo "${GITHUB_REPOSITORY}"
fi
name: Release

on:
push:
tags:
- "v*.*.*"

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"

jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"

- name: Install
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pytest pytest-cov

- name: Test with coverage gate
run: python -m pytest tests/ -q --cov=instinct --cov-fail-under=60 --cov-report=term-missing

build:
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"

- name: Validate tag/version alignment
shell: bash
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
PACKAGE_VERSION="$(python - <<'PY'
import tomllib
from pathlib import Path
data = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))
print(data["project"]["version"])
PY
)"

echo "Tag version: $TAG_VERSION"
echo "Package version: $PACKAGE_VERSION"

if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
echo "::error::Tag version (v$TAG_VERSION) does not match pyproject version ($PACKAGE_VERSION)."
exit 1
fi

- name: Build distributions
shell: bash
run: |
python -m pip install --upgrade pip build twine
python -m build
python -m twine check dist/*

- name: Upload distributions
uses: actions/upload-artifact@v7
with:
name: python-dist
path: dist/*

publish-pypi:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Download distributions
uses: actions/download-artifact@v8
with:
name: python-dist
path: dist

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true

create-release:
needs: [test, build, publish-pypi]
if: ${{ always() && needs.test.result == 'success' && needs.build.result == 'success' && needs.publish-pypi.result == 'success' }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download distributions
uses: actions/download-artifact@v8
with:
name: python-dist
path: dist

- name: Create or update GitHub release
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
if gh release view "${GITHUB_REF_NAME}" --repo "${GITHUB_REPOSITORY}" >/dev/null 2>&1; then
gh release upload "${GITHUB_REF_NAME}" dist/* --clobber --repo "${GITHUB_REPOSITORY}"
else
gh release create "${GITHUB_REF_NAME}" dist/* \
--title "${GITHUB_REF_NAME}" \
--generate-notes \
--repo "${GITHUB_REPOSITORY}"
fi
13 changes: 13 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,16 @@ where = ["src"]

[tool.pytest.ini_options]
testpaths = ["tests"]

[tool.coverage.run]
source = ["src"]
branch = true

[tool.coverage.report]
fail_under = 80
show_missing = true
exclude_lines = [
"pragma: no cover",
"raise NotImplementedError",
"if __name__ == .__main__.:",
]
Loading
Loading