Skip to content

Commit

Permalink
Run mypy only once in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
akaihola committed Aug 28, 2022
1 parent 23455b6 commit cd801c6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: mypy

on: push # yamllint disable-line rule:truthy

jobs:
mypy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- run: pip install 'mypy>=0.940'
- uses: Gobot1234/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
mypy: true
continue_on_error: false
12 changes: 6 additions & 6 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
constraints: '--constraint constraints-future.txt'
upgrade: '--upgrade --upgrade-strategy=eager'
env:
RUN_MYPY_AND_PYLINT: >-
RUN_PYLINT: >-
${{ matrix.python-version == '3.9' || matrix.python-version == '3.10' }}
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -103,12 +103,12 @@ jobs:
pip_options: ${{ matrix.upgrade }} ${{ matrix.constraints }}
run: pip install ${pip_options}
"dist/darker-${{ env.VERSION }}-py3-none-any.whl[test]"
- name: Run Pytest without Mypy and Pylint if Python < 3.9
if: env.RUN_MYPY_AND_PYLINT == 'false'
- name: Run Pytest without Pylint if Python < 3.9
if: env.RUN_PYLINT == 'false'
run: |
pytest ${{ matrix.lint }}
- name: Run Pytest with Mypy and Pylint if Python >= 3.9
if: env.RUN_MYPY_AND_PYLINT == 'true'
- name: Run Pytest with Pylint if Python >= 3.9
if: env.RUN_PYLINT == 'true'
shell: python
run: |
import sys
Expand All @@ -117,7 +117,7 @@ jobs:
import toml
data = toml.load("pyproject.toml")
data["tool"]["darker"]["lint"] = ["pylint", "mypy"]
data["tool"]["darker"]["lint"] = ["pylint"]
Path("pyproject.toml").write_text(toml.dumps(data))
pytest_cmd = ["pytest"] + "${{ matrix.lint }}".split()
retval = run(pytest_cmd).returncode
Expand Down

0 comments on commit cd801c6

Please sign in to comment.