Skip to content

Commit

Permalink
PR for Issue #120 (#121)
Browse files Browse the repository at this point in the history
* Issue #120: refactoring code

* Issue #120: added github actions

* Issue #120: improved .gitignore and README.md
  • Loading branch information
fedelemantuano authored Oct 23, 2024
1 parent 6e6a30c commit 145096d
Show file tree
Hide file tree
Showing 23 changed files with 207 additions and 389 deletions.
3 changes: 0 additions & 3 deletions .bettercodehub.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .coveragerc

This file was deleted.

60 changes: 60 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Python application

on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
sudo apt-get -qq update
sudo apt-get install -y libemail-outlook-message-perl
pip install ".[dev, test]"
export PERL_MM_USE_DEFAULT=1
sudo cpan -f -i Email::Outlook::Message
- name: Run tests
run: |
pytest
python -m mailparser -v
python -m mailparser -h
mail-parser -f tests/mails/mail_malformed_3 -j
cat tests/mails/mail_malformed_3 | mail-parser -k -j
- name: Report to Coveralls
if: matrix.python-version == '3.10'
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build
if: matrix.python-version == '3.10'
run: |
python -m build
- name: Upload artifacts
if: matrix.python-version == '3.10'
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
dist/mail-parser-*.tar.gz
dist/mail_parser-*.whl
37 changes: 22 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
!.gitkeep
.*.swp
.coverage
.env
.ropeproject
.tox/
.vscode
# python_template defaults
/env/
/build/
/dist/
*.egg-info
*.pyc
build/
dist/
mail_parser.egg-info/
venv
venv27
venv3
venv-mailparser
report/
/pip-wheel-metadata/
.pytest_cache/
coverage.xml
coverage.json
.coverage
htmlcov/
.mypy_cache/
.eggs/
.*.tgt
.idea/
.vscode/
junit.xml
/venv/
/__pycache__/
/*.egg-info/
.DS_Store
VERSION
73 changes: 0 additions & 73 deletions .travis.yml

This file was deleted.

64 changes: 20 additions & 44 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,54 +29,30 @@ BROWSER := python -c "$$BROWSER_PYSCRIPT"
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
clean-build: ## remove all build files
find . -type d -name "build" -exec rm -rf {} +
find . -type d -name "dist" -exec rm -rf {} +

clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
clean-tests: ## remove test and coverage artifacts
find . -type f -name "*.log" -delete
find . -type f -name "coverage.xml" -delete
find . -type f -name "junit.xml" -delete
find . -type f -name ".coverage" -delete
find . -type d -name ".pytest_cache" -exec rm -rf {} +
find . -type d -name "htmlcov" -exec rm -rf {} +
find . -type d -name ".mypy_cache" -exec rm -rf {} +
find . -type d -name "__pycache__" -exec rm -rf {} +

clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
clean-all: clean-tests clean-build ## remove all tests and build files

clean-test: ## remove test and coverage artifacts
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/
rm -fr .pytest_cache
test: clean-tests ## run tests quickly with the default Python
pytest

lint: ## check style with flake8
flake8 mailparser tests
pre-commit: ## run pre-commit on all files
pre-commit run -a

test: ## run tests quickly with the default Python
python -m unittest discover -s tests -f -v

test-all: ## run tests on every Python version with tox
tox

# docs: ## generate Sphinx HTML documentation, including API docs
# rm -f docs/mailparser.rst
# rm -f docs/modules.rst
# sphinx-apidoc -o docs/ mailparser
# $(MAKE) -C docs clean
# $(MAKE) -C docs html
# $(BROWSER) docs/_build/html/index.html

# servedocs: docs ## compile the docs watching for changes
# watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .
dist: clean-all ## builds source and wheel package
python -m build

release: dist ## package and upload a release
twine upload dist/*

dist: clean ## builds source and wheel package
python setup.py sdist
python setup.py bdist_wheel
ls -l dist

install: clean ## install the package to the active Python's site-packages
python setup.py install
twine upload dist/*
16 changes: 0 additions & 16 deletions Pipfile

This file was deleted.

Loading

0 comments on commit 145096d

Please sign in to comment.