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
60 changes: 0 additions & 60 deletions .github/workflows/auto-tag.yml

This file was deleted.

76 changes: 74 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
python-version: '3.12'

- name: Install Poetry
uses: snok/install-poetry@v1
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1
with:
version: latest
version: "2.1.3"
virtualenvs-create: true
virtualenvs-in-project: true

Expand All @@ -32,5 +32,77 @@ jobs:
- name: Run pre-commit hooks
run: poetry run pre-commit run --all-files

- name: Check version consistency
run: |
PYPROJECT_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/' || true)
INIT_VERSION=$(grep '^__version__ = ' squawk_alembic/__init__.py | sed 's/__version__ = "\(.*\)"/\1/' || true)
if [ -z "$PYPROJECT_VERSION" ] || [ -z "$INIT_VERSION" ]; then
echo "::error::Could not parse version from pyproject.toml or __init__.py"
exit 1
fi
if [ "$PYPROJECT_VERSION" != "$INIT_VERSION" ]; then
echo "::error::Version mismatch: pyproject.toml ($PYPROJECT_VERSION) != __init__.py ($INIT_VERSION)"
echo "Run 'make bump VERSION=x.y.z' to update both files."
exit 1
fi
echo "Versions match: $PYPROJECT_VERSION"

- name: Run tests
run: poetry run pytest tests/ -v

auto-tag:
needs: lint-and-test
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gate auto-tag on CI passing

Previously auto-tag.yml and ci.yml were independent workflows both triggered on push: branches: [main]. A broken commit could get tagged and released before tests failed. Merging them into one workflow with needs: lint-and-test ensures tagging only happens after tests pass. The if: github.event_name == 'push' guard prevents the auto-tag job from running on PR checks.

if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
tag: ${{ steps.tag.outputs.tag }}
created: ${{ steps.tag.outputs.created }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Create tag if needed
id: tag
run: |
VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
TAG="v${VERSION}"

echo "Detected version: $VERSION"
echo "Tag: $TAG"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"

if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists. Nothing to do."
echo "created=false" >> "$GITHUB_OUTPUT"
exit 0
fi

echo "Creating and pushing tag $TAG"
git tag "$TAG"
git push origin "$TAG"
echo "created=true" >> "$GITHUB_OUTPUT"

release:
needs: auto-tag
if: needs.auto-tag.outputs.created == 'true'
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ needs.auto-tag.outputs.tag }}
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix expression injection in release step

The old workflow interpolated ${{ needs.auto-tag.outputs.tag }} directly in the shell run: block. If the tag output contained shell metacharacters, they would execute. Moving the value to an env: block and referencing it as $TAG prevents this because environment variables are not shell-interpolated.

run: |
gh release create "$TAG" \
--title "Release $TAG" \
--generate-notes
29 changes: 0 additions & 29 deletions .github/workflows/version-check.yml

This file was deleted.

175 changes: 14 additions & 161 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,179 +1,32 @@
# Byte-compiled / optimized / DLL files
# Byte-compiled / optimized
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Virtual environments
.venv/

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Linting
.ruff_cache/

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
# Test / coverage
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
.coverage
htmlcov/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
# Editors / OS
.idea/

.vscode/
.DS_Store
.vscode
.python-version

compare_output/
export/backup/
node_modules/

# Environment
.env

.serverless/

# Local files with credentials/secrets
local_files/

# Claude skills/agents/config
.claude/
CLAUDE.md
.mcp.json
# Python version
.python-version
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ repos:
hooks:
- id: poetry-check
- repo: https://github.com/facebook/pyrefly-pre-commit
rev: 0.0.1
rev: 0.53.0
hooks:
- id: pyrefly-typecheck-system
- id: pyrefly-check
name: Pyrefly (type checking)
pass_filenames: false
always_run: true
language: system
Loading