Skip to content

Commit

Permalink
[OND211-2039] Release Automation
Browse files Browse the repository at this point in the history
  • Loading branch information
ahasanovicc committed Aug 3, 2022
2 parents 1c78b90 + d975885 commit a168b2b
Show file tree
Hide file tree
Showing 24 changed files with 752 additions and 623 deletions.
9 changes: 0 additions & 9 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,3 @@
[submodule "ondewo-proto-compiler"]
path = ondewo-proto-compiler
url = https://github.com/ondewo/ondewo-proto-compiler.git
[submodule "ondewo-nlu-api"]
path = ondewo-nlu-api
url = https://github.com/ondewo/ondewo-nlu-api.git
[submodule "ondewo-t2s-api"]
path = ondewo-t2s-api
url = https://github.com/ondewo/ondewo-t2s-api.git
[submodule "ondewo-s2t-api"]
path = ondewo-s2t-api
url = https://github.com/ondewo/ondewo-s2t-api.git
2 changes: 0 additions & 2 deletions .isort.cfg

This file was deleted.

140 changes: 70 additions & 70 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,79 +1,79 @@
#############################################################################################
# pre-commit is a "framework for managing and maintaining multi-language pre-commit hooks" #
# see https://pre-commit.com/#intro for an introduction to pre-commit #
# #
# - pre-commit hooks are run on staged files just before a commit or a push #
# - to run a given hook on any file at any time, run the following on the command line: #
# pre-commit run <HOOK_ID> --files <FILE1> <FILE2> ..., e.g., #
# pre-commit run autopep8 --files mal_formatted_file.py #
#############################################################################################
exclude: '^$'
# "exclude: '^$'" specifies the global file exclude pattern; '^$' excludes

fail_fast: false
# "fail_fast: false" means pre-commit continues to run hooks after the first failure

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: no-commit-to-branch
args: [--branch, master, --branch, develop]
- id: trailing-whitespace
- id: check-added-large-files
args: [maxkb=512]
- id: check-ast
- id: check-json
- id: pretty-format-json
args: [--autofix]
- id: check-xml
- id: check-yaml
- id: check-symlinks
- id: check-merge-conflict
- id: detect-private-key
- id: check-executables-have-shebangs
- id: name-tests-test
# args: ['--django'] # uncomment to change tests to 'test_*.py' rather '*_test.py'
- id: requirements-txt-fixer # Sorts the requirement.txt files' content
files: 'requirements/requirements.*\.txt$'
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.971
hooks:
- id: mypy # Run mypy type checker; note: runs with flag --missing-imports
exclude: ondewo
args: [ --config-file=mypy.ini ]
# Use language: system to run Mypy git repo's existing virtual environment
# instead of mypy's own virtual environment. Necessary to find types-.* packages
# Replace language: python in your hook definition with language: system.
# Remove the additional_dependencies line and install Mypy into your
# environment directly. Now, Pre-commit will not create a separate virtualenv
# for the hook and will run it in whatever environment you happen to be in when
# you run git commit or pre-commit run => https://jaredkhan.com/blog/mypy-pre-commit
language: system
# use require_serial so that script
# is only called once per commit
require_serial: true
# Print the number of files as sanity-check
verbose: true
types: [ python ]

## consider using seed-isort-config
## (pip install seed-isort-config)
##
- repo: https://github.com/pre-commit/mirrors-isort
rev: 'v5.9.1'
hooks:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.6.0
hooks:
- id: autopep8 # Perform pep8 auto-formatting
args: [ --max-line-length=120, --in-place ]

