From ae4e200765e8941842f2d7ccca72d736937c8326 Mon Sep 17 00:00:00 2001 From: viliambalaz Date: Sat, 13 Jun 2020 15:38:17 +0200 Subject: [PATCH 1/9] #280 Add main.yml --- .github/workflows/main.yml | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..42644f997 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,39 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python package + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [2.7.18] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - 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: | + pytest From 90173e3e824ef187c28eee7ce2005ca0a92894d1 Mon Sep 17 00:00:00 2001 From: viliambalaz Date: Thu, 25 Jun 2020 10:26:32 +0200 Subject: [PATCH 2/9] #280 Edit main.yml --- .github/workflows/main.yml | 41 +++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 42644f997..bca375023 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,10 +12,10 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 strategy: matrix: - python-version: [2.7.18] + python-version: [2.7.17, 2.7.18] steps: - uses: actions/checkout@v2 @@ -25,15 +25,32 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | + sudo apt-get update && sudo apt-get install virtualenv && sudo apt-get install gettext python -m pip install --upgrade pip - pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with flake8 + printf "%s\n" \ + "1" \ + "y" \ + "y" \ + "y" \ + "n" \ + "localhost:8000" \ + "" \ + "" \ + "" \ + "" \ + "obilgee@chcemvediet.sk"\ + "www-chcemvediet-sk" \ + "y" \ + "y" \ + "y" \ + "y" \ + "" \ + "admin" \ + "" \ + "" \ + "" \ + "" \ + | PYTHONUNBUFFERED=1 python setup.py + - name: Test 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: | - pytest + env/bin/python manage.py test From e5ecb9d283d41ebf3ad125a11c28d138c716b8fa Mon Sep 17 00:00:00 2001 From: viliambalaz Date: Thu, 25 Jun 2020 11:25:51 +0200 Subject: [PATCH 3/9] #280 Use raw_input instead getpass.getpass --- .github/workflows/main.yml | 4 ++-- setup.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bca375023..37516928b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,12 +39,12 @@ jobs: "" \ "" \ "obilgee@chcemvediet.sk"\ - "www-chcemvediet-sk" \ + "" \ + "" \ "y" \ "y" \ "y" \ "y" \ - "" \ "admin" \ "" \ "" \ diff --git a/setup.py b/setup.py index c62727e7e..f6773361a 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,6 @@ import string import random import json -import getpass import textwrap import unicodedata @@ -103,7 +102,7 @@ def input_password(self, key, prompt, hasher=None, required=False): configured = self.data.get(key, u'') prompt = u'\n{} [{}]: '.format(prompt, u'*****' if configured else u'') while True: - inputed = getpass.getpass(PROMPT + prompt + RESET) + inputed = raw_input(PROMPT + prompt + RESET) if required and not inputed and not configured: print(ERROR + u'\nError: The value is required.' + RESET) continue From 13d60a7280c47d7324d169f38cf5a1219d527bcf Mon Sep 17 00:00:00 2001 From: viliambalaz Date: Thu, 25 Jun 2020 12:35:32 +0200 Subject: [PATCH 4/9] #280 Install requirements for unittesting --- .github/workflows/main.yml | 2 +- setup.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 37516928b..2b6132273 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,7 +32,7 @@ jobs: "y" \ "y" \ "y" \ - "n" \ + "y" \ "localhost:8000" \ "" \ "" \ diff --git a/setup.py b/setup.py index f6773361a..bee31ae21 100644 --- a/setup.py +++ b/setup.py @@ -280,7 +280,10 @@ def install_requirements(configure): ], }[server_mode] requirements += { - u'Y': [u'-r', u'requirements/tests.txt'], + u'Y': [ + u'-r', u'requirements/tests.txt' + u'-r', u'poleno/dummymail/requirements.txt' + ], u'N': [], }[enable_unittests] call(u'Installing requirements for the selected server mode:', From 0d579d5aac6ca01aad5139bc4c1192e1429f90db Mon Sep 17 00:00:00 2001 From: viliambalaz Date: Thu, 25 Jun 2020 12:40:28 +0200 Subject: [PATCH 5/9] #280 Install requirements for unittesting --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index bee31ae21..a39415857 100644 --- a/setup.py +++ b/setup.py @@ -281,7 +281,7 @@ def install_requirements(configure): }[server_mode] requirements += { u'Y': [ - u'-r', u'requirements/tests.txt' + u'-r', u'requirements/tests.txt', u'-r', u'poleno/dummymail/requirements.txt' ], u'N': [], From 45486a08d6fefd973b8a5cb9de602a22ed334bba Mon Sep 17 00:00:00 2001 From: viliambalaz Date: Tue, 30 Jun 2020 18:46:54 +0200 Subject: [PATCH 6/9] #280 Add review suggestions --- .github/workflows/main.yml | 81 ++++++++++++++++++++++++-------------- setup.py | 8 ++-- 2 files changed, 54 insertions(+), 35 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2b6132273..77df986e6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,3 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - name: Python package on: @@ -15,7 +12,7 @@ jobs: runs-on: ubuntu-18.04 strategy: matrix: - python-version: [2.7.17, 2.7.18] + python-version: [2.7.18] steps: - uses: actions/checkout@v2 @@ -25,32 +22,56 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - sudo apt-get update && sudo apt-get install virtualenv && sudo apt-get install gettext - python -m pip install --upgrade pip - printf "%s\n" \ - "1" \ - "y" \ - "y" \ - "y" \ - "y" \ - "localhost:8000" \ - "" \ - "" \ - "" \ - "" \ - "obilgee@chcemvediet.sk"\ - "" \ - "" \ - "y" \ - "y" \ - "y" \ - "y" \ - "admin" \ - "" \ - "" \ - "" \ - "" \ - | PYTHONUNBUFFERED=1 python setup.py + sudo apt-get update && sudo apt-get install virtualenv gettext + - name: Run setup + run: | + CREDENTIALS=( + # Server mode: Local development mode with dummy email infrastructure. + "2" + # Mock libreoffice? + "y" + # Mock imagemagic? + "y" + # Mock abbyyocr11? + "y" + # Install requirements for unittesting? + "y" + # Server domain + "localhost:8000" + # Admin e-mail (default) + "" + # Support e-mail (default) + "" + # Inforequest unique e-mail (default) + "" + # Default from e-mail (default) + "" + # Obligee dummy e-mail + "obilgee@chcemvediet.sk" + # Unique cache key prefix (default) + "" + # Google Custom Search API key (default) + "" + # Load datasheets / Neighbourhood dummy was omitted / Delete it? + "y" + # Load datasheets / Municipality dummy was omitted / Delete it? + "y" + # Load datasheets / District dummy was omitted / Delete it? + "y" + # Load datasheets / Region dummy was omitted / Delete it? + "y" + # Admin password + "admin" + # Facebook OAuth Client ID (default) + "" + # Facebook OAuth Secret (default) + "" + # Google OAuth Client ID (default) + "" + # Google OAuth Secret (default) + "" + ) + printf "%s\n" "${CREDENTIALS[@]}" | PYTHONUNBUFFERED=1 python setup.py - name: Test run: | env/bin/python manage.py test diff --git a/setup.py b/setup.py index a39415857..c62727e7e 100644 --- a/setup.py +++ b/setup.py @@ -8,6 +8,7 @@ import string import random import json +import getpass import textwrap import unicodedata @@ -102,7 +103,7 @@ def input_password(self, key, prompt, hasher=None, required=False): configured = self.data.get(key, u'') prompt = u'\n{} [{}]: '.format(prompt, u'*****' if configured else u'') while True: - inputed = raw_input(PROMPT + prompt + RESET) + inputed = getpass.getpass(PROMPT + prompt + RESET) if required and not inputed and not configured: print(ERROR + u'\nError: The value is required.' + RESET) continue @@ -280,10 +281,7 @@ def install_requirements(configure): ], }[server_mode] requirements += { - u'Y': [ - u'-r', u'requirements/tests.txt', - u'-r', u'poleno/dummymail/requirements.txt' - ], + u'Y': [u'-r', u'requirements/tests.txt'], u'N': [], }[enable_unittests] call(u'Installing requirements for the selected server mode:', From be945341a84ec272a3dee4d7ebdebe02d2b541b8 Mon Sep 17 00:00:00 2001 From: viliambalaz Date: Tue, 30 Jun 2020 18:55:53 +0200 Subject: [PATCH 7/9] #280 Edit on --- .github/workflows/main.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 77df986e6..f2f987270 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,10 +1,6 @@ name: Python package -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] +on: [push, pull_request] jobs: build: From 2e0c60d860e8ee9e7070e4d3e95e206c07814bab Mon Sep 17 00:00:00 2001 From: viliambalaz Date: Tue, 30 Jun 2020 18:58:47 +0200 Subject: [PATCH 8/9] #280 Edit on: push --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f2f987270..8107c9aae 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,6 @@ name: Python package -on: [push, pull_request] +on: push jobs: build: From 6cf9a48f4b62b672143bea77ef595d0b3d346e5b Mon Sep 17 00:00:00 2001 From: viliambalaz Date: Wed, 1 Jul 2020 16:43:21 +0200 Subject: [PATCH 9/9] #280 Remove strategy matrix --- .github/workflows/main.yml | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8107c9aae..bd597dc44 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,27 +1,21 @@ -name: Python package - +name: Testing project on: push - jobs: build: - runs-on: ubuntu-18.04 - strategy: - matrix: - python-version: [2.7.18] - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} + - name: Checkout repo + uses: actions/checkout@v2 + - name: Set up Python uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python-version }} + python-version: 2.7.18 - name: Install dependencies run: | sudo apt-get update && sudo apt-get install virtualenv gettext - name: Run setup run: | - CREDENTIALS=( + CONFIGURATION=( # Server mode: Local development mode with dummy email infrastructure. "2" # Mock libreoffice? @@ -67,7 +61,7 @@ jobs: # Google OAuth Secret (default) "" ) - printf "%s\n" "${CREDENTIALS[@]}" | PYTHONUNBUFFERED=1 python setup.py - - name: Test + printf "%s\n" "${CONFIGURATION[@]}" | PYTHONUNBUFFERED=1 python setup.py + - name: Run tests run: | env/bin/python manage.py test