From 33efe3c1e25d4aba446557a4030692a9c7d680de Mon Sep 17 00:00:00 2001 From: Carmen Bianca Bakker Date: Wed, 30 Mar 2022 11:27:33 +0200 Subject: [PATCH] [FIX] Hard-specify Python versions in pre-commit for Odoo <=12 The flake8 version used by these Odoo versions does not work with more recent versions of Python. Signed-off-by: Carmen Bianca Bakker --- .github/workflows/test.yml | 9 ++++++++- src/.github/workflows/pre-commit.yml.jinja | 7 +++++++ .../mqt-compat/.pre-commit-config.yaml.jinja | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8f01939..e85084a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,12 +19,19 @@ jobs: - 3.6 - 3.8 odoo-version: - - 10.0 - 11.0 - 12.0 - 13.0 - 14.0 - 15.0 + include: + - python-version: 2.7 + odoo-version: 10.0 + exclude: + - python-version: 3.8 + odoo-version: 11.0 + - python-version: 3.8 + odoo-version: 12.0 steps: # Prepare environment - uses: actions/checkout@v2.3.3 diff --git a/src/.github/workflows/pre-commit.yml.jinja b/src/.github/workflows/pre-commit.yml.jinja index 4061db9..5d04673 100644 --- a/src/.github/workflows/pre-commit.yml.jinja +++ b/src/.github/workflows/pre-commit.yml.jinja @@ -15,6 +15,13 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 +{%- if 10 < odoo_version < 13 %} + with: + python-version: "3.6" +{%- elif odoo_version <= 10 %} + with: + python-version: "2.7" +{%- endif %} - name: Get python version run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - uses: actions/cache@v1 diff --git a/version-specific/mqt-compat/.pre-commit-config.yaml.jinja b/version-specific/mqt-compat/.pre-commit-config.yaml.jinja index 1f78268..fb263ba 100644 --- a/version-specific/mqt-compat/.pre-commit-config.yaml.jinja +++ b/version-specific/mqt-compat/.pre-commit-config.yaml.jinja @@ -40,7 +40,7 @@ repos: rev: v3.4.1 hooks: - id: flake8 - language_version: python{% if odoo_version < 11 %}2{% else %}3{% endif %} + language_version: python{% if odoo_version < 11 %}2{% else %}3.6{% endif %} name: flake8 excluding __init__.py exclude: __init__\.py - repo: https://github.com/pre-commit/mirrors-pylint