-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bankstatementparser): 🎉 Initial commit for bankstatementparser
A Python library built for Finance and Treasury Professionals
- Loading branch information
0 parents
commit 1af58c7
Showing
27 changed files
with
3,694 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
exclude_dirs: | ||
- .git | ||
- .tox | ||
- "tests/*" | ||
- build | ||
- dist | ||
|
||
skips: | ||
- B101 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
name: ❯ Python bankstatementparser | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
- "feat/*" | ||
push: | ||
branches: | ||
- main | ||
- "feat/*" | ||
|
||
jobs: | ||
# This job reads the version number from setup.cfg and sets it as an | ||
# environment variable | ||
version: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.set-version.outputs.version }} | ||
steps: | ||
- name: ❯ Set up Python 🐍 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.9" | ||
- name: ❯ Get version number from setup.cfg | ||
id: set-version | ||
run: | | ||
echo "::set-output name=version::$(python -c 'import configparser; cfg = configparser.ConfigParser(); cfg.read("setup.cfg"); print(cfg.get("metadata", "version"))')" | ||
# This job runs unit tests using pytest | ||
pytest: | ||
needs: version | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Check out the repository code | ||
- uses: actions/checkout@v3 | ||
|
||
# Set up Python and install dependencies | ||
- name: ❯ Set up Python and install dependencies 🐍📦 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.9" | ||
- name: ❯ Install dependencies 📦 | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install -r requirements.txt | ||
python -m pip install pytest pytest-cov | ||
# Run pytest | ||
- name: ❯ Run pytest 🧪 | ||
run: pytest --cov=bankstatementparser --cov-report=xml | ||
|
||
# Upload code coverage report to Codecov | ||
- name: ❯ Upload code coverage report to Codecov 📊 | ||
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
# This job runs flake8 to check for code style issues | ||
lint: | ||
needs: version | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Check out the repository code | ||
- uses: actions/checkout@v3 | ||
# Set up Python and install dependencies | ||
- name: ❯ Set up Python and install dependencies 🐍📦 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.9" | ||
- name: ❯ Install flake8 📦 | ||
run: python -m pip install flake8 | ||
# Run flake8 | ||
- name: ❯ Run flake8 🔍 | ||
run: flake8 | ||
|
||
# This job builds the distribution packages, and publishes them | ||
# to PyPI | ||
build: | ||
needs: [version, pytest] | ||
runs-on: ubuntu-latest | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | ||
VERSION: ${{ needs.version.outputs.version }} | ||
PKG_NAME: bankstatementparser | ||
steps: | ||
# Check out the repository code | ||
- uses: actions/checkout@v3 | ||
- name: ❯ Set up Python 🐍 | ||
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
id: python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.9" | ||
|
||
# Install dependencies | ||
- name: ❯ Install dependencies 📦 | ||
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel | ||
python -m pip install -r requirements.txt | ||
# Update the version number based on the setup.cfg file | ||
- name: Update version number from setup.cfg file 📝 | ||
id: update-version | ||
run: | | ||
NEW_VERSION=$(grep -E '^version =' setup.cfg | cut -d '=' -f 2 | tr -d '[:space:]') | ||
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV | ||
shell: /bin/bash -e {0} | ||
|
||
# Generate the changelog based on git log and template file | ||
- name: Generate Changelog 📚 | ||
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
run: | | ||
# Append version information to CHANGELOG.md | ||
echo "## Release v${{ env.VERSION }} - $(date +'%Y-%m-%d')" >> ${{ github.workspace }}/CHANGELOG.md | ||
# Copy content of template file to CHANGELOG.md | ||
cat TEMPLATE.md >> ${{ github.workspace }}/CHANGELOG.md | ||
# Append git log to CHANGELOG.md | ||
echo "$(git log --pretty=format:'%s' --reverse $(git describe --tags --abbrev=0)..HEAD)" >> ${{ github.workspace }}/CHANGELOG.md | ||
# Append empty line to CHANGELOG.md | ||
echo "" >> ${{ github.workspace }}/CHANGELOG.md | ||
# Build distribution packages | ||
- name: ❯ Build distribution packages 🧰 | ||
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
# Publish distribution packages to PyPI | ||
- name: ❯ Publish distribution packages to PyPI 🚀 | ||
id: publish | ||
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
uses: pypa/[email protected] | ||
with: | ||
user: ${{ env.TWINE_USERNAME }} | ||
password: ${{ env.TWINE_PASSWORD }} | ||
packages_dir: dist | ||
verify_metadata: true | ||
skip_existing: true | ||
|
||
# Append artifact links to the changelog | ||
- name: Append Artifact Links 🔗 | ||
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
run: | | ||
echo "" >> ${{ github.workspace }}/CHANGELOG.md | ||
echo "## Artifacts 🎁" >> ${{ github.workspace }}/CHANGELOG.md | ||
for filename in dist/*; do | ||
link="$(basename $filename)" | ||
echo "* [$link](${{ env.RELEASES_URL }}/$link)" >> ${{ github.workspace }}/CHANGELOG.md | ||
done | ||
env: | ||
RELEASES_URL: https://github.com/${{ github.repository }}/releases/download/v${{ env.VERSION }} | ||
|
||
# Create a release | ||
- name: Create Release 🚀 | ||
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: v${{ env.VERSION }} | ||
release_name: Release v${{ env.VERSION }} | ||
body_path: ${{ github.workspace }}/CHANGELOG.md | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload Release Assets 📦 | ||
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
upload_url=${{ steps.create_release.outputs.upload_url }} | ||
for file in dist/*; do | ||
curl \ | ||
-H "Authorization: token ${GITHUB_TOKEN}" \ | ||
-H "Content-Type: $(file --mime-type -b $file)" \ | ||
--data-binary @$file \ | ||
"${upload_url}?name=$(basename $file)" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
dist/ | ||
*.egg | ||
*.egg-info/ | ||
.eggs/ | ||
develop-eggs/ | ||
downloads/ | ||
eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
.installed.cfg | ||
|
||
# Environment & virtualenv | ||
env/ | ||
.venv/ | ||
venv/ | ||
ENV/ | ||
bandit-env | ||
myenv | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Test & coverage | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
.hypothesis/ | ||
|
||
# Documentation | ||
docs/_build/ | ||
|
||
# IDEs & Editors | ||
.idea/ | ||
.vscode/ | ||
.spyderproject | ||
.ropeproject | ||
.pytype/ | ||
|
||
# Frameworks & Libraries | ||
local_settings.py # Django | ||
instance/ # Flask | ||
.webassets-cache # Flask | ||
.scrapy # Scrapy | ||
|
||
# Various tools & scripts | ||
*.manifest # PyInstaller | ||
*.spec # PyInstaller | ||
celerybeat-schedule | ||
*.sage.py # SageMath | ||
.env # dotenv | ||
.venv # virtualenv | ||
|
||
# Miscellaneous | ||
.DS_Store # macOS | ||
*.log | ||
*.mo # Translations | ||
*.pot # Translations | ||
*.db-shm # Database | ||
*.db-wal # Database | ||
.DS_Store |
Oops, something went wrong.