[pre-commit.ci] pre-commit autoupdate #266
This file contains 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: Type Check and Lint | |
on: [push, pull_request] | |
jobs: | |
pylint: | |
runs-on: ${{ matrix.os }} | |
# We want to run on external PRs, but not on our own internal PRs as they'll be run | |
# by the push to the branch. | |
if: | |
github.event_name == 'push' || github.event.pull_request.head.repo.full_name != | |
github.repository | |
strategy: | |
matrix: | |
os: [ubuntu-latest] # macos-latest, windows-latest # disabled others to conserve workflow runtime | |
python-version: ["3.10"] | |
# env: | |
# OS: ${{ matrix.os }} | |
# PYTHON: ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
cache-dependency-path: "requirements-dev.txt" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements-dev.txt | |
- name: Setup cache | |
id: cache-pylint | |
uses: actions/cache@v3 | |
with: | |
path: .pylint.d | |
key: ${{ matrix.os }}-${{ matrix.python-version }}-pylint | |
# - name: Enable fixme checks if PR | |
# if: github.event.pull_request.number | |
# run: | | |
# echo "enable=fixme" >> .pylintrc | |
- name: Analyse code with pylint | |
run: | | |
pylint time_str/ | |
mypy: | |
runs-on: ${{ matrix.os }} | |
if: | |
github.event_name == 'push' || github.event.pull_request.head.repo.full_name != | |
github.repository | |
strategy: | |
matrix: | |
os: [ubuntu-latest] # macos-latest, windows-latest # disabled others to conserve workflow runtime | |
python-version: ["3.10"] | |
# env: | |
# OS: ${{ matrix.os }} | |
# PYTHON: ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
cache-dependency-path: "requirements-dev.txt" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements-dev.txt | |
- name: Setup cache | |
id: cache-mypy | |
uses: actions/cache@v3 | |
with: | |
path: .mypy_cache | |
key: ${{ matrix.os }}-${{ matrix.python-version }}-mypy | |
- name: Make mypy cache directory if cache miss | |
if: steps.cache-mypy.outputs.cache-hit != 'true' | |
run: mkdir --parents --verbose .mypy_cache | |
- name: Run type checks with Mypy | |
run: mypy --non-interactive time_str/ |