feat: generate Python client package #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Python Client CI | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'clients/python/**' | |
| - 'spec/**' | |
| - '.github/workflows/python-ci.yml' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - 'clients/python/**' | |
| - 'spec/**' | |
| - '.github/workflows/python-ci.yml' | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: clients/python | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install pipx | |
| run: pip install pipx | |
| - name: Generate client from spec | |
| working-directory: . | |
| run: ./scripts/generate.sh | |
| - name: Set up generated symlink | |
| run: ln -sf ../../generated src/ros2_medkit_client/_generated | |
| - name: Install package with dev deps | |
| run: pip install -e '.[dev]' | |
| - name: Test | |
| run: python -m pytest -v | |
| - name: Lint | |
| run: ruff check src/ tests/ | |
| - name: Format check | |
| run: ruff format --check src/ tests/ | |
| publish: | |
| needs: build-and-test | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| contents: read | |
| defaults: | |
| run: | |
| working-directory: clients/python | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install build tools | |
| run: pip install pipx build twine | |
| - name: Generate client from spec | |
| working-directory: . | |
| run: ./scripts/generate.sh | |
| - name: Set up generated symlink | |
| run: ln -sf ../../generated src/ros2_medkit_client/_generated | |
| - name: Build wheel | |
| run: python -m build | |
| - name: Publish to GitHub Packages | |
| run: twine upload --skip-existing --repository-url https://pypi.pkg.github.com/selfpatch/ dist/* | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.GITHUB_TOKEN }} |