- repo: https://github.com/asottile/seed-isort-config
rev: 'v2.2.0'
hooks:
- id: seed-isort-config
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-added-large-files # Prevent giant files from being committed
args: [ maxkb=1024 ]
- id: check-ast # Check whether files parse as valid python
- id: check-json # Attempt to load json files to verify syntax
- id: check-xml # Attempt to load xml files to verify syntax
- id: check-yaml # Attempt to load yaml files to verify syntax
- id: check-merge-conflict # Check for files that contain merge conflict strings
- id: check-symlinks # Check for broken symlinks
- id: debug-statements # Check for debugger imports and py37+ breakpoint() calls
- id: detect-private-key # Check for the existence of private keys
- id: check-executables-have-shebangs
- id: trailing-whitespace # Trim trailing whitespace.
- id: end-of-file-fixer # makes sure files end in a newline and only a newline
- id: pretty-format-json # autoformat json files (e.g. sorting keys)
args: [ --autofix, --indent=4 ]
- id: name-tests-test # name pytest files correctly
args: [ --pytest-test-first ]
- id: requirements-txt-fixer # Sorts the requirement.txt files' content
files: 'requirements/requirements.*\.txt$'

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.910'
hooks:
- id: mypy
- repo: https://gitlab.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
exclude: ondewo

## use either black *or* autopep8

- repo: https://github.com/ambv/black
rev: 21.6b0
hooks:
- id: black
args: ['--line-length=110'] # if this is different from the length you set flake8 to, you can get stuck in a refactor loop

# - repo: https://github.com/pre-commit/mirrors-autopep8
# rev: '' # Use the sha / tag you want to point at
# hooks:
# - id: autopep8

# - repo: https://github.com/Lucas-C/pre-commit-hooks-bandit
# sha: v1.0.3
# hooks:
# - id: python-bandit-vulnerability-check

- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
args: ['--config=.flake8']

- repo: https://github.com/milin/giticket
rev: v1.3
hooks:
- id: giticket # Prepend the commit message with the JIRA ticket
args: ['--regex=(?:feature|bugfix|support|hotfix)/(OND[0-9]{3}-[0-9]{1,5})[_-][\w-]+',
'--format=[{ticket}] {commit_msg}',
'--mode=regex_match']
- repo: https://github.com/milin/giticket
rev: d4a4c3b943892add7ee86d0d54a1e41c76b1fced
hooks:
- id: giticket # Prepend the commit message with the JIRA ticket
args: [ '--regex=(?:(?:feature|bugfix|support|hotfix)/)?(OND[0-9]{3}-[0-9]{1,5})[_-][\w-]+',
'--format=[{ticket}] {commit_msg}',
'--mode=regex_match' ]
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ accept your pull requests.
[Google Cloud Platform Samples Style Guide](https://cloud.google.com/community/tutorials/styleguide) for the
recommended coding standards for this organization.
1. Ensure that your code has an appropriate set of unit tests which all pass.
1. Submit a pull request.
1. Submit a pull request.
36 changes: 0 additions & 36 deletions Dockerfile.pypi

This file was deleted.

59 changes: 59 additions & 0 deletions Dockerfile.utils
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
FROM python:3.8-slim

ENV LANG=C.UTF-8
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Vienna

ENV PYPI_USERNAME=<PYPI_USERNAME>
ENV PYPI_PASSWORD=<PYPI_PASSWORD>
ENV GITHUB_GH_TOKEN=<GITHUB_GH_TOKEN>

RUN apt-get update -qq \
&& apt-get dist-upgrade -qq -y --no-install-recommends --fix-missing make tmux vim sed tree tk-dev curl sudo tzdata \
&& ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& apt-get clean \
&& apt-get purge -y --auto-remove \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN pip install --upgrade pip && pip install twine

RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install -y gh

WORKDIR /home/ondewo/

COPY Makefile .

COPY requirements.txt .

COPY setup.py .

COPY setup.cfg .

COPY README.md .

COPY RELEASE.md .

COPY .flake8 .

COPY .pre-commit-config.yaml .

COPY CONTRIBUTING.md .

COPY LICENSE .

COPY MANIFEST.in .

COPY mypy.ini .

COPY examples .

COPY ondewo ondewo

# run the container forever
CMD tail -f /dev/null
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include ondewo/*
include LICENSE
include requirements.txt
include setup.py
global-exclude *.pyc
Loading

0 comments on commit a168b2b

Please sign in to comment.