Skip to content

Commit

Permalink
Merge 904cf66 into 54cbd3a
Browse files Browse the repository at this point in the history
  • Loading branch information
MauroEBordon committed Oct 20, 2022
2 parents 54cbd3a + 904cf66 commit 1ebfb4f
Show file tree
Hide file tree
Showing 5 changed files with 199 additions and 3 deletions.
136 changes: 136 additions & 0 deletions .github/workflows/dev.workflow.yml
Original file line number Diff line number Diff line change
@@ -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
56 changes: 56 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
}

Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion soam/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Version."""

__version__ = '0.10.1'
__version__ = '0.10.2'

0 comments on commit 1ebfb4f

Please sign in to comment.