mirror of
https://github.com/long2ice/fastapi-cache.git
synced 2026-03-24 20:47:54 +00:00
CI: use a separate step to run linters
This makes it easier to separate linter dependencies from older Python releases.
This commit is contained in:
62
.github/workflows/ci.yml
vendored
62
.github/workflows/ci.yml
vendored
@@ -8,21 +8,61 @@ on:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
strategy:
|
||||
matrix:
|
||||
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
|
||||
|
||||
name: "Test on Python ${{ matrix.python }}"
|
||||
lint:
|
||||
name: Linter
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install Poetry
|
||||
run: pipx install poetry
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
cache: poetry
|
||||
- name: Install linting requirements
|
||||
run: poetry install --no-root --with=linting --all-extras
|
||||
- name: Execute linters
|
||||
run: |
|
||||
poetry run black --check --diff .
|
||||
poetry run flake8
|
||||
poetry run mypy
|
||||
poetry run pyright
|
||||
|
||||
test:
|
||||
needs:
|
||||
- lint
|
||||
strategy:
|
||||
matrix:
|
||||
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
|
||||
fail-fast: false
|
||||
|
||||
name: "Test on Python ${{ matrix.python }}"
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install Poetry
|
||||
run: pipx install poetry
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "${{ matrix.python }}"
|
||||
- name: Install and configure Poetry
|
||||
cache: poetry
|
||||
- name: Install testing requirements
|
||||
run: |
|
||||
pip install -U pip poetry
|
||||
poetry config virtualenvs.create false
|
||||
- name: CI
|
||||
run: make ci
|
||||
poetry install --no-root --with=dev --all-extras
|
||||
- name: Execute tests
|
||||
env:
|
||||
PYTHONDEVMODE: '1'
|
||||
run: poetry run pytest
|
||||
|
||||
test-summary:
|
||||
name: Test matrix status
|
||||
runs-on: ubuntu-latest
|
||||
needs: [test]
|
||||
if: always()
|
||||
steps:
|
||||
- name: Decide whether the needed jobs succeeded or failed
|
||||
uses: re-actors/alls-green@release/v1
|
||||
with:
|
||||
jobs: ${{ toJSON(needs) }}
|
||||
|
||||
Reference in New Issue
Block a user