diff --git a/.github/workflows/dev.workflow.yml b/.github/workflows/dev.workflow.yml new file mode 100644 index 0000000..29a1082 --- /dev/null +++ b/.github/workflows/dev.workflow.yml @@ -0,0 +1,136 @@ +#act pull_request -j build-deploy + +name: Integration workflow - validation & testing + +run-name: ${{github.repository}} is getting updated by ${{github.actor}} + +on: + pull_request: + branches: + - main + - master + +env: + PIP_CACHE_DIR: ${{github.workspace}}/.cache/pip + PRE_COMMIT_HOME: ${{github.workspace}}/.cache/pre-commit + +jobs: + validate: + runs-on: ubuntu-latest + container: python:3.8.5 + #if: github.event_name == 'pull_request' + env: + TARGET_BRANCH: ${{ github.base_ref }} + HEAD_BRANCH: ${{ github.head_ref }} + steps: + - uses: actions/checkout@v3 + - name: New Version Check + run: | + pip install packaging + git fetch origin $HEAD_BRANCH + git fetch origin $TARGET_BRANCH + lib_ver=$(git diff origin/$HEAD_BRANCH origin/$TARGET_BRANCH -- soam/__init__.py | grep __version__ | cut -d = -f 2 | xargs) + python -c "import sys; from packaging import version; exit(not version.parse(sys.argv[1]) > version.parse(sys.argv[2]))" $lib_ver + + - name: Check changelog + run: | + git fetch origin $HEAD_BRANCH + git fetch origin $TARGET_BRANCH + added_lines=$(git diff --numstat origin/$TARGET_BRANCH origin/$HEAD_BRANCH -- CHANGELOG.md | awk '{print $1}') + if [ -z $added_lines ] || [ $added_lines -eq 0 ]; then echo "Changelog has not been modified" && exit 1; else echo "Changelog has been modified" && exit 0; fi; + + test_stage: + runs-on: ubuntu-latest + container: + image: python:3.8.5 + options: --user root + services: + postgres: + image: postgres + env: + POSTGRES_DB: soam_db + POSTGRES_USER: soam_usr + POSTGRES_PASSWORD: soam_pass + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: + - uses: actions/checkout@v3 + + - name: Installing sudo package + run: apt update && apt install sudo + + - name: Installing Nox + run: pip install -U nox + + - name: Tests + continue-on-error: true + env: + POSTGRES_HOST: localhost + POSTGRES_PORT: 5432 + # TEST_DB_CONNSTR: "postgresql://soam_usr:soam_pass@postgres:5432/soam_db" + run: | + sudo apt-get install -y libpoppler-cpp-dev libpoppler-dev poppler-utils + pip install pdftotext + nox --sessions tests + + - name: Lint + continue-on-error: true + run: | + pip install --upgrade pre-commit + nox --sessions lint + + - name: DocString Coverage + #continue-on-error: true + run: | + pip install interrogate + interrogate soam -c pyproject.toml -vv + + - name: Bandit + #continue-on-error: true + run: nox --sessions bandit + + - name: Pyreverse + run: | + apt-get -qq update + apt-get -qq install -y graphviz + nox --sessions pyreverse + + # version_stage: + # runs-on: ubuntu-latest + # container: python:3.8.5 + # steps: + + # script: + # - echo "TAG=v$(grep __version__ ./soam/__init__.py | cut -d "'" -f 2)" >> variables.env + # artifacts: + # reports: + # dotenv: variables.env + # before_script: + # - '' + # only: + # refs: + # - master + + release_stage: + name: Release Stage + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + body: | + Adding Github Workflows + draft: false + prerelease: false \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 66c2147..ea45254 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -60,3 +60,59 @@ repos: types: [file] files: 'README.md' require_serial: true + +# exclude: templates/.+|notebook/.+ +# repos: +# - repo: https://github.com/pre-commit/pre-commit-hooks.git +# rev: v4.3.0 +# hooks: +# - id: trailing-whitespace +# - id: requirements-txt-fixer +# - repo: https://github.com/timothycrosley/isort +# rev: 5.10.1 +# hooks: +# - id: isort +# name: isort +# entry: isort +# language: system +# types: [python] +# exclude: templates/.+|notebook/.+ +# - repo: https://github.com/psf/black +# rev: 22.10.0 +# hooks: +# - id: black +# name: black +# entry: black +# language: python +# types: [python] +# args: [--skip-string-normalization] +# exclude: templates/.+|notebook/.+ +# - repo: https://github.com/pre-commit/mirrors-mypy +# rev: v0.982 +# hooks: +# - id: mypy +# name: mypy +# entry: mypy +# language: system +# types: [python] +# files: \.py$ +# exclude: templates/.+|notebook/.+ +# - repo: https://github.com/pre-commit/mirrors-pylint +# rev: v3.0.0a5 +# hooks: +# - id: pylint +# name: pylint +# entry: pylint +# language: system +# exclude: templates/.+|notebook/.+ +# files: \.py$ +# types: [python] +# - repo: https://github.com/MuttData/gfm-diagram +# rev: v0.3.0 +# hooks: +# - id: gfmd +# name: gfmd +# entry: gfmd +# types: [file] +# files: 'README.md' +# require_serial: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d2d6a9..a63c241 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.10.2- 2022-10-18] +- Added Github Workflow + ## [0.10.1- 2022-02-14] ### Fixed diff --git a/setup.py b/setup.py index a45f8d2..8ab633c 100644 --- a/setup.py +++ b/setup.py @@ -43,9 +43,10 @@ 'slack': ["slackclient>=2.0.0"], 'orbit': ['orbit-ml==1.0.13'], 'prophet': ["pystan==2.19.1.1", "fbprophet==0.7.1", "holidays>=0.10.2"], - 'pdf_report': ["jupytext==1.10.2", "papermill==2.3.2", "nbconvert==5.6",], + 'pdf_report': ["jupytext==1.10.2", "papermill==2.3.2", "nbconvert==5.6","ipython_genutils"], 'gsheets_report': ["gspread_pandas", "muttlib[gsheets]>=1.0,<2"], 'statsmodels': ["statsmodels<0.12,>=0.11"], + 'protobuf': ["protobuf~=3.2"], 'mlflow': ["mlflow==1.17.0"], } @@ -84,7 +85,7 @@ tests_require=["pytest", "pytest-cov", "pytest-html", "betamax"], test_suite='test', install_requires=[ - "jinja2", + "Jinja2>=2.11.3,<3.1.0", "pandas>=1.0.0,<1.3.0", "Cython<0.29.18,>=0.29", "sqlalchemy<1.4.0,>=1.3.0", diff --git a/soam/__init__.py b/soam/__init__.py index e7ade49..85a9795 100644 --- a/soam/__init__.py +++ b/soam/__init__.py @@ -1,3 +1,3 @@ """Version.""" -__version__ = '0.10.1' +__version__ = '0.10.2'