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
102 changes: 102 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: PR Checks

on:
pull_request:
branches:
- main
- develop
push:
branches:
- main
- develop

permissions:
contents: read
pull-requests: write
issues: write

jobs:
test:
name: Test Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']

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

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Run tests
run: |
pytest tests/ -v --tb=short

build-check:
name: Build Check
runs-on: ubuntu-latest

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

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build twine

- name: Build package
run: python -m build

- name: Check package with twine
run: python -m twine check dist/*

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

all-checks-passed:
name: All Checks Passed
needs: [test, build-check]
runs-on: ubuntu-latest
if: always()

steps:
- name: Check if all jobs passed
run: |
if [ "${{ needs.test.result }}" != "success" ] || \
[ "${{ needs.build-check.result }}" != "success" ]; then
echo "Some required checks failed"
exit 1
fi
echo "All required checks passed!"

- name: Add PR comment
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '✅ All checks passed! Ready for review.'
})
115 changes: 115 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Publish to PyPI

on:
push:
tags:
- 'v*.*.*' # Trigger on version tags like v0.1.0, v1.0.0, etc.

jobs:
# Run full test suite before publishing
test:
name: Test Suite
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']

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

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Run tests
run: |
pytest tests/ -v --tb=short

build-and-publish:
needs: test # Only publish if tests pass
runs-on: ubuntu-latest

permissions:
contents: write # For creating release
id-token: write # Required for trusted publishing

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for changelog

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build twine

- name: Extract version from tag
id: get_version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Publishing version: $VERSION"

- name: Build package
run: python -m build

- name: Check package
run: python -m twine check dist/*

- name: Publish to PyPI
id: pypi-publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
# Using trusted publishing - no password needed
# Configure at https://pypi.org/manage/account/publishing/
skip-existing: true
verbose: true

- name: Create GitHub Release
if: success() # Only create release if PyPI publish succeeded
uses: softprops/action-gh-release@v2
with:
files: dist/*
generate_release_notes: true
body: |
# CapiscIO CLI ${{ steps.get_version.outputs.VERSION }}

## Installation

```bash
pip install capiscio==${{ steps.get_version.outputs.VERSION }}
```

Or upgrade:

```bash
pip install --upgrade capiscio
```

## What's Changed

See [CHANGELOG.md](https://github.com/capiscio/capiscio-python/blob/main/CHANGELOG.md) for detailed changes.

## Documentation

- [CLI Documentation](https://docs.capisc.io/cli)

---

**Full Changelog**: https://github.com/capiscio/capiscio-python/compare/${{ github.event.before }}...${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading