From 4faa5b71017b30f00d4e28ec296caea254d893b4 Mon Sep 17 00:00:00 2001 From: long2ice Date: Tue, 19 Oct 2021 11:56:51 +0800 Subject: [PATCH] update workflows --- .github/workflows/ci.yml | 7 +++---- .github/workflows/pypi.yml | 7 +++---- Makefile | 25 ++++++------------------- pyproject.toml | 4 ++++ 4 files changed, 16 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 104eec2..8e626b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,9 +8,8 @@ jobs: - uses: actions/setup-python@v2 with: python-version: "3.x" - - name: Install and configure Poetry - uses: snok/install-poetry@v1.1.1 - with: - virtualenvs-create: false + - uses: abatilo/actions-poetry@v2.1.3 + - name: Config poetry + run: poetry config experimental.new-installer false - name: CI run: make ci diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 080f33b..4e3abdd 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -11,10 +11,9 @@ jobs: - uses: actions/setup-python@v1 with: python-version: '3.x' - - name: Install and configure Poetry - uses: snok/install-poetry@v1.1.1 - with: - virtualenvs-create: false + - uses: abatilo/actions-poetry@v2.1.3 + - name: Config poetry + run: poetry config experimental.new-installer false - name: Build dists run: make build - name: Pypi Publish diff --git a/Makefile b/Makefile index c0f0381..8bd34b8 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,6 @@ checkfiles = fastapi_cache/ examples/ tests/ -black_opts = -l 100 -t py38 py_warn = PYTHONDEVMODE=1 -help: - @echo "FastAPI-Cache development makefile" - @echo - @echo "usage: make " - @echo "Targets:" - @echo " up Ensure dev/test dependencies are updated" - @echo " deps Ensure dev/test dependencies are installed" - @echo " check Checks that build is sane" - @echo " test Runs all tests" - @echo " style Auto-formats the code" - @echo " build Build package" - up: @poetry update @@ -21,16 +8,16 @@ deps: @poetry install --no-root -E all style: deps - @isort -src $(checkfiles) - @black $(black_opts) $(checkfiles) + @poetry run isort -src $(checkfiles) + @poetry run black $(checkfiles) check: deps - @black --check $(black_opts) $(checkfiles) || (echo "Please run 'make style' to auto-fix style issues" && false) - @flake8 $(checkfiles) - @bandit -r $(checkfiles) + @poetry run black $(checkfiles) || (echo "Please run 'make style' to auto-fix style issues" && false) + @poetry run flake8 $(checkfiles) + @poetry run bandit -r $(checkfiles) test: deps - $(py_warn) pytest + $(py_warn) poetry run pytest build: clean deps @poetry build diff --git a/pyproject.toml b/pyproject.toml index 4e406f9..ee8c1d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,3 +37,7 @@ build-backend = "poetry.masonry.api" redis = ["aioredis"] memcache = ["aiomcache"] all = ["aioredis","aiomcache"] + +[tool.black] +line-length = 100 +target-version = ['py36', 'py37', 'py38', 'py39']