feat(ci): persist pyscn analyze report and post PR comment #94
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: tests | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| - develop | |
| jobs: | |
| format: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: | | |
| make init-uv | |
| make install | |
| - name: Format checking with Ruff Format | |
| run: make format | |
| lint: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: | | |
| make init-uv | |
| make install | |
| - name: Lint with Ruff | |
| run: make lint-python | |
| - name: Lint with Sqlfluff | |
| run: make lint-sql | |
| - name: Quality check with pyscn | |
| run: make lint-quality | |
| - name: Generate pyscn report | |
| if: always() | |
| run: make lint-quality-report | |
| - name: Upload pyscn report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pyscn-report | |
| path: .pyscn/reports/*.html | |
| - name: Comment pyscn summary on PR | |
| if: >- | |
| always() && | |
| github.event_name == 'pull_request' && | |
| github.event.pull_request.head.repo.full_name == github.repository | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| uv run pyscn analyze --json --output - . | jq -r ' | |
| "## pyscn report\n" + | |
| "- **Health Score:** " + (.summary.health_score | tostring) + " / 100 (" + .summary.grade + ")\n" + | |
| "- Complexity: " + (.summary.complexity_score | tostring) + "\n" + | |
| "- Dead code: " + (.summary.dead_code_score | tostring) + "\n" | |
| ' > comment.md | |
| gh pr comment "${{ github.event.pull_request.number }}" --body-file comment.md | |
| type-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: | | |
| make init-uv | |
| make install | |
| - name: Type checking with Pyrefly | |
| run: make type | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: | | |
| make init-uv | |
| make install | |
| - name: Test with pytest | |
| run: make test | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: | | |
| make init-uv | |
| make install | |
| - name: Verify build | |
| run: make build | |
| # nox: | |
| # runs-on: ubuntu-latest | |
| # strategy: | |
| # matrix: | |
| # python-version: | |
| # - "3.9" | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - name: Set up Python | |
| # uses: actions/setup-python@v4 | |
| # with: | |
| # python-version: ${{ matrix.python-version }} | |
| # - name: Install dependencies | |
| # run: | | |
| # make init-uv | |
| # make install | |
| # - name: Test with nox | |
| # run: make test-all |