Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/github_actions/hmarr/auto-appro…
Browse files Browse the repository at this point in the history
…ve-action-4.0.0
  • Loading branch information
collerek authored Mar 23, 2024
2 parents 045ef6d + 32bf9fd commit 7e4fd44
Show file tree
Hide file tree
Showing 295 changed files with 8,119 additions and 9,296 deletions.
6 changes: 0 additions & 6 deletions .flake8

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/auto-merge-dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.6.0
uses: dependabot/fetch-metadata@v2.0.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ jobs:
run: |
echo $RELEASE_VERSION
echo ${{ env.RELEASE_VERSION }}
# - name: Deploy
# run: |
# mike deploy --push --update-aliases ${{ env.RELEASE_VERSION }} latest
- name: Deploy
run: |
mike deploy --push --update-aliases ${{ env.RELEASE_VERSION }} latest
44 changes: 44 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: lint

on:
push:
branches-ignore:
- 'gh-pages'
pull_request:
branches: [ master, pydantic_v2 ]

jobs:
lint:
name: "Python ${{ matrix.python-version }}"
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'collerek/ormar'
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install Poetry
uses: snok/[email protected]
with:
version: 1.4.2
virtualenvs-create: false

- name: Poetry details
run: |
poetry --version
poetry config --list
- name: Install dependencies
run: poetry install --extras "all" --no-root

- name: Format
run: make fmt

- name: Lint
run: make lint
62 changes: 51 additions & 11 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: build
name: test

on:
push:
branches-ignore:
- 'gh-pages'
pull_request:
branches: [ master ]
branches: [ master, pydantic_v2 ]

jobs:
tests:
Expand All @@ -17,7 +17,7 @@ jobs:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'collerek/ormar'
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", 3.11]
python-version: [3.8, 3.9, "3.10", 3.11]
fail-fast: false
services:
mysql:
Expand All @@ -39,35 +39,75 @@ jobs:
POSTGRES_DB: testsuite
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 --name postgres

steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
with:
submodules: false

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies

- name: Install Poetry
uses: snok/[email protected]
with:
version: 1.4.2
virtualenvs-create: false

- name: Poetry details
run: |
python -m pip install poetry==1.4.2
poetry install --extras "all"
env:
POETRY_VIRTUALENVS_CREATE: false
poetry --version
poetry config --list
- name: Install dependencies
run: poetry install --extras "all"

- name: Run mysql
env:
DATABASE_URL: "mysql://username:[email protected]:3306/testsuite"
run: bash scripts/test.sh

- name: Install postgresql-client
run: |
sudo apt-get update
sudo apt-get install --yes postgresql-client
- name: Connect to PostgreSQL with CLI
run: env PGPASSWORD=password psql -h localhost -U username -c 'SELECT VERSION();' testsuite

- name: Show max connections
run: env PGPASSWORD=password psql -h localhost -U username -c 'SHOW max_connections;' testsuite

- name: Alter max connections
run: |
docker exec -i postgres bash << EOF
sed -i -e 's/max_connections = 100/max_connections = 1000/' /var/lib/postgresql/data/postgresql.conf
sed -i -e 's/shared_buffers = 128MB/shared_buffers = 512MB/' /var/lib/postgresql/data/postgresql.conf
EOF
docker restart --time 0 postgres
sleep 5
- name: Show max connections
run: env PGPASSWORD=password psql -h localhost -U username -c 'SHOW max_connections;' testsuite

- name: Run postgres
env:
DATABASE_URL: "postgresql://username:password@localhost:5432/testsuite"
run: bash scripts/test.sh

- name: Run sqlite
env:
DATABASE_URL: "sqlite:///testsuite"
run: bash scripts/test.sh
- run: mypy ormar tests benchmarks

- name: Upload coverage
uses: codecov/[email protected]

- name: Test & publish code coverage
uses: paambaati/[email protected]
if: github.event.pull_request.head.repo.full_name == 'collerek/ormar'
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/test_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: test_docs

on:
push:
branches-ignore:
- 'gh-pages'
pull_request:
branches: [ master, pydantic_v2 ]

jobs:
tests_docs:
name: "Python ${{ matrix.python-version }}"
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'collerek/ormar'
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install poetry==1.4.2
poetry install --extras "all"
env:
POETRY_VIRTUALENVS_CREATE: false
- name: Test docs
run: bash scripts/test_docs.sh
41 changes: 41 additions & 0 deletions .github/workflows/type-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: type_check

on:
push:
branches-ignore:
- 'gh-pages'
pull_request:
branches: [ master, pydantic_v2 ]

jobs:
lint:
name: "Python ${{ matrix.python-version }}"
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'collerek/ormar'
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install Poetry
uses: snok/[email protected]
with:
version: 1.4.2
virtualenvs-create: false

- name: Poetry details
run: |
poetry --version
poetry config --list
- name: Install dependencies
run: poetry install --extras "all" --no-root

- name: Type check
run: make type_check
36 changes: 7 additions & 29 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,9 @@
repos:
- repo: https://github.com/psf/black
rev: 22.3.0
- repo: local
hooks:
- id: black
exclude: ^(docs_src/|examples/)
- repo: https://github.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
exclude: ^(docs_src/|examples/|tests/)
args: [ '--max-line-length=88' ]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.982
hooks:
- id: mypy
exclude: ^(docs_src/|examples/)
args: [--no-strict-optional, --ignore-missing-imports]
additional_dependencies: [
types-ujson>=0.1.1,
types-PyMySQL>=1.0.2,
types-ipaddress>=1.0.0,
types-enum34>=1.1.0,
types-cryptography>=3.3.5,
types-orjson>=3.6.0,
types-aiofiles>=0.1.9,
types-pkg-resources>=0.1.3,
types-requests>=2.25.9,
types-toml>=0.10.0,
pydantic>=1.8.2
]
- id: pre-commit-local
name: format
entry: make pre-commit
language: python
pass_filenames: false

20 changes: 12 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,22 @@ test_mysql:
test_sqlite:
bash scripts/test.sh -svv

test_docs:
bash scripts/test_docs.sh -svv

test:
pytest
pytest -svv tests/

coverage:
pytest --cov=ormar --cov=tests --cov-fail-under=100 --cov-report=term-missing
pytest --cov=ormar --cov=tests --cov-fail-under=100 --cov-report=term-missing tests

black:
black ormar tests
type_check:
mkdir -p .mypy_cache && poetry run python -m mypy ormar tests --ignore-missing-imports --install-types --non-interactive

lint:
black ormar tests
flake8 ormar
poetry run python -m ruff . --fix

fmt:
poetry run python -m black .

mypy:
mypy ormar tests
pre-commit: fmt lint type_check
Loading

0 comments on commit 7e4fd44

Please sign in to comment.