Skip to content

Commit e6408eb

Browse files
committed
Initial commit
0 parents  commit e6408eb

90 files changed

Lines changed: 15078 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: CI
2+
3+
# Triggers on every push to any branch and on every pull request, so the
4+
# coverage + type-check + lint gate runs before code gets merged anywhere.
5+
on:
6+
push:
7+
branches: ['**']
8+
pull_request:
9+
workflow_dispatch:
10+
11+
# Cancel an in-progress run if a new commit is pushed to the same ref.
12+
# Saves runner minutes and keeps the latest commit's status authoritative.
13+
concurrency:
14+
group: ci-${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
env:
18+
DISABLE_BREAKING_CHANGES_WARNING: '1'
19+
PIP_DISABLE_PIP_VERSION_CHECK: '1'
20+
21+
jobs:
22+
# ---------------------------------------------------------------------
23+
# Static type check with mypy.
24+
# ---------------------------------------------------------------------
25+
typecheck:
26+
name: Type check (mypy)
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0 # setuptools-scm needs history for version
32+
33+
- uses: actions/setup-python@v5
34+
with:
35+
python-version: '3.11'
36+
cache: 'pip'
37+
38+
- name: Install project + mypy
39+
run: |
40+
python -m pip install --upgrade pip
41+
python -m pip install -e ".[dev]"
42+
43+
- name: mypy
44+
run: mypy src/agentrun_cli
45+
46+
# ---------------------------------------------------------------------
47+
# Unit + integration tests with coverage gate.
48+
# Matrix runs across all supported Python versions on Linux; macOS and
49+
# Windows are covered by the smoke-test job below (the test suite is
50+
# platform-agnostic, but we still want at least one cross-OS signal).
51+
# ---------------------------------------------------------------------
52+
test:
53+
name: Test (Python ${{ matrix.python-version }})
54+
runs-on: ubuntu-latest
55+
strategy:
56+
fail-fast: false
57+
matrix:
58+
python-version: ['3.10', '3.11', '3.12', '3.13']
59+
steps:
60+
- uses: actions/checkout@v4
61+
with:
62+
fetch-depth: 0 # setuptools-scm
63+
64+
- uses: actions/setup-python@v5
65+
with:
66+
python-version: ${{ matrix.python-version }}
67+
cache: 'pip'
68+
69+
- name: Install project + dev deps
70+
run: |
71+
python -m pip install --upgrade pip
72+
python -m pip install -e ".[dev]"
73+
74+
- name: Run tests with coverage (>=95%)
75+
run: |
76+
pytest tests/unit tests/integration \
77+
--cov=agentrun_cli \
78+
--cov-report=term-missing \
79+
--cov-report=xml \
80+
--cov-branch \
81+
--cov-fail-under=95
82+
83+
- name: Upload coverage XML
84+
if: matrix.python-version == '3.11'
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: coverage-xml
88+
path: coverage.xml
89+
retention-days: 14
90+
if-no-files-found: warn
91+
92+
# ---------------------------------------------------------------------
93+
# Cross-platform smoke test: install the package and exercise the CLI
94+
# entry points. Catches platform-specific import / packaging issues
95+
# without running the full matrix on every OS.
96+
# ---------------------------------------------------------------------
97+
smoke:
98+
name: Smoke (${{ matrix.os }})
99+
runs-on: ${{ matrix.os }}
100+
strategy:
101+
fail-fast: false
102+
matrix:
103+
os: [macos-latest, windows-latest]
104+
steps:
105+
- uses: actions/checkout@v4
106+
with:
107+
fetch-depth: 0
108+
109+
- uses: actions/setup-python@v5
110+
with:
111+
python-version: '3.11'
112+
cache: 'pip'
113+
114+
- name: Install project
115+
shell: bash
116+
run: |
117+
python -m pip install --upgrade pip
118+
python -m pip install -e .
119+
120+
- name: CLI smoke test
121+
shell: bash
122+
run: |
123+
agentrun --version
124+
agentrun --help
125+
ar --version

.github/workflows/release.yml

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
name: Release
2+
3+
# Builds standalone binaries for Linux / macOS / Windows and publishes them
4+
# as assets on the GitHub Release corresponding to the pushed tag.
5+
#
6+
# Trigger:
7+
# - Push a git tag matching v* (e.g. v0.1.0) → builds all targets and
8+
# creates/updates a Release named after the tag.
9+
# - workflow_dispatch → manual run for debugging; requires a tag input
10+
# that already exists on the repository.
11+
12+
on:
13+
push:
14+
tags:
15+
- 'v*'
16+
workflow_dispatch:
17+
inputs:
18+
tag:
19+
description: 'Existing tag to build and release (e.g. v0.1.0)'
20+
required: true
21+
22+
permissions:
23+
contents: write
24+
25+
env:
26+
PYTHON_VERSION: '3.11'
27+
DISABLE_BREAKING_CHANGES_WARNING: '1'
28+
29+
jobs:
30+
# ---------------------------------------------------------------------
31+
# Version sanity check: setuptools-scm must resolve the tag to the
32+
# same PEP 440 version we expect from the tag name (v1.2.3 → 1.2.3).
33+
# ---------------------------------------------------------------------
34+
verify-version:
35+
name: Verify version
36+
runs-on: ubuntu-latest
37+
outputs:
38+
tag: ${{ steps.resolve.outputs.tag }}
39+
version: ${{ steps.resolve.outputs.version }}
40+
steps:
41+
- uses: actions/checkout@v4
42+
with:
43+
ref: ${{ github.event.inputs.tag || github.ref }}
44+
fetch-depth: 0 # setuptools-scm needs full history + tags
45+
46+
- uses: actions/setup-python@v5
47+
with:
48+
python-version: ${{ env.PYTHON_VERSION }}
49+
50+
- name: Resolve tag and version
51+
id: resolve
52+
shell: bash
53+
run: |
54+
TAG="${{ github.event.inputs.tag || github.ref_name }}"
55+
VERSION="${TAG#v}"
56+
python -m pip install --upgrade pip
57+
python -m pip install "setuptools-scm>=8"
58+
SCM_VERSION=$(python -m setuptools_scm)
59+
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
60+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
61+
if [ "$VERSION" != "$SCM_VERSION" ]; then
62+
echo "::error::Tag version ($VERSION) does not match setuptools-scm resolution ($SCM_VERSION). Make sure the tag points at the commit you want to release."
63+
exit 1
64+
fi
65+
echo "Building version $VERSION from tag $TAG"
66+
67+
# ---------------------------------------------------------------------
68+
# Matrix build: 5 targets
69+
# ---------------------------------------------------------------------
70+
build:
71+
name: Build ${{ matrix.target }}
72+
needs: verify-version
73+
runs-on: ${{ matrix.runner }}
74+
container: ${{ matrix.container }}
75+
strategy:
76+
fail-fast: false
77+
matrix:
78+
include:
79+
- target: linux-amd64
80+
runner: ubuntu-latest
81+
container: quay.io/pypa/manylinux_2_28_x86_64
82+
ext: ''
83+
archive: tar.gz
84+
- target: linux-arm64
85+
runner: ubuntu-24.04-arm
86+
container: quay.io/pypa/manylinux_2_28_aarch64
87+
ext: ''
88+
archive: tar.gz
89+
- target: darwin-amd64
90+
runner: macos-13
91+
container: ''
92+
ext: ''
93+
archive: tar.gz
94+
- target: darwin-arm64
95+
runner: macos-latest
96+
container: ''
97+
ext: ''
98+
archive: tar.gz
99+
- target: windows-amd64
100+
runner: windows-latest
101+
container: ''
102+
ext: '.exe'
103+
archive: zip
104+
105+
steps:
106+
- uses: actions/checkout@v4
107+
with:
108+
ref: ${{ needs.verify-version.outputs.tag }}
109+
fetch-depth: 0 # setuptools-scm needs full history + tags
110+
111+
# manylinux images ship multiple Pythons under /opt/python; expose one.
112+
- name: Configure Python (manylinux container)
113+
if: matrix.container != ''
114+
shell: bash
115+
run: |
116+
PY=/opt/python/cp311-cp311/bin
117+
echo "$PY" >> "$GITHUB_PATH"
118+
"$PY/python" -m pip install --upgrade pip
119+
120+
- name: Setup Python (host runner)
121+
if: matrix.container == ''
122+
uses: actions/setup-python@v5
123+
with:
124+
python-version: ${{ env.PYTHON_VERSION }}
125+
126+
- name: Install project + PyInstaller
127+
shell: bash
128+
run: |
129+
python -m pip install --upgrade pip
130+
python -m pip install -e .
131+
python -m pip install pyinstaller
132+
133+
- name: Build binary
134+
shell: bash
135+
run: |
136+
pyinstaller --clean --noconfirm agentrun.spec
137+
ls -lh dist/
138+
139+
- name: Smoke test binary
140+
shell: bash
141+
run: |
142+
./dist/agentrun${{ matrix.ext }} --version
143+
144+
# --- Package (Unix) -----------------------------------------------
145+
- name: Package tar.gz (Unix)
146+
if: matrix.archive == 'tar.gz'
147+
shell: bash
148+
run: |
149+
VERSION="${{ needs.verify-version.outputs.version }}"
150+
ASSET="agentrun-${VERSION}-${{ matrix.target }}.tar.gz"
151+
cd dist
152+
tar czf "../${ASSET}" "agentrun${{ matrix.ext }}"
153+
cd ..
154+
shasum -a 256 "${ASSET}" > "${ASSET}.sha256"
155+
echo "ASSET=${ASSET}" >> "$GITHUB_ENV"
156+
157+
# --- Package (Windows) --------------------------------------------
158+
- name: Package zip (Windows)
159+
if: matrix.archive == 'zip'
160+
shell: pwsh
161+
run: |
162+
$version = "${{ needs.verify-version.outputs.version }}"
163+
$asset = "agentrun-$version-${{ matrix.target }}.zip"
164+
Compress-Archive -Path "dist/agentrun${{ matrix.ext }}" -DestinationPath $asset -Force
165+
$hash = (Get-FileHash $asset -Algorithm SHA256).Hash.ToLower()
166+
"$hash $asset" | Out-File -Encoding ascii "$asset.sha256"
167+
echo "ASSET=$asset" >> $env:GITHUB_ENV
168+
169+
- uses: actions/upload-artifact@v4
170+
with:
171+
name: agentrun-${{ matrix.target }}
172+
path: |
173+
${{ env.ASSET }}
174+
${{ env.ASSET }}.sha256
175+
retention-days: 7
176+
if-no-files-found: error
177+
178+
# ---------------------------------------------------------------------
179+
# Collect all artifacts and publish the Release
180+
# ---------------------------------------------------------------------
181+
release:
182+
name: Publish Release
183+
needs: [verify-version, build]
184+
runs-on: ubuntu-latest
185+
steps:
186+
- uses: actions/download-artifact@v4
187+
with:
188+
path: dist
189+
merge-multiple: true
190+
191+
- name: List artifacts
192+
run: ls -lh dist/
193+
194+
- name: Create combined checksums file
195+
working-directory: dist
196+
run: |
197+
cat *.sha256 > SHA256SUMS
198+
echo "---"
199+
cat SHA256SUMS
200+
201+
- name: Publish to GitHub Releases
202+
uses: softprops/action-gh-release@v2
203+
with:
204+
tag_name: ${{ needs.verify-version.outputs.tag }}
205+
name: ${{ needs.verify-version.outputs.tag }}
206+
draft: false
207+
prerelease: ${{ contains(needs.verify-version.outputs.version, '-') }}
208+
generate_release_notes: true
209+
files: |
210+
dist/agentrun-*.tar.gz
211+
dist/agentrun-*.zip
212+
dist/agentrun-*.sha256
213+
dist/SHA256SUMS

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
__pycache__/
2+
*.py[cod]
3+
*$py.class
4+
*.egg-info/
5+
dist/
6+
build/
7+
.eggs/
8+
*.egg
9+
.venv/
10+
venv/
11+
.env
12+
.idea/
13+
.vscode/
14+
*.spec
15+
!agentrun.spec
16+
.coverage
17+
coverage.json
18+
htmlcov/
19+
/.claude/
20+
/docs_inner/
21+
src/agentrun_cli/_version.py

0 commit comments

Comments
 (0)