Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: build

on:
push:
branches:
- master
schedule:
- cron: '0 0 * * *' # Nightly build

jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 3
matrix:
python-version: [3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v1
id: cache-deps
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- uses: actions/cache@v1
with:
path: .mypy_cache
key: mypy-${{ matrix.python-version }}
- uses: actions/cache@v1
with:
path: .pytest_cache
key: pytest-${{ matrix.python-version }}
- name: Check that formatting, linting, and tests pass
run: |
make ci
- name: Submit coverage report
run: |
codecov --token=${{ secrets.CODECOV_TOKEN }}
- name: Check docs build
# only run this for the python version used by netlify:
if: matrix.python-version == 3.7
run: |
make docs-build-ci
65 changes: 36 additions & 29 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: build-pull-request

on:
pull_request:
Expand All @@ -14,31 +14,38 @@ jobs:
python-version: [3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v1
id: cache-deps
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- uses: actions/cache@v1
with:
path: .mypy_cache
key: mypy
- uses: actions/cache@v1
with:
path: .pytest_cache
key: pytest
- name: Perform CI steps
run: |
make ci
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v1
id: cache-deps
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- uses: actions/cache@v1
with:
path: .mypy_cache
key: mypy-${{ matrix.python-version }}
- uses: actions/cache@v1
with:
path: .pytest_cache
key: pytest-${{ matrix.python-version }}
- name: Check that formatting, linting, and tests pass
run: |
make ci
- name: Submit coverage report
run: |
codecov --token=${{ secrets.CODECOV_TOKEN }}
- name: Check docs build
# only run this for the python version used by netlify:
if: matrix.python-version == 3.7
run: |
make docs-build-ci
22 changes: 15 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
SHELL := /bin/bash
.DEFAULT_GOAL := help

pkg_src = fastapi_utils
Expand Down Expand Up @@ -48,14 +49,15 @@ testcov:
fi

.PHONY: ci ## Run all CI validation steps without making any changes to code
default: test lint mypy check-format
ci: check-format lint mypy test

.PHONY: check-format ## Check the source code format without changes
check-format:
$(isort) --check-only
@echo $(autoflake) --check
@( set -o pipefail; $(autoflake) --check | (grep -v "No issues detected!" || true) )
$(isort) $(docs_src) --check-only
@echo $(autoflake) $(docs_src) --check
@( set -o pipefail; $(autoflake) $(docs_src) --check | (grep -v "No issues detected!" || true) )
$(black) --check
black -l 82 $(docs_src) --check

.PHONY: clean ## Remove temporary and cache files/directories
clean:
Expand Down Expand Up @@ -94,11 +96,17 @@ docs-build:
cp ./docs/index.md ./README.md
cp ./docs/contributing.md ./CONTRIBUTING.md

.PHONY: docs-build-ci ## Generate the docs and check README.md is up-to-date
docs-build-ci:
python -m mkdocs build
cmp README.md docs/index.md
cmp CONTRIBUTING.md docs/contributing.md

.PHONY: docs-format ## Format the python code that is part of the docs
docs-format:
isort -rc docs/src
autoflake -r --remove-all-unused-imports --ignore-init-module-imports docs/src -i
black -l 82 docs/src
isort -rc $(docs_src)
autoflake -r --remove-all-unused-imports --ignore-init-module-imports $(docs_src) -i
black -l 82 $(docs_src)

.PHONY: docs-live ## Serve the docs with live reload as you make changes
docs-live:
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
<p align="center">
<em>Reusable utilities for FastAPI</em>
</p>

<p align="center">
<img src="https://img.shields.io/github/last-commit/dmontagu/fastapi-utils.svg">
<a href="https://github.com/dmontagu/" target="_blank">
<img src="https://github.com/dmontagu/fastapi-utils/workflows/build/badge.svg" alt="Build">
</a>
<a href="https://codecov.io/gh/dmontagu/fastapi-utils" target="_blank">
<img src="https://codecov.io/gh/dmontagu/fastapi-utils/branch/master/graph/badge.svg" alt="Coverage">
</a>
<a href="https://app.netlify.com/sites/trusting-archimedes-72b369/deploys">
<img src="https://img.shields.io/netlify/28b2a077-65b1-4d6c-9dba-13aaf6059877" alt="Netlify status">
</a>
<br />
<a href="https://pypi.org/project/fastapi-utils" target="_blank">
<img src="https://badge.fury.io/py/fastapi-utils.svg" alt="Package version">
</a>
<img src="https://img.shields.io/pypi/pyversions/fastapi-utils.svg">
<img src="https://img.shields.io/github/license/dmontagu/fastapi-utils.svg">
</p>

---

Expand Down
19 changes: 18 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
<p align="center">
<em>Reusable utilities for FastAPI</em>
</p>

<p align="center">
<img src="https://img.shields.io/github/last-commit/dmontagu/fastapi-utils.svg">
<a href="https://github.com/dmontagu/" target="_blank">
<img src="https://github.com/dmontagu/fastapi-utils/workflows/build/badge.svg" alt="Build">
</a>
<a href="https://codecov.io/gh/dmontagu/fastapi-utils" target="_blank">
<img src="https://codecov.io/gh/dmontagu/fastapi-utils/branch/master/graph/badge.svg" alt="Coverage">
</a>
<a href="https://app.netlify.com/sites/trusting-archimedes-72b369/deploys">
<img src="https://img.shields.io/netlify/28b2a077-65b1-4d6c-9dba-13aaf6059877" alt="Netlify status">
</a>
<br />
<a href="https://pypi.org/project/fastapi-utils" target="_blank">
<img src="https://badge.fury.io/py/fastapi-utils.svg" alt="Package version">
</a>
<img src="https://img.shields.io/pypi/pyversions/fastapi-utils.svg">
<img src="https://img.shields.io/github/license/dmontagu/fastapi-utils.svg">
</p>

---

Expand Down
71 changes: 56 additions & 15 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ pytest-cov = "*"
pytest-asyncio = "*"
coverage = "*"

# Python 3.6 Testing
async-exit-stack = { version = "*", python = "~3.6" }
async-generator = { version = "*", python = "~3.6" }

# CI
codecov = "*"

# Static
isort = "*"
autoflake = "*"
Expand Down
Loading