-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* hashes of downloaded models added * fix bugs in diplomas * change features for diploma classifier * Remove unused API parameters * Move all remaining readers from docreader (#273) * TLDR-340 renamed pdf folder; some refactoring (#275) * Taining scripts transition (#274) * TLDR-350 pypi pipeline fix (#277) * TLDR-322 fix ispras_tbl_extr.jar (#279) * moved benchmarks from docreader (#280) * TLDR-336 dedoc api documentation (#281) * TLDR-372 docx bug for documents with comments (#282) * TLDR-359 push to dockerhub automatically (#283) * new version 0.9 (#284)
- Loading branch information
1 parent
3603e75
commit 5237390
Showing
385 changed files
with
34,113 additions
and
717 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,58 @@ | ||
import argparse | ||
import re | ||
from typing import Pattern | ||
|
||
|
||
def is_correct_version(version: str, tag: str, old_version: str, regexp: Pattern) -> bool: | ||
match = regexp.match(version) | ||
|
||
if match is None: | ||
print("New version doesn't match the pattern") # noqa | ||
return False | ||
|
||
if not (tag.startswith("v") and tag[1:] == version): | ||
print("Tag value should be equal to version with `v` in the beginning") # noqa | ||
return False | ||
|
||
return old_version < version | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--branch", help="Git branch to check its version", choices=["develop", "master"]) | ||
parser.add_argument("--tag", help="Tag of the release", type=str) | ||
parser.add_argument("--pre_release", help="Tag of the release", choices=["true", "false"]) | ||
parser.add_argument("--new_version", help="New release version", type=str) | ||
parser.add_argument("--old_version", help="Previous release version", type=str) | ||
args = parser.parse_args() | ||
|
||
print(f"Old version: {args.old_version}, new version: {args.new_version}, " | ||
f"branch: {args.branch}, tag: {args.tag}, pre_release: {args.pre_release}") # noqa | ||
|
||
master_version_pattern = re.compile(r"^\d+\.\d+(\.\d+)?$") | ||
develop_version_pattern = re.compile(r"^\d+\.\d+\.\d+rc\d+$") | ||
|
||
correct = False | ||
if args.branch == "develop": | ||
correct = is_correct_version(args.new_version, args.tag, args.old_version, develop_version_pattern) | ||
|
||
if correct and master_version_pattern.match(args.old_version) and args.new_version.split("rc")[0] <= args.old_version: | ||
correct = False | ||
print("New version should add 'rc' to the bigger version than the old one") # noqa | ||
elif correct and int(args.new_version.split("rc")[1]) == 0: | ||
correct = False | ||
print("Numeration for 'rc' should start from 1") # noqa | ||
|
||
if args.pre_release == "false": | ||
correct = False | ||
print("Only pre-releases allowed on develop") # noqa | ||
|
||
if args.branch == "master": | ||
correct = is_correct_version(args.new_version, args.tag, args.old_version, master_version_pattern) | ||
|
||
if args.pre_release == "true": | ||
correct = False | ||
print("Pre-releases are not allowed on master") # noqa | ||
|
||
assert correct | ||
print("Version is correct") # noqa |
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,35 +1,48 @@ | ||
name: Publish to PyPI | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
- master | ||
paths: | ||
- VERSION # publish only when version has been changed | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
# Publish the package to PyPI https://pypi.org | ||
pypi-publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v1 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.9' | ||
|
||
# - name: Check version correctness | ||
# run: | | ||
# python3 .github/check_version.py --branch ${{ github.event.release.target_commitish }} --tag $GITHUB_REF_NAME \ | ||
# --new_version $(< VERSION) --old_version $(git cat-file -p $(git rev-parse "$GITHUB_SHA"^1):VERSION) \ | ||
# --pre_release ${{ github.event.release.prerelease }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
pip3 install build twine | ||
- name: Build and publish to PyPI # TODO change to pypi instead of test pypi | ||
- name: Build and publish to PyPI | ||
if: ${{ success() }} # publish only when version passed the checks | ||
env: | ||
TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }} # TODO delete TEST_ in the name of the variable | ||
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }} # TODO delete TEST_ in the name of the variable | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
python3 -m build -w | ||
twine check dist/* | ||
twine upload --repository testpypi dist/* | ||
twine upload --repository pypi dist/* | ||
- name: Push to dockerhub | ||
if: ${{ success() }} | ||
run: | | ||
docker build -f docker/Dockerfile -t dedocproject/dedoc:$GITHUB_REF_NAME . | ||
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }} | ||
docker tag dedocproject/dedoc:$GITHUB_REF_NAME dedocproject/dedoc:latest | ||
docker push dedocproject/dedoc:$GITHUB_REF_NAME | ||
docker push dedocproject/dedoc:latest |
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,3 +1,3 @@ | ||
include dedoc/api/static/*/* | ||
include dedoc/readers/scanned_reader/pdftxtlayer_reader/tabbypdf/jars/* | ||
include dedoc/readers/pdf_reader/pdf_txtlayer_reader/tabbypdf/jars/* | ||
include docs/* |
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 +1 @@ | ||
2023.05.26 | ||
0.9 |
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
Oops, something went wrong.