Skip to content

Commit 7b672be

Browse files
authored
Merge pull request #1 from capiscio/feat/cli-wrapper
feat: implement CLI wrapper for capiscio-core (v2.1.2)
2 parents e8f7cc3 + 65f493b commit 7b672be

8 files changed

Lines changed: 537 additions & 17 deletions

File tree

.github/workflows/pr-checks.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: PR Checks
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- develop
8+
push:
9+
branches:
10+
- main
11+
- develop
12+
13+
permissions:
14+
contents: read
15+
pull-requests: write
16+
issues: write
17+
18+
jobs:
19+
test:
20+
name: Test Python ${{ matrix.python-version }}
21+
runs-on: ubuntu-latest
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
python-version: ['3.10', '3.11', '3.12', '3.13']
26+
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
31+
- name: Set up Python ${{ matrix.python-version }}
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: ${{ matrix.python-version }}
35+
cache: 'pip'
36+
37+
- name: Install dependencies
38+
run: |
39+
python -m pip install --upgrade pip
40+
pip install -e ".[dev]"
41+
42+
- name: Run tests
43+
run: |
44+
pytest tests/ -v --tb=short
45+
46+
build-check:
47+
name: Build Check
48+
runs-on: ubuntu-latest
49+
50+
steps:
51+
- name: Checkout code
52+
uses: actions/checkout@v4
53+
54+
- name: Set up Python
55+
uses: actions/setup-python@v5
56+
with:
57+
python-version: '3.11'
58+
59+
- name: Install build dependencies
60+
run: |
61+
python -m pip install --upgrade pip
62+
python -m pip install build twine
63+
64+
- name: Build package
65+
run: python -m build
66+
67+
- name: Check package with twine
68+
run: python -m twine check dist/*
69+
70+
- name: Upload build artifacts
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: dist
74+
path: dist/
75+
76+
all-checks-passed:
77+
name: All Checks Passed
78+
needs: [test, build-check]
79+
runs-on: ubuntu-latest
80+
if: always()
81+
82+
steps:
83+
- name: Check if all jobs passed
84+
run: |
85+
if [ "${{ needs.test.result }}" != "success" ] || \
86+
[ "${{ needs.build-check.result }}" != "success" ]; then
87+
echo "Some required checks failed"
88+
exit 1
89+
fi
90+
echo "All required checks passed!"
91+
92+
- name: Add PR comment
93+
if: github.event_name == 'pull_request'
94+
uses: actions/github-script@v7
95+
with:
96+
script: |
97+
github.rest.issues.createComment({
98+
issue_number: context.issue.number,
99+
owner: context.repo.owner,
100+
repo: context.repo.repo,
101+
body: '✅ All checks passed! Ready for review.'
102+
})

.github/workflows/publish.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*' # Trigger on version tags like v0.1.0, v1.0.0, etc.
7+
8+
jobs:
9+
# Run full test suite before publishing
10+
test:
11+
name: Test Suite
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ['3.10', '3.11', '3.12', '3.13']
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
cache: 'pip'
26+
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install -e ".[dev]"
31+
32+
- name: Run tests
33+
run: |
34+
pytest tests/ -v --tb=short
35+
36+
build-and-publish:
37+
needs: test # Only publish if tests pass
38+
runs-on: ubuntu-latest
39+
40+
permissions:
41+
contents: write # For creating release
42+
id-token: write # Required for trusted publishing
43+
44+
steps:
45+
- name: Checkout code
46+
uses: actions/checkout@v4
47+
with:
48+
fetch-depth: 0 # Full history for changelog
49+
50+
- name: Set up Python
51+
uses: actions/setup-python@v5
52+
with:
53+
python-version: '3.11'
54+
55+
- name: Install build dependencies
56+
run: |
57+
python -m pip install --upgrade pip
58+
python -m pip install build twine
59+
60+
- name: Extract version from tag
61+
id: get_version
62+
run: |
63+
VERSION=${GITHUB_REF#refs/tags/v}
64+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
65+
echo "Publishing version: $VERSION"
66+
67+
- name: Build package
68+
run: python -m build
69+
70+
- name: Check package
71+
run: python -m twine check dist/*
72+
73+
- name: Publish to PyPI
74+
id: pypi-publish
75+
uses: pypa/gh-action-pypi-publish@release/v1
76+
with:
77+
# Using trusted publishing - no password needed
78+
# Configure at https://pypi.org/manage/account/publishing/
79+
skip-existing: true
80+
verbose: true
81+
82+
- name: Create GitHub Release
83+
if: success() # Only create release if PyPI publish succeeded
84+
uses: softprops/action-gh-release@v2
85+
with:
86+
files: dist/*
87+
generate_release_notes: true
88+
body: |
89+
# CapiscIO CLI ${{ steps.get_version.outputs.VERSION }}
90+
91+
## Installation
92+
93+
```bash
94+
pip install capiscio==${{ steps.get_version.outputs.VERSION }}
95+
```
96+
97+
Or upgrade:
98+
99+
```bash
100+
pip install --upgrade capiscio
101+
```
102+
103+
## What's Changed
104+
105+
See [CHANGELOG.md](https://github.com/capiscio/capiscio-python/blob/main/CHANGELOG.md) for detailed changes.
106+
107+
## Documentation
108+
109+
- [CLI Documentation](https://docs.capisc.io/cli)
110+
111+
---
112+
113+
**Full Changelog**: https://github.com/capiscio/capiscio-python/compare/${{ github.event.before }}...${{ github.ref_name }}
114+
env:
115+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)