Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.6]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: abatilo/actions-poetry@v2.0.0
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 .
34 changes: 34 additions & 0 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Run pytest tests

on: [ push, pull_request ]

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

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: 1.1.4
- name: Poetry install
run: poetry install
- name: Poetry build
run: poetry build

- name: Checkout test environment
run: git clone https://github.com/exasol/integration-test-docker-environment.git
working-directory: ..
- name: Spawn EXASOL environemnt
run: ./start-test-env spawn-test-environment --environment-name test --database-port-forward 8888 --bucketfs-port-forward 6666 --db-mem-size 4GB
working-directory: ../integration-test-docker-environment

- name: Poetry run pytest integration tests
run: poetry run pytest tests
138 changes: 138 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# 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/

# Poetry
poetry.lock

# PyCharm
.idea

# Sphinx
doc/_build
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Error Reporting Python

This project contains a python library for describing Exasol error messages.
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)
12 changes: 12 additions & 0 deletions doc/changes/changes_0.1.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# error-reporting-python 0.1.0

Code Name: Exasol python error code builder

## Summary

### Features

- #1: Added initial project setup



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.
4 changes: 4 additions & 0 deletions doc/user_guide/user_guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# User Guide


This user guide provides you with usage examples for this repository.
1 change: 1 addition & 0 deletions exasol_error_reporting_python/__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