From 86d3e1cb4b2aa249a502140e9418fc721fe9c275 Mon Sep 17 00:00:00 2001 From: Martin Whitehouse Date: Wed, 20 Jul 2022 15:00:14 +0200 Subject: [PATCH 1/6] Initial github workflow Basic template to run quicktest with python versions - 3.8 - 3.9 - 3.10 --- .github/workflows/pythonpackage.yml | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/pythonpackage.yml diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml new file mode 100644 index 00000000..6c3568c9 --- /dev/null +++ b/.github/workflows/pythonpackage.yml @@ -0,0 +1,36 @@ +name: Python package + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + matrix: + python-version: ["3.8", "3.9", "3.10"] + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + # - name: Lint with flake8 + # run: | + # pip install flake8 + # 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: | + pip install pytest + cd ${GITHUB_WORKSPACE} && python quicktest.py + env: + DJANGO_SETTINGS_MODULE: helpdesk.settings + From 3423627f2d7054bee6ceb3ffcf5cf2282edbcc1a Mon Sep 17 00:00:00 2001 From: Martin Whitehouse Date: Wed, 20 Jul 2022 15:59:28 +0200 Subject: [PATCH 2/6] Add shebang to 'quicktest.py' --- quicktest.py | 1 + 1 file changed, 1 insertion(+) mode change 100644 => 100755 quicktest.py diff --git a/quicktest.py b/quicktest.py old mode 100644 new mode 100755 index dc576596..0e4bc791 --- a/quicktest.py +++ b/quicktest.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python """ Usage: $ python -m venv .venv From f6caebc661aaaa1b23bc4175ec27539a5f5be74a Mon Sep 17 00:00:00 2001 From: Martin Whitehouse Date: Wed, 20 Jul 2022 16:01:07 +0200 Subject: [PATCH 3/6] Add requirements-testing to workflow --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 6c3568c9..4d50085c 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -19,7 +19,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt + pip install -r requirements.txt -r requirements-testing.txt # - name: Lint with flake8 # run: | # pip install flake8 From 70206b8f8f2e94400a58193d1220e57e802ef4ab Mon Sep 17 00:00:00 2001 From: Martin Whitehouse Date: Wed, 20 Jul 2022 16:10:18 +0200 Subject: [PATCH 4/6] Add django<4 constraint to workflow --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 4d50085c..23add7ee 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -19,7 +19,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt -r requirements-testing.txt + pip install -r requirements.txt -r requirements-testing.txt -c constraints-Django32.txt # - name: Lint with flake8 # run: | # pip install flake8 From 08654bd9c4d092afde2c63ecf2bbeaf21ec96a13 Mon Sep 17 00:00:00 2001 From: Martin Whitehouse Date: Wed, 20 Jul 2022 16:21:28 +0200 Subject: [PATCH 5/6] Remove 3.10 from test matrix Working through to error cause --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 23add7ee..30a3bf33 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -9,7 +9,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: ["3.8", "3.9", "3.10"] + python-version: ["3.8", "3.9"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} From fa91620bf904b07407a47528b831b23e56315ba6 Mon Sep 17 00:00:00 2001 From: Martin Whitehouse Date: Wed, 20 Jul 2022 16:32:51 +0200 Subject: [PATCH 6/6] EscapeHtml.extendMarkdown disabled Updated markdown caused failures. Not sure what is going on with this class, 0 comments :-( If someone could give me a hint as to what this is trying to achieve, I can investigate further --- .github/workflows/pythonpackage.yml | 2 +- helpdesk/models.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 30a3bf33..23add7ee 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -9,7 +9,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: ["3.8", "3.9"] + python-version: ["3.8", "3.9", "3.10"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} diff --git a/helpdesk/models.py b/helpdesk/models.py index 7ef1b9c9..dcc0d9d8 100644 --- a/helpdesk/models.py +++ b/helpdesk/models.py @@ -50,9 +50,10 @@ def format_time_spent(time_spent): class EscapeHtml(Extension): - def extendMarkdown(self, md, md_globals): - del md.preprocessors['html_block'] - del md.inlinePatterns['html'] + def extendMarkdown(self, md, md_globals=None): + # del md.preprocessors['html_block'] + # del md.inlinePatterns['html'] + pass def get_markdown(text):