-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
985 additions
and
345 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,86 @@ | ||
name: check | ||
name: Checks | ||
|
||
on: [push, pull_request] | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
env: | ||
ANSICON: 1 | ||
FORCE_COLOR: 1 | ||
|
||
jobs: | ||
check: | ||
name: Check | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
max-parallel: 6 | ||
fail-fast: false | ||
matrix: | ||
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] | ||
python-version: | ||
- '3.8' | ||
- '3.9' | ||
- '3.10' | ||
- '3.11' | ||
- 'pypy-3.8' | ||
- 'pypy-3.9' | ||
|
||
steps: | ||
- uses: actions/cache@v3 | ||
name: Cache pip | ||
- name: "📥 Checkout" | ||
uses: actions/checkout@v3 | ||
with: | ||
path: "~/.cache/pip" | ||
key: pip-${{ runner.os }}-${{ matrix.python-version }} | ||
fetch-depth: 0 | ||
|
||
- uses: actions/cache@v3 | ||
name: Cache mypy | ||
- name: "✨ Install Poetry" | ||
run: | | ||
pipx install poetry | ||
pipx inject poetry poetry-dynamic-versioning | ||
- name: 🐍 Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
path: ".mypy_cache" | ||
key: mypy-${{ runner.os }}-${{ matrix.python-version }} | ||
python-version: ${{ matrix.python-version }} | ||
cache: poetry | ||
|
||
- uses: actions/cache@v3 | ||
name: Cache pytest | ||
- name: "🗃 Cache" | ||
if: success() || failure() | ||
uses: actions/cache@v3 | ||
with: | ||
path: ".pytest_cache" | ||
key: pytest-${{ runner.os }}-${{ matrix.python-version }} | ||
path: | | ||
.mypy_cache | ||
.pytest_cache | ||
.ruff_cache | ||
key: ${{ runner.os }}-${{ matrix.python-version }}-check | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: "📥 Install the package" | ||
run: make install | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: "🪄 Linter: Black" | ||
run: make lint/black | ||
|
||
- name: Install | ||
run: make venv | ||
- name: "🪄 Linter: Ruff" | ||
if: success() || failure() | ||
run: make lint/ruff | ||
|
||
- name: Test | ||
run: make unittests | ||
- name: "🪄 Linter: mypy" | ||
if: success() || failure() | ||
run: make lint/mypy | ||
|
||
- name: Lint | ||
run: make lint | ||
- name: "🧪 Tests" | ||
if: success() || failure() | ||
run: poetry run pytest tests --test-redis | ||
|
||
- name: Coveralls | ||
uses: coverallsapp/github-action@master | ||
- name: "📤 Codecov" | ||
if: success() || failure() | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
flag-name: ${{ matrix.python-version }} | ||
parallel: true | ||
path-to-lcov: .coverage.lcov | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
env_vars: PYTHON | ||
name: Python ${{ matrix.python-version }} | ||
files: coverage.xml | ||
fail_ci_if_error: true | ||
|
||
finish: | ||
needs: check | ||
if: always() | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Coveralls Finished | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
parallel-finished: true | ||
- name: "📦 Build and publish package: dry run" | ||
if: success() || failure() | ||
run: poetry publish --build --dry-run --ansi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,45 @@ | ||
name: publish | ||
name: Publish | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
env: | ||
ANSICON: 1 | ||
FORCE_COLOR: 1 | ||
|
||
jobs: | ||
build-n-publish: | ||
publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: ⬇️ Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: 🔖 Get history and tags | ||
run: | | ||
git fetch --prune --unshallow | ||
git fetch --depth=1 origin +refs/tags/*:refs/tags/* | ||
- name: 🐍 Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: ⚙️ Install | ||
run: pip install build | ||
|
||
- name: 🏗 Build | ||
run: python -m build --sdist --wheel --outdir dist/ . | ||
|
||
- name: 📦 Publish | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
- name: 📥 Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: 📝 Build changelog | ||
id: changelog | ||
uses: Bullrich/generate-release-changelog@master | ||
env: | ||
REPO: ${{ github.repository }} | ||
|
||
- name: 📤 Update release | ||
uses: tubone24/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
release_name: ${{ github.ref_name }} | ||
body: ${{ steps.changelog.outputs.changelog }} | ||
|
||
- name: "✨ Install Poetry" | ||
run: | | ||
pipx install poetry | ||
pipx inject poetry poetry-dynamic-versioning | ||
- name: 📦 Build package | ||
run: poetry build --ansi | ||
|
||
- name: 📤 Publish package | ||
run: poetry publish --ansi | ||
env: | ||
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,54 @@ | ||
# Please follow the Makefile style guide. | ||
# http://clarkgrubb.com/makefile-style-guide | ||
|
||
BIN := venv/bin | ||
|
||
.PHONY: build | ||
build: | ||
$(BIN)/python -m build --sdist --wheel | ||
|
||
.PHONY: publish | ||
publish: | ||
$(BIN)/python -m twine upload dist/* | ||
.PHONY: all | ||
all: install lint test build | ||
|
||
.PHONY: clean | ||
clean: | ||
find . -type d -name __pycache__ -delete | ||
rm -rf venv .mypy_cache .pytest_cache build dist *.egg-info .coverage .benchmarks | ||
rm -rf .ruff_cache .mypy_cache .pytest_cache | ||
find . -name "*.pyc" -delete | ||
rm -rf *.egg-info build | ||
rm -rf coverage*.xml .coverage | ||
rm -rf .benchmarks | ||
|
||
.PHONY: venv | ||
venv: | ||
python3 -m venv venv | ||
$(BIN)/pip install --upgrade pip wheel | ||
$(BIN)/pip install -e.[dev] | ||
.PHONY: install | ||
install: | ||
poetry install --all-extras --with dev | ||
|
||
.PHONY: test check | ||
test check: unittests lint | ||
.PHONY: lint | ||
lint: lint/ruff lint/black lint/mypy | ||
|
||
.PHONY: unittests | ||
unittests: | ||
$(BIN)/coverage run --source=pure_protobuf -m pytest --benchmark-disable tests | ||
$(BIN)/coverage lcov -o .coverage.lcov | ||
$(BIN)/coverage xml -o .coverage.xml | ||
$(BIN)/coverage html -d .coverage.html | ||
.PHONY: lint/black | ||
lint/black: | ||
poetry run black --diff --check pure_protobuf tests | ||
|
||
.PHONY: benchmark | ||
benchmark: | ||
$(BIN)/pytest --benchmark-only --benchmark-columns=mean,stddev,median,ops --benchmark-warmup=on tests | ||
.PHONY: lint/ruff | ||
lint/ruff: | ||
poetry run ruff pure_protobuf tests | ||
|
||
.PHONY: format | ||
format: format/isort format/black | ||
.PHONY: lint/mypy | ||
lint/mypy: | ||
poetry run mypy pure_protobuf tests | ||
|
||
.PHONY: format/isort | ||
format/isort: | ||
$(BIN)/isort pure_protobuf tests | ||
.PHONY: format | ||
format: format/ruff format/black | ||
|
||
.PHONY: format/black | ||
format/black: | ||
$(BIN)/black pure_protobuf tests | ||
|
||
.PHONY: lint | ||
lint: lint/flake8 lint/isort lint/mypy lint/format | ||
poetry run black pure_protobuf tests | ||
|
||
.PHONY: lint/flake8 | ||
lint/flake8: | ||
$(BIN)/flake8 pure_protobuf tests | ||
.PHONY: format/ruff | ||
format/ruff: | ||
poetry run ruff --fix pure_protobuf tests | ||
|
||
.PHONY: lint/isort | ||
lint/isort: | ||
$(BIN)/isort -c --diff pure_protobuf tests | ||
.PHONY: test | ||
test: | ||
poetry run pytest tests --benchmark-disable | ||
|
||
.PHONY: lint/mypy | ||
lint/mypy: | ||
$(BIN)/mypy pure_protobuf tests | ||
.PHONY: benchmark | ||
benchmark: | ||
poetry run pytest tests --benchmark-only --benchmark-columns=mean,stddev,median,ops --benchmark-warmup=on | ||
|
||
.PHONY: lint/format | ||
lint/format: | ||
$(BIN)/black --check --diff pure_protobuf tests | ||
.PHONY: build | ||
build: | ||
poetry build |
Oops, something went wrong.