Merge pull request #733 from chirizxc/bump-deps #15
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
| # This workflow will install Python dependencies, run tests and lint | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
| name: "CI" | |
| on: | |
| push: | |
| branches: [ "develop" ] | |
| pull_request: | |
| branches: [ "develop" ] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: true | |
| jobs: | |
| tools: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - name: "zizmor" | |
| commands: zizmor .github/ | |
| - name: "typos" | |
| commands: typos --config .typos.toml | |
| - name: "ast-grep" | |
| commands: | | |
| sg test --test-dir tests/ast-grep | |
| sg scan | |
| name: ${{ matrix.name }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: "3.14" | |
| - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | |
| with: | |
| enable-cache: ${{ github.ref_type != 'tag' }} # zizmor: ignore[cache-poisoning] | |
| - name: "Install ${{ matrix.name }}" | |
| run: uv pip install --group ${{ matrix.name }} --system | |
| - name: "Run ${{ matrix.name }}" | |
| run: ${{ matrix.commands }} | |
| testing: | |
| name: "Testing / python ${{ matrix.python-version }}" | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| python-version: | |
| - "3.10" | |
| - "3.11" | |
| - "3.12" | |
| - "3.13" | |
| - "3.14" | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: "Set up ${{ matrix.python-version }} on ${{ matrix.os }}" | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: "Install uv" | |
| uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | |
| - name: "Install dependencies" | |
| run: | | |
| uv pip install . --group ci --system | |
| - name: "Run ruff" | |
| run: | | |
| ruff check | |
| - name: "Run mypy" | |
| run: | | |
| mypy | |
| - name: "Run tests" | |
| run: | | |
| nox -t ci | |
| mv .coverage .coverage.${{ matrix.python-version }} | |
| - name: "Build doc" | |
| run: | | |
| uv pip install -r requirements_doc.txt --system | |
| sphinx-build -M html docs docs-build -W | |
| - name: "Store coverage file" | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| if: ${{ github.event_name == 'pull_request' }} | |
| with: | |
| name: coverage-${{ matrix.python-version }} | |
| path: .coverage.${{ matrix.python-version }} | |
| if-no-files-found: error | |
| include-hidden-files: true | |
| coverage: | |
| name: "Coverage" | |
| runs-on: ubuntu-latest | |
| needs: testing | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| if: ${{ github.event_name == 'pull_request' }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| id: download | |
| with: | |
| pattern: coverage-* | |
| merge-multiple: true | |
| - name: "Coverage comment" | |
| id: coverage_comment | |
| uses: py-cov-action/python-coverage-comment-action@63f52f4fbbffada6e8dee8ec432de7e01df9ba79 # v3.41 | |
| with: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| MERGE_COVERAGE_FILES: true | |
| MINIMUM_GREEN: 90 | |
| - name: "Store Pull Request comment to be posted (for external pr)" | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' | |
| with: | |
| name: python-coverage-comment-action | |
| path: python-coverage-comment-action.txt |