Skip to content

feat: pygments code highlighting in CLI --parse, CSV table rendering … #37

feat: pygments code highlighting in CLI --parse, CSV table rendering …

feat: pygments code highlighting in CLI --parse, CSV table rendering … #37

Workflow file for this run

name: Publish drp-dev to PyPI
# Dev branch → publishes "drp-dev" package.
# No tags, no GitHub releases — just PyPI.
on:
push:
branches: [dev]
paths:
- 'cli/**'
- 'pyproject.toml'
- 'VERSION'
- '.github/workflows/publish-dev.yml'
permissions:
contents: read
jobs:
test:
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.10', '3.12', '3.13']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install pipx
run: pip install pipx
- name: Install package with pipx
run: pipx install .
- name: Install package editable for pytest (pipx env is isolated)
run: pip install -e ".[dev]"
- name: Check drp entrypoint is on PATH
run: drp --version
- name: Check fallback python -m cli also works
run: python -m cli --version
- name: Run unit tests
env:
DB_URL: ""
run: python -m pytest tests/unit/ -v
# ── Smoke tests (require DRP_SMOKE_HOST secret) ───────────────────────
- name: Smoke — text drop upload, get, delete
if: ${{ env.DRP_SMOKE_HOST != '' }}
env:
DRP_SMOKE_HOST: ${{ secrets.DRP_SMOKE_HOST }}
shell: bash
run: |
KEY="ci-smoke-$(python -c 'import uuid; print(uuid.uuid4().hex[:8])')"
python -c "
from cli import config
cfg = config.load()
cfg['host'] = '${{ secrets.DRP_SMOKE_HOST }}'
config.save(cfg)
"
URL=$(drp up "hello from ci ${{ matrix.os }} py${{ matrix.python-version }}" --key "$KEY")
echo "Uploaded: $URL"
[ -z "$URL" ] && { echo "Upload returned empty URL"; exit 1; }
RESULT=$(drp get "$KEY")
echo "Got: $RESULT"
echo "$RESULT" | grep -q "hello from ci" || { echo "Content mismatch"; exit 1; }
drp ls | grep -q "$KEY" || { echo "Key not found in drp ls"; exit 1; }
drp rm "$KEY"
drp get "$KEY" && { echo "Drop still accessible after delete"; exit 1; } || true
- name: Smoke — stdin pipe upload
if: ${{ env.DRP_SMOKE_HOST != '' }}
env:
DRP_SMOKE_HOST: ${{ secrets.DRP_SMOKE_HOST }}
shell: bash
run: |
KEY="ci-stdin-$(python -c 'import uuid; print(uuid.uuid4().hex[:8])')"
URL=$(echo "stdin test from ci" | drp up --key "$KEY")
echo "Uploaded via stdin: $URL"
[ -z "$URL" ] && { echo "Stdin upload returned empty URL"; exit 1; }
drp get "$KEY" | grep -q "stdin test" || { echo "Stdin content mismatch"; exit 1; }
drp rm "$KEY"
- name: Smoke — file drop upload, get
if: ${{ env.DRP_SMOKE_HOST != '' }}
env:
DRP_SMOKE_HOST: ${{ secrets.DRP_SMOKE_HOST }}
shell: bash
run: |
KEY="ci-file-$(python -c 'import uuid; print(uuid.uuid4().hex[:8])')"
CONTENT="file content from ${{ matrix.os }}"
python -c "
with open('ci_test_file.txt', 'w') as f:
f.write('$CONTENT')
"
URL=$(drp up ci_test_file.txt --key "$KEY")
echo "Uploaded file: $URL"
[ -z "$URL" ] && { echo "File upload returned empty URL"; exit 1; }
echo "$URL" | grep -q '/f/' || { echo "File URL missing /f/ prefix"; exit 1; }
drp get -f "$KEY" -o ci_downloaded.txt
python -c "
content = open('ci_downloaded.txt').read()
assert '$CONTENT' in content, f'Content mismatch: {content!r}'
print('File content verified')
"
drp rm -f "$KEY"
rm -f ci_test_file.txt ci_downloaded.txt
# ── Publish drp-dev (no tags, no releases) ────────────────────────────────
publish:
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
concurrency:
group: publish-dev
cancel-in-progress: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Compute version from PyPI
id: version
run: |
base=$(cat VERSION | tr -d '[:space:]')
pkg="drp-dev"
latest=$(curl -sf "https://pypi.org/pypi/${pkg}/json" \
| python3 -c "import sys,json; print(json.load(sys.stdin)['info']['version'])" 2>/dev/null || echo "")
if [ -n "$latest" ] && echo "$latest" | grep -q "^${base}\."; then
patch=$(echo "$latest" | cut -d. -f3)
version="${base}.$((patch + 1))"
else
version="${base}.0"
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Publishing ${pkg} ${version} (latest on PyPI: ${latest:-none})"
- name: Stamp version into CLI
run: |
sed -i "s/__version__ = _resolve_version()/__version__ = '${{ steps.version.outputs.version }}'/" cli/__init__.py
- name: Build drp-dev
run: pip install build && python -m build
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}