diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2eec5b96c4a..4977932ba24 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -72,8 +72,8 @@ jobs: . venv/bin/activate pre-commit install --install-hooks - formatting: - name: Run pre-commit checks + pylint: + name: Run pylint check runs-on: ubuntu-latest needs: prepare-base steps: @@ -114,6 +114,48 @@ jobs: pip install -e . pre-commit run pylint --all-files + mypy: + name: Run mypy check + runs-on: ubuntu-latest + needs: prepare-base + steps: + - name: Check out code from GitHub + uses: actions/checkout@v2.3.4 + - name: Set up Python ${{ env.DEFAULT_PYTHON }} + id: python + uses: actions/setup-python@v2.2.2 + with: + python-version: ${{ env.DEFAULT_PYTHON }} + - name: Restore Python virtual environment + id: cache-venv + uses: actions/cache@v2.1.6 + with: + path: venv + key: + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + needs.prepare-base.outputs.python-key }} + - name: Fail job if Python cache restore failed + if: steps.cache-venv.outputs.cache-hit != 'true' + run: | + echo "Failed to restore Python venv from cache" + exit 1 + - name: Restore pre-commit environment + id: cache-precommit + uses: actions/cache@v2.1.6 + with: + path: ${{ env.PRE_COMMIT_CACHE }} + key: ${{ runner.os }}-${{ needs.prepare-base.outputs.pre-commit-key }} + - name: Fail job if pre-commit cache restore failed + if: steps.cache-precommit.outputs.cache-hit != 'true' + run: | + echo "Failed to restore pre-commit environment from cache" + exit 1 + - name: Run formatting check + run: | + . venv/bin/activate + pip install -e . + pre-commit run mypy --all-files + spelling: name: Run spelling checks runs-on: ubuntu-latest