|
48 | 48 |
|
49 | 49 | - name: Run mypy_primer |
50 | 50 | shell: bash |
51 | | - env: |
52 | | - TY_MEMORY_REPORT: mypy_primer |
53 | 51 | run: | |
54 | 52 | cd ruff |
55 | 53 |
|
@@ -101,3 +99,75 @@ jobs: |
101 | 99 | with: |
102 | 100 | name: pr-number |
103 | 101 | path: pr-number |
| 102 | + |
| 103 | + memory_usage: |
| 104 | + name: Run memory statistics |
| 105 | + runs-on: depot-ubuntu-22.04-32 |
| 106 | + timeout-minutes: 20 |
| 107 | + steps: |
| 108 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 109 | + with: |
| 110 | + path: ruff |
| 111 | + fetch-depth: 0 |
| 112 | + persist-credentials: false |
| 113 | + |
| 114 | + - name: Install the latest version of uv |
| 115 | + uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v6.3.1 |
| 116 | + |
| 117 | + - uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8 |
| 118 | + with: |
| 119 | + workspaces: "ruff" |
| 120 | + |
| 121 | + - name: Install Rust toolchain |
| 122 | + run: rustup show |
| 123 | + |
| 124 | + - name: Run mypy_primer |
| 125 | + shell: bash |
| 126 | + env: |
| 127 | + TY_MAX_PARALLELISM: 1 # for deterministic memory numbers |
| 128 | + TY_MEMORY_REPORT: mypy_primer |
| 129 | + run: | |
| 130 | + cd ruff |
| 131 | +
|
| 132 | + echo "Enabling mypy primer specific configuration overloads (see .github/mypy-primer-ty.toml)" |
| 133 | + mkdir -p ~/.config/ty |
| 134 | + cp .github/mypy-primer-ty.toml ~/.config/ty/ty.toml |
| 135 | +
|
| 136 | + PRIMER_SELECTOR="$(paste -s -d'|' crates/ty_python_semantic/resources/primer/memory.txt)" |
| 137 | +
|
| 138 | + echo "new commit" |
| 139 | + git rev-list --format=%s --max-count=1 "$GITHUB_SHA" |
| 140 | +
|
| 141 | + MERGE_BASE="$(git merge-base "$GITHUB_SHA" "origin/$GITHUB_BASE_REF")" |
| 142 | + git checkout -b base_commit "$MERGE_BASE" |
| 143 | + echo "base commit" |
| 144 | + git rev-list --format=%s --max-count=1 base_commit |
| 145 | +
|
| 146 | + cd .. |
| 147 | +
|
| 148 | + echo "Project selector: $PRIMER_SELECTOR" |
| 149 | + # Allow the exit code to be 0 or 1, only fail for actual mypy_primer crashes/bugs |
| 150 | + uvx \ |
| 151 | + --from="git+https://github.com/hauntsaninja/mypy_primer@e5f55447969d33ae3c7ccdb183e2a37101867270" \ |
| 152 | + mypy_primer \ |
| 153 | + --repo ruff \ |
| 154 | + --type-checker ty \ |
| 155 | + --old base_commit \ |
| 156 | + --new "$GITHUB_SHA" \ |
| 157 | + --project-selector "/($PRIMER_SELECTOR)\$" \ |
| 158 | + --output concise \ |
| 159 | + --debug > mypy_primer_memory.diff || [ $? -eq 1 ] |
| 160 | +
|
| 161 | + # Output diff with ANSI color codes |
| 162 | + cat mypy_primer_memory.diff |
| 163 | +
|
| 164 | + # Remove ANSI color codes before uploading |
| 165 | + sed -ie 's/\x1b\[[0-9;]*m//g' mypy_primer_memory.diff |
| 166 | +
|
| 167 | + echo ${{ github.event.number }} > pr-number |
| 168 | +
|
| 169 | + - name: Upload diff |
| 170 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
| 171 | + with: |
| 172 | + name: mypy_primer_memory_diff |
| 173 | + path: mypy_primer_memory.diff |
0 commit comments