This repository has been archived by the owner on Mar 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
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
0 parents
commit 829f3ed
Showing
24 changed files
with
4,964 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[flake8] | ||
filename = *.py,src/ | ||
max-line-length = 88 | ||
extend-ignore = D105, D107, D401, E203, E402 |
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 |
---|---|---|
@@ -0,0 +1,126 @@ | ||
--- | ||
name: tests | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- "**.md" | ||
- "LICENSE" | ||
- ".gitignore" | ||
- ".pre-commit-config.yaml" | ||
|
||
env: | ||
CACHE_DIR: /tmp/.workflow_cache | ||
POETRY_CACHE_DIR: /tmp/.workflow_cache/.pip_packages | ||
POETRY_VIRTUALENVS_PATH: /tmp/.workflow_cache/.venvs | ||
POETRY_HOME: /tmp/.workflow_cache/.poetry | ||
PIP_CACHE_DIR: /tmp/.workflow_cache/.pip_packages | ||
MYPY_CACHE_DIR: /tmp/.workflow_cache/.mypy | ||
|
||
jobs: | ||
tests: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ["ubuntu-latest"] | ||
python-version: ["3.x", "3.8", "3.9", "3.10"] | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
id: cache | ||
with: | ||
path: ${{ env.CACHE_DIR }} | ||
key: tests-${{ matrix.os }}-${{ matrix.python-version }}--${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
curl -sSL https://install.python-poetry.org | python - | ||
$POETRY_HOME/bin/poetry install -n -E "all" | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
|
||
- name: Python code style | ||
run: $POETRY_HOME/bin/poetry run black . --check --diff --preview | ||
if: ${{ matrix.python-version == '3.x' }} | ||
|
||
- name: Python code quality | ||
run: $POETRY_HOME/bin/poetry run flake8 --docstring-convention google | ||
if: ${{ matrix.python-version == '3.x' }} | ||
|
||
- name: Python code typing | ||
run: $POETRY_HOME/bin/poetry run mypy --strict --install-types --non-interactive . | ||
if: ${{ matrix.python-version == '3.x' }} | ||
|
||
- name: Python code complexity | ||
run: $POETRY_HOME/bin/poetry run radon cc -n C aio_lambda_api 1>&2 | ||
if: ${{ matrix.python-version == '3.x' }} | ||
|
||
- name: Python code maintainability | ||
run: $POETRY_HOME/bin/poetry run radon mi -n B aio_lambda_api 1>&2 | ||
if: ${{ matrix.python-version == '3.x' }} | ||
|
||
- name: Python code security | ||
run: $POETRY_HOME/bin/poetry run bandit aio_lambda_api -rs B404,B603 | ||
if: ${{ matrix.python-version == '3.x' }} | ||
|
||
- name: YAML code style | ||
run: $POETRY_HOME/bin/poetry run yamllint -s . | ||
if: ${{ matrix.python-version == '3.x' }} | ||
|
||
- name: Test | ||
run: $POETRY_HOME/bin/poetry run pytest --junitxml=test-results.xml --cov-report xml | ||
if: ${{ always() }} | ||
|
||
- name: Collect coverage report | ||
uses: codecov/codecov-action@v3 | ||
|
||
publish: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: ["ubuntu-latest"] | ||
python-version: ["3.x"] | ||
if: ${{ github.repository == 'JGoutin/aio_lambda_api' && github.ref_type == 'tag' }} | ||
needs: [tests] | ||
environment: PyPI | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
id: cache | ||
with: | ||
path: ${{ env.CACHE_DIR }} | ||
key: tests-${{ matrix.os }}-${{ matrix.python-version }}--${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Build packages | ||
run: $POETRY_HOME/bin/poetry version $(echo -e "${{ github.ref_name }}" | tr -d 'v') | ||
|
||
- name: Publish packages on PyPI | ||
run: $POETRY_HOME/bin/poetry publish --build | ||
env: | ||
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} | ||
|
||
- name: Publish release on GitHub | ||
run: | | ||
go install github.com/tcnksm/ghr@latest | ||
~/go/bin/ghr -generatenotes $PRERELEASE -c ${{ github.sha }} ${{ github.ref_name }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PRERELEASE: ${{ contains(github.ref_name, '-') && '-prerelease' || '' }} |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Python compiled files | ||
__pycache__/ | ||
*.py[cd] | ||
|
||
# OS generated files | ||
.DS_Store | ||
.DS_Store? | ||
._* | ||
.Spotlight-V100 | ||
.Trashes | ||
ehthumbs.db | ||
[Dd]esktop.ini | ||
Thumbs.db | ||
*~ | ||
*.bak | ||
|
||
# IDE generated files | ||
.project | ||
.pydevproject | ||
.spyproject | ||
.spyderproject | ||
.settings/ | ||
.idea/ | ||
.vscode/ | ||
|
||
# Tests generated files | ||
.cache/ | ||
.coverage | ||
.coverage.* | ||
.mypy_cache/ | ||
.pytest_cache/ | ||
|
||
# Build | ||
dist/ |
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
repos: | ||
- repo: local | ||
hooks: | ||
- id: black | ||
name: Black (Formatting) | ||
entry: poetry run black . --preview | ||
language: system | ||
pass_filenames: false | ||
- id: mypy | ||
name: Mypy (Typing) | ||
entry: poetry run mypy --strict . | ||
language: system | ||
pass_filenames: false | ||
- id: flake8 | ||
name: Flake8 (Quality) | ||
entry: poetry run flake8 --docstring-convention google | ||
language: system | ||
pass_filenames: false | ||
- id: radon_cc | ||
name: Radon (Cyclomatic complexity) | ||
entry: poetry run radon cc -n C aio_lambda_api | ||
language: system | ||
pass_filenames: false | ||
verbose: true | ||
- id: radon_mi | ||
name: Radon (Maintainability index) | ||
entry: poetry run radon mi -n B aio_lambda_api | ||
language: system | ||
pass_filenames: false | ||
verbose: true | ||
- id: bandit | ||
name: Bandit (Security) | ||
entry: poetry run bandit aio_lambda_api -qrs B404,B603 | ||
language: system | ||
pass_filenames: false |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
extends: default | ||
rules: | ||
line-length: disable | ||
truthy: disable |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Copyright 2022 Accelize | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Oops, something went wrong.