This repository has been archived by the owner on Oct 2, 2023. It is now read-only.
Bump mypy from 0.961 to 1.5.1 #817
Workflow file for this run
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: CI | |
on: | |
- push | |
- pull_request | |
env: | |
PYTHON_VERSION: "3.10" | |
jobs: | |
codestyle: | |
name: Codestyle (black+isort) | |
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Cache Virtual Environment | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.cache/pypoetry | |
key: ${{ runner.os }}-venv-${{ hashFiles('poetry.lock') }} | |
- name: Setup poetry | |
run: | | |
pip install poetry poethepoet | |
poetry install -n --no-root | |
- name: Check code formatting with black and isort | |
run: poe black --diff --check && poe isort --diff --check | |
mypy: | |
name: mypy | |
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Cache Virtual Environment | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.cache/pypoetry | |
key: ${{ runner.os }}-venv-${{ hashFiles('poetry.lock') }} | |
- name: Setup poetry | |
run: | | |
pip install poetry poethepoet | |
poetry install -n --no-root | |
- name: Check typing with mypy | |
run: poe mypy | |
linter: | |
name: Linter (flake8) | |
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Cache Virtual Environment | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.cache/pypoetry | |
key: ${{ runner.os }}-venv-${{ hashFiles('poetry.lock') }} | |
- name: Setup poetry | |
run: | | |
pip install poetry poethepoet | |
poetry install -n --no-root | |
- name: Check code style with wemake-python-styleguide | |
run: poe flake8 | |
# - name: Lint with wemake-python-styleguide | |
# uses: wemake-services/[email protected] | |
# with: | |
# reporter: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && 'github-pr-review' || 'terminal' }} | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.github_token }} | |
build: | |
name: Build Python Package | |
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Check Version | |
run: | | |
if [[ $GITHUB_REF = refs/tags/v* ]]; then | |
tag=${GITHUB_REF#refs/tags/v} | |
version=$(grep '^version =' pyproject.toml | cut -d'"' -f2) | |
if [[ "$tag" != "$version" ]]; then | |
echo "::error::Tag $tag does not match version $version" | |
exit 1 | |
fi | |
fi | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Cache Virtual Environment | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.cache/pypoetry | |
key: ${{ runner.os }}-venv-${{ hashFiles('poetry.lock') }} | |
- name: Setup poetry | |
run: | | |
pip install poetry | |
poetry install -n --no-root | |
- name: Build python package | |
run: poetry build | |
- name: Upload dist | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: dist | |
pypi: | |
name: Deploy to PyPI | |
runs-on: ubuntu-latest | |
needs: [ codestyle, mypy, linter, build ] | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
environment: pypi | |
steps: | |
- name: Download dist | |
uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: dist | |
- name: Install Twine | |
run: pip install twine | |
- name: Upload package to PyPi | |
run: python -m twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} dist/* |