From a72478d33d744111096124bd29b93c88f5675065 Mon Sep 17 00:00:00 2001 From: Igor Nehoroshev Date: Tue, 3 Nov 2020 19:22:09 +0200 Subject: [PATCH 1/3] Fix inconsistencies in documentation - Use max_length instead of length for String field - Use same annotations in README.md and index.md as in docs_src --- README.md | 12 ++++++------ docs/index.md | 12 ++++++------ docs_src/models/docs005.py | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 6ce8908..2e0ee2d 100644 --- a/README.md +++ b/README.md @@ -79,8 +79,8 @@ class Album(ormar.Model): # note that type hints are optional so # id = ormar.Integer(primary_key=True) # is also valid - id = ormar.Integer(primary_key=True) - name = ormar.String(length=100) + id: int = ormar.Integer(primary_key=True) + name: str = ormar.String(max_length=100) class Track(ormar.Model): @@ -89,10 +89,10 @@ class Track(ormar.Model): metadata = metadata database = database - id = ormar.Integer(primary_key=True) - album = ormar.ForeignKey(Album) - title = ormar.String(length=100) - position = ormar.Integer() + id: int = ormar.Integer(primary_key=True) + album: Optional[Album] = ormar.ForeignKey(Album) + title: str = ormar.String(max_length=100) + position: int = ormar.Integer() # Create some records to work with. diff --git a/docs/index.md b/docs/index.md index 6ce8908..2e0ee2d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -79,8 +79,8 @@ class Album(ormar.Model): # note that type hints are optional so # id = ormar.Integer(primary_key=True) # is also valid - id = ormar.Integer(primary_key=True) - name = ormar.String(length=100) + id: int = ormar.Integer(primary_key=True) + name: str = ormar.String(max_length=100) class Track(ormar.Model): @@ -89,10 +89,10 @@ class Track(ormar.Model): metadata = metadata database = database - id = ormar.Integer(primary_key=True) - album = ormar.ForeignKey(Album) - title = ormar.String(length=100) - position = ormar.Integer() + id: int = ormar.Integer(primary_key=True) + album: Optional[Album] = ormar.ForeignKey(Album) + title: str = ormar.String(max_length=100) + position: int = ormar.Integer() # Create some records to work with. diff --git a/docs_src/models/docs005.py b/docs_src/models/docs005.py index cd0fa9d..5359606 100644 --- a/docs_src/models/docs005.py +++ b/docs_src/models/docs005.py @@ -50,7 +50,7 @@ Will produce: 'name': mappingproxy({'allow_blank': False, 'autoincrement': False, 'choices': set(), - 'column_type': String(length=100), + 'column_type': String(max_length=100), 'curtail_length': None, 'default': None, 'index': False, From 29e95664d64322032cb350925d66bf5b5010f4d6 Mon Sep 17 00:00:00 2001 From: collerek Date: Wed, 4 Nov 2020 11:50:55 +0700 Subject: [PATCH 2/3] Create main.yml Publish docs on push or merge GitHub action --- .github/workflows/main.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..4219407 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,26 @@ +name: Build Documentation using MkDocs +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [master] + pull_request: + branches: [master] +jobs: + build: + name: Build and Deploy Documentation + runs-on: ubuntu-latest + steps: + - name: Checkout Master + uses: actions/checkout@v2 + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install mkdocs-material + - name: Deploy + run: | + git pull mkdocs gh-deploy From bbce2a69593b6ec8362eed44a1fb1c2a0eb355b6 Mon Sep 17 00:00:00 2001 From: collerek Date: Wed, 4 Nov 2020 12:00:27 +0700 Subject: [PATCH 3/3] Update and rename main.yml to deploy-docs.yml Fix actions --- .github/workflows/{main.yml => deploy-docs.yml} | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) rename .github/workflows/{main.yml => deploy-docs.yml} (93%) diff --git a/.github/workflows/main.yml b/.github/workflows/deploy-docs.yml similarity index 93% rename from .github/workflows/main.yml rename to .github/workflows/deploy-docs.yml index 4219407..d788acd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/deploy-docs.yml @@ -23,4 +23,5 @@ jobs: pip install mkdocs-material - name: Deploy run: | - git pull mkdocs gh-deploy + git pull + mkdocs gh-deploy