code quality improvements #53
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: Monorepo CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - "**" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: monorepo-ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| validate-workspace: | |
| name: Validate Workspace | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check Out Repository | |
| uses: actions/checkout@v6 | |
| - name: Set Up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Set Up uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| - name: Install Dependencies | |
| run: uv sync --frozen --all-extras | |
| - name: Check Formatting | |
| run: uv run ruff format --check | |
| - name: Lint and Type Check | |
| run: make check | |
| - name: Run Tests | |
| run: make tests | |
| - name: Build Root, Adapter, Helper, And Transport Projects | |
| shell: bash | |
| run: | | |
| project_dirs() { | |
| if [ -d packages/helpers ]; then | |
| find packages/helpers -type f -name pyproject.toml -exec dirname {} \; | sort -u | |
| fi | |
| if [ -d packages/adapters ]; then | |
| find packages/adapters -type f -name pyproject.toml -exec dirname {} \; | sort -u | |
| fi | |
| if [ -d packages/transports ]; then | |
| find packages/transports -type f -name pyproject.toml -exec dirname {} \; | sort -u | |
| fi | |
| printf '.\n' | |
| } | |
| sync_project() { | |
| local project_dir="$1" | |
| local pyproject_path="$project_dir/pyproject.toml" | |
| if grep -Eq '^\[project\.optional-dependencies\]' "$pyproject_path"; then | |
| uv sync --project "$project_dir" --frozen --all-extras | |
| else | |
| uv sync --project "$project_dir" --frozen | |
| fi | |
| } | |
| while IFS= read -r project_dir; do | |
| echo "==> Building $project_dir" | |
| sync_project "$project_dir" | |
| uv build --project "$project_dir" | |
| done < <(project_dirs) |