Skip to content

Commit

Permalink
Merge branch 'dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickboateng authored Nov 26, 2023
2 parents e560f43 + 7c82498 commit aed2d85
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 45 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/pkg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This workflow will install Python dependencies, run tests and lint with three versions of Python
# and three operating systems.
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python application

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

permissions:
contents: read

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest pytest-cov setuptools wheel
- name: Build Package
run: |
python setup.py sdist bdist_wheel
- name: Install Built Package
run: |
pip install .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
python -m pytest --cov=makepackage --cov-report=html tests/
# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v3
39 changes: 0 additions & 39 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,3 @@
from setuptools import setup

setup()

# import setuptools
# from pathlib import Path

# ROOT = Path(__file__).resolve().parent


# with open(ROOT / "README.md", "r") as fh:
# long_description = fh.read()

# extras_requirements = {
# "dev": ["wheel", "black", "pytest", "mypy", ],
# }

# setuptools.setup(
# name="makepackage",
# version="0.1.9",
# author="Nyggus",
# author_email="nyggus@gmail.com",
# description="Creating a structure of a simple Python package",
# long_description=long_description,
# long_description_content_type="text/markdown",
# license="MIT",
# url="https://github.com/nyggus/makepackage",
# packages=setuptools.find_packages(),
# classifiers=[
# "Programming Language :: Python :: 3",
# "License :: OSI Approved :: MIT License",
# "Operating System :: OS Independent",
# ],
# install_requires=[
# "easycheck",
# ],
# python_requires=">=3.6",
# extras_require=extras_requirements,
# entry_points={
# "console_scripts": ["makepackage = makepackage.__main__:main"]
# },
# )
26 changes: 20 additions & 6 deletions tests/test_makepackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import platform
import subprocess
from pathlib import Path
from typing import Tuple

cmd_command = tuple[str, Path]


def select_venv_cmd():
if platform.system() == "Windows":
return r".\.venv\Scripts\activate"
Expand All @@ -15,12 +15,26 @@ def select_venv_cmd():


def run_cmds(cmds: list[cmd_command]):
if platform.system() == "Windows":
executable = None
else:
executable = "/bin/bash"

for cmd, path in cmds:
if platform.system() == "Windows":
subprocess.run(cmd, shell=True, cwd=path, check=True)
else:
subprocess.run(
cmd, executable="/bin/bash", shell=True, cwd=path, check=True
process = subprocess.Popen(
args=cmd,
shell=True,
executable=executable,
cwd=path,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)

_, stderr = process.communicate()

if process.returncode != 0:
raise RuntimeError(
f"Command failed with error code {process.returncode}: {stderr.decode()}"
)


Expand Down

0 comments on commit aed2d85

Please sign in to comment.