Created separate workflow for running mypy_primer on push to main.

This commit is contained in:
Eric Traut 2023-06-08 22:45:10 -06:00
parent 10e077bfed
commit b6c8378950
3 changed files with 71 additions and 6 deletions

View File

@ -3,7 +3,7 @@ name: Comment with mypy_primer diff
on:
workflow_run:
workflows:
- Run mypy_primer
- Run mypy_primer on PR
types:
- completed

View File

@ -1,4 +1,4 @@
name: Run mypy_primer
name: Run mypy_primer on PR
on:
pull_request:
@ -13,13 +13,13 @@ concurrency:
jobs:
mypy_primer:
name: Run mypy_primer
name: Run mypy_primer on PR
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
shard-index: [0, 1, 2]
shard-index: [0]
fail-fast: false
steps:
- uses: actions/checkout@v3
@ -38,6 +38,12 @@ jobs:
run: |
cd pyright_to_test
echo "new commit"
git rev-list --format=%s --max-count=1 $GITHUB_SHA
MERGE_BASE=$(git merge-base $GITHUB_SHA origin/$GITHUB_BASE_REF)
git checkout -b base_commit $MERGE_BASE
echo "base commit"
git rev-list --format=%s --max-count=1 base_commit
echo ''
cd ..
@ -46,8 +52,8 @@ jobs:
mypy_primer \
--repo pyright_to_test \
--type-checker pyright \
--new $GITHUB_SHA \
--num-shards 3 --shard-index ${{ matrix.shard-index }} \
--new $GITHUB_SHA --old base_commit \
--num-shards 1 --shard-index ${{ matrix.shard-index }} \
--debug \
--output concise \
| tee diff_${{ matrix.shard-index }}.txt

59
.github/workflows/mypy_primer_push.yaml vendored Normal file
View File

@ -0,0 +1,59 @@
name: Run mypy_primer on push
on:
push:
branches:
- main
paths:
- 'packages/pyright/**'
- 'packages/pyright-internal/src/**'
- 'packages/pyright-internal/typeshed-fallback/**'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
mypy_primer:
name: Run mypy_primer on push
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
path: pyright_to_test
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install -U pip
pip install git+https://github.com/hauntsaninja/mypy_primer.git
- name: Run mypy_primer
shell: bash
run: |
cd pyright_to_test
echo "new commit"
git rev-list --format=%s --max-count=1 $GITHUB_SHA
cd ..
# fail action if exit code isn't zero or one
(
mypy_primer \
--repo pyright_to_test \
--type-checker pyright \
--new $GITHUB_SHA \
--debug \
--output concise \
| tee diff.txt
) || [ $? -eq 1 ]
- name: Upload mypy_primer diff
uses: actions/upload-artifact@v3
with:
name: mypy_primer_diffs
path: diff.txt