From 1dde18250e2aadd1865bc17cc77c34010467be74 Mon Sep 17 00:00:00 2001 From: Oleksii Proshchenko <80070761+MasterpieceElbow@users.noreply.github.com> Date: Tue, 4 Jan 2022 16:31:41 +0200 Subject: [PATCH] Initial commit --- .flake8 | 5 +++++ .github/workflows/test.yml | 30 ++++++++++++++++++++++++++++++ .gitignore | 7 +++++++ README.md | 1 + app/main.py | 3 +++ requirements.txt | 2 ++ tests/__init__.py | 0 tests/test_main.py | 6 ++++++ 8 files changed, 54 insertions(+) create mode 100644 .flake8 create mode 100644 .github/workflows/test.yml create mode 100644 .gitignore create mode 100644 README.md create mode 100644 app/main.py create mode 100644 requirements.txt create mode 100644 tests/__init__.py create mode 100644 tests/test_main.py diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..794c2d3f --- /dev/null +++ b/.flake8 @@ -0,0 +1,5 @@ +[flake8] +ignore = E203, E266 +max-line-length = 79 +max-complexity = 18 +select = B,C,E,F,W,T4,B9 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..245d0ed7 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,30 @@ +name: Test + +on: + pull_request: + branches: + - "master" + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Set Up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install pytest and flake8 + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Run flake8 + run: flake8 app/ + - name: Run tests + run: pytest tests/ + diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..ac24bc42 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.idea/ +.vscode/ +*.iml +.env +.DS_Store +venv/ +.pytest_cache/ diff --git a/README.md b/README.md new file mode 100644 index 00000000..72e3fdea --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Python boilerplate for GitHub tasks \ No newline at end of file diff --git a/app/main.py b/app/main.py new file mode 100644 index 00000000..773a588b --- /dev/null +++ b/app/main.py @@ -0,0 +1,3 @@ +# TODO: add initial code +def hello_world(): + return "Hello, world!" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..7c8a737c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +pytest==6.2.5 +flake8==4.0.1 \ No newline at end of file diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/test_main.py b/tests/test_main.py new file mode 100644 index 00000000..6d8b3235 --- /dev/null +++ b/tests/test_main.py @@ -0,0 +1,6 @@ +# TODO: add tests +from app.main import hello_world + + +def test_hello_world(): + assert hello_world() == "Hello, world!"