Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Python 2.7 #199

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 30 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,41 @@ on:
types: [created]

jobs:
test_python27:
runs-on: ubuntu-20.04
container:
image: python:2.7.18-buster
steps:
# Prepare environment
- uses: actions/checkout@v3

# Make Python 3.6 also available when testing Python 2.7.
# It is required by `pipx`
- name: Install python3.6
uses: actions/setup-python@v4
with:
python-version: 3.6

- name: Install pipx
run: pip3 install pipx

- name: Install poetry
run: pipx install poetry

# Let tests issue git commits
- run: git config --global user.name CI
- run: git config --global user.email CI@GITHUB

# Run all tests
- run: poetry install
- run: poetry run pytest --color yes
env:
SELECTED_ODOO_VERSIONS: 10.0
test:
runs-on: ${{matrix.machine}}
strategy:
matrix:
include:
- odoo-version: 10.0
python-version: 2.7
machine: ubuntu-20.04
- odoo-version: 11.0
python-version: 3.6
machine: ubuntu-20.04
Expand All @@ -40,13 +67,6 @@ jobs:
- name: Install poetry
run: pipx install poetry

# Make Python 3.6 also available when testing Python 2.7.
- name: Install python3.6
if: ${{ matrix.python-version == 2.7 }}
uses: actions/setup-python@v4
with:
python-version: 3.6

# Install specific alternate python versions required by hooks
- name: Install python
uses: actions/setup-python@v4
Expand Down
11 changes: 7 additions & 4 deletions src/.github/workflows/pre-commit.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,22 @@ jobs:
runs-on: ubuntu-20.04
{%- else %}
runs-on: ubuntu-22.04
{%- endif %}
{%- if odoo_version < 11 %}
container:
image: python:2.7.18-buster
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may not be necessary since the ubunu-20.04 runner has python2 preinstalled.

{%- endif %}
steps:
- uses: actions/checkout@v3
{%- if odoo_version >= 11 %}
- uses: actions/setup-python@v2
{%- if odoo_version < 11 %}
with:
python-version: "2.7"
{%- elif odoo_version < 13 %}
{%- if odoo_version < 13 %}
with:
python-version: "3.6"
{%- elif odoo_version < 14 %}
with:
python-version: "3.8"
{%- endif %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should pin the python version for all Odoo versions. But that's for another PR, I guess.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is, but the PR was closed.

#196

{%- endif %}
- name: Get python version
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
Expand Down