Skip to content

Commit

Permalink
#1:Added initial setup files (#2)
Browse files Browse the repository at this point in the history
* Added initial setup files

* Updated reviews
  • Loading branch information
umitbuyuksahin authored Feb 24, 2022
1 parent 653ed6d commit fea50ab
Show file tree
Hide file tree
Showing 24 changed files with 680 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/check_setup_py.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Check if setup.py is up to date

on: [push, pull_request]

jobs:
check_setup_py:
strategy:
fail-fast: false
matrix:
python-version: [3.8]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: abatilo/[email protected]
with:
poetry-version: 1.1.4
- name: Poetry install
run: poetry install
- name: Run packaging update
run: bash githooks/update_setup_py.sh
- name: Show changes on working copy
run: git status --porcelain=v1 -uno
- name: Show diff on working copy
run: git diff --cached; cat setup.py
- name: Check if setup.py changed
run: |
[ -z "$(git status --porcelain=v1 -uno 2>/dev/null)" ]
- name: Check if setup.py works
run: pip install .
26 changes: 26 additions & 0 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Run pytest tests

on: [ push, pull_request ]

jobs:
integration_tests:
strategy:
fail-fast: false
matrix:
python-version: [3.8]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: abatilo/[email protected]
with:
poetry-version: 1.1.4
- name: Poetry install
run: poetry install
- name: Poetry build
run: poetry build
- name: Poetry run pytest integration tests
run: poetry run pytest tests
31 changes: 31 additions & 0 deletions .github/workflows/release_droid_upload_github_release_assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release Droid - Upload GitHub Release Assets

on:
workflow_dispatch:
inputs:
upload_url:
description: 'Upload URL'
required: true


jobs:
release:
strategy:
matrix:
python-version: [ 3.8 ]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: abatilo/[email protected]
with:
poetry-version: 1.1.6
- name: Install Poetry
run: poetry install
- name: Build Poetry
run: poetry build
- name: Poetry run pytest integration tests
run: poetry run pytest tests
135 changes: 135 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# PyCharm
.idea

# Sphinx
doc/_build
Empty file added README.md
Empty file.
3 changes: 3 additions & 0 deletions doc/changes/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changelog

* [0.1.0](changes_0.1.0.md)
7 changes: 7 additions & 0 deletions doc/changes/changes_0.1.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# advanced-analytics-framework 0.1.0, released XXXX-XX-XX


## Summary


### Features
20 changes: 20 additions & 0 deletions doc/dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies

## Run Time Dependencies

| Dependency | Purpose | License |
|-------------------------------|----------------------------------|--------------------|
| [Python 3][python] | Python version 3.6.1 and above | PSF |


## Test Dependencies

| Dependency | Purpose | License |
|-------------------------------|-----------------------------------|-------------------|
| [Pytest][pytest] | Testing framework | MIT |



[python]: https://docs.python.org

[pytest]: https://docs.pytest.org/en/stable/
Empty file added doc/design.md
Empty file.
Empty file.
7 changes: 7 additions & 0 deletions doc/developer_guide/developer_guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Developer Guide


In this developer guide we explain how you can build this project.

* [building_documentation](building_documentation.md)

Empty file added doc/system_requirements.md
Empty file.
Empty file added doc/user_guide/user_guide.md
Empty file.
1 change: 1 addition & 0 deletions exasol_advanced_analytics_framework/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.1.0'
44 changes: 44 additions & 0 deletions githooks/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail

SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
REPO_DIR=$(git rev-parse --show-toplevel)
REPO_DIR="$(readlink -f "${REPO_DIR}")"
GIT_DIR="$REPO_DIR/.git"
GIT_DIR="$(readlink -f "${GIT_DIR}")"

if [[ ! -d "$GIT_DIR" ]]; then
echo "$GIT_DIR is not a git directory." >&2
exit 1
else
GITHOOKS_PATH="$GIT_DIR/hooks"
fi

GITHOOKS_PATH="$(readlink -f "${GITHOOKS_PATH}")"

copy_hook() {
local SCRIPT_PATH="$SCRIPT_DIR/$1"
local GITHOOK_PATH="$GITHOOKS_PATH/$2"
local RELATIVE_PATH=$(realpath --relative-to="$GITHOOKS_PATH" "$SCRIPT_PATH")
pushd "$GITHOOKS_PATH" > /dev/null
if [ -e "$GITHOOK_PATH" ] || [ -L "$GITHOOK_PATH" ]
then
echo
echo "Going to delete old hook $GITHOOK_PATH"
rm "$GITHOOK_PATH" > /dev/null
fi
echo
echo "Link hook to script" >&2
echo "Hook-Path: $GITHOOK_PATH" >&2
echo "Script-path: $SCRIPT_PATH" >&2
echo
ln -s "$RELATIVE_PATH" "$2" > /dev/null
chmod +x "$SCRIPT_PATH" > /dev/null
popd > /dev/null
}

copy_hook pre-commit pre-commit
copy_hook pre-commit post-rewrite
copy_hook pre-push pre-push
11 changes: 11 additions & 0 deletions githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail

REPO_DIR=$(git rev-parse --show-toplevel)
GITHOOKS_PATH="$REPO_DIR/githooks"
pushd "$REPO_DIR"
bash "$GITHOOKS_PATH/prohibit_commit_to_main.sh"
bash "$GITHOOKS_PATH/update_setup_py.sh"
popd
43 changes: 43 additions & 0 deletions githooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
protected_branches=( master main )
for i in "${protected_branches[@]}"
do

protected_branch=$i

policy='[Policy] Never push, force push or delete the '$protected_branch' branch! (Prevented with pre-push hook.)'

current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')

push_command=$(ps -ocommand= -p $PPID)

is_destructive='force|delete|\-f'

will_remove_protected_branch=':'$protected_branch

do_exit(){
echo $policy
exit 1
}

if [[ $push_command =~ $is_destructive ]] && [ $current_branch = $protected_branch ]; then
do_exit
fi

if [[ $push_command =~ $is_destructive ]] && [[ $push_command =~ $protected_branch ]]; then
do_exit
fi

if [[ $push_command =~ $will_remove_protected_branch ]]; then
do_exit
fi

if [[ $protected_branch == $current_branch ]]; then
do_exit
fi

done

unset do_exit

exit 0
8 changes: 8 additions & 0 deletions githooks/prohibit_commit_to_main.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

branch="$(git rev-parse --abbrev-ref HEAD)"

if [ "$branch" = "main" ] || [ "$branch" = "master" ]; then
echo "You can't commit directly to main/master branch"
exit 1
fi
Loading

0 comments on commit fea50ab

Please sign in to comment.