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

Stop building images for python 2 and Odoo <= 10 #55

Merged
merged 7 commits into from
Jan 18, 2024
Merged
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
46 changes: 0 additions & 46 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,49 +20,27 @@ jobs:
matrix:
include:
# odoo/odoo
- python_version: "2.7"
codename: focal
odoo_version: "8.0"
odoo_org_repo: "odoo/odoo"
virtualenv_constraint: "<20.22"
image_name: py2.7-odoo8.0
- python_version: "2.7"
codename: focal
odoo_version: "9.0"
odoo_org_repo: "odoo/odoo"
virtualenv_constraint: "<20.22"
image_name: py2.7-odoo9.0
- python_version: "2.7"
codename: focal
odoo_version: "10.0"
odoo_org_repo: "odoo/odoo"
virtualenv_constraint: "<20.22"
image_name: py2.7-odoo10.0
- python_version: "3.5"
codename: focal
odoo_version: "11.0"
odoo_org_repo: "odoo/odoo"
virtualenv_constraint: "<20.22"
image_name: py3.5-odoo11.0
- python_version: "3.6"
codename: focal
odoo_version: "12.0"
odoo_org_repo: "odoo/odoo"
setuptools_constraint: "<58" # vatnumber needs setuptools with 2to3 support
virtualenv_constraint: "<20.22"
image_name: py3.6-odoo12.0
- python_version: "3.6"
codename: focal
odoo_version: "13.0"
odoo_org_repo: "odoo/odoo"
setuptools_constraint: "<58" # vatnumber needs setuptools with 2to3 support
virtualenv_constraint: "<20.22"
image_name: py3.6-odoo13.0
- python_version: "3.6"
codename: focal
odoo_version: "14.0"
odoo_org_repo: "odoo/odoo"
virtualenv_constraint: "<20.22"
image_name: py3.6-odoo14.0
- python_version: "3.8"
codename: focal
Expand Down Expand Up @@ -90,49 +68,27 @@ jobs:
odoo_org_repo: "odoo/odoo"
image_name: py3.10-odoo17.0
# oca/ocb
- python_version: "2.7"
codename: focal
odoo_version: "8.0"
odoo_org_repo: "oca/ocb"
virtualenv_constraint: "<20.22"
image_name: py2.7-ocb8.0
- python_version: "2.7"
codename: focal
odoo_version: "9.0"
odoo_org_repo: "oca/ocb"
virtualenv_constraint: "<20.22"
image_name: py2.7-ocb9.0
- python_version: "2.7"
codename: focal
odoo_version: "10.0"
odoo_org_repo: "oca/ocb"
virtualenv_constraint: "<20.22"
image_name: py2.7-ocb10.0
- python_version: "3.5"
codename: focal
odoo_version: "11.0"
odoo_org_repo: "oca/ocb"
virtualenv_constraint: "<20.22"
image_name: py3.5-ocb11.0
- python_version: "3.6"
codename: focal
odoo_version: "12.0"
odoo_org_repo: "oca/ocb"
setuptools_constraint: "<58" # vatnumber needs setuptools with 2to3 support
virtualenv_constraint: "<20.22"
image_name: py3.6-ocb12.0
- python_version: "3.6"
codename: focal
odoo_version: "13.0"
odoo_org_repo: "oca/ocb"
setuptools_constraint: "<58" # vatnumber needs setuptools with 2to3 support
virtualenv_constraint: "<20.22"
image_name: py3.6-ocb13.0
- python_version: "3.6"
codename: focal
odoo_version: "14.0"
odoo_org_repo: "oca/ocb"
virtualenv_constraint: "<20.22"
image_name: py3.6-ocb14.0
- python_version: "3.8"
codename: focal
Expand Down Expand Up @@ -186,7 +142,6 @@ jobs:
odoo_version=${{ matrix.odoo_version }}
odoo_org_repo=${{ matrix.odoo_org_repo }}
setuptools_constraint=${{ matrix.setuptools_constraint }}
virtualenv_constraint=${{ matrix.virtualenv_constraint }}
tags: |
ghcr.io/oca/oca-ci/${{ matrix.image_name }}:latest
labels: |
Expand All @@ -209,7 +164,6 @@ jobs:
odoo_version=${{ matrix.odoo_version }}
odoo_org_repo=${{ matrix.odoo_org_repo }}
setuptools_constraint=${{ matrix.setuptools_constraint }}
virtualenv_constraint=${{ matrix.virtualenv_constraint }}
tags: |
ghcr.io/oca/oca-ci/${{ matrix.image_name }}:latest
labels: |
Expand Down
35 changes: 10 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ RUN apt-get update -qq \
gnupg \
lsb-release \
software-properties-common \
expect-dev
expect-dev \
pipx

ENV PIPX_BIN_DIR=/usr/local/bin

# Install wkhtml
RUN case $(lsb_release -c -s) in \
Expand Down Expand Up @@ -58,7 +61,8 @@ ARG python_version
RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -qq --no-install-recommends \
build-essential \
python$python_version-dev \
python${python_version}-dev \
python${python_version}-venv \
# we need python 3 for our helper scripts
python3 \
python3-venv \
Expand All @@ -81,24 +85,7 @@ RUN apt-get update -qq \
# some other build tools
swig \
libffi-dev \
pkg-config \
# We should install distutils if and only if it exists
&& apt-cache --generate pkgnames \
| grep --line-regexp --fixed-strings \
-e python$python_version-distutils \
| xargs apt install -y

# Install pipx, which we use to install other python tools.
ENV PIPX_BIN_DIR=/usr/local/bin
ENV PIPX_DEFAULT_PYTHON=/usr/bin/python3
RUN python3 -m venv /opt/pipx-venv \
&& /opt/pipx-venv/bin/pip install --no-cache-dir pipx \
&& ln -s /opt/pipx-venv/bin/pipx /usr/local/bin/

# We don't use the ubuntu virtualenv package because it unbundles pip dependencies
# in virtualenvs it create.
ARG virtualenv_constraint
RUN pipx install --pip-args="--no-cache-dir" "virtualenv$virtualenv_constraint"
pkg-config

# We use manifestoo to check licenses, development status and list addons and dependencies
RUN pipx install --pip-args="--no-cache-dir" "manifestoo>=0.3.1"
Expand All @@ -111,8 +98,8 @@ RUN pipx inject --pip-args="--no-cache-dir" pyproject-dependencies $build_deps
# Make a virtualenv for Odoo so we isolate from system python dependencies and
# make sure addons we test declare all their python dependencies properly
ARG setuptools_constraint
RUN virtualenv -p python$python_version /opt/odoo-venv \
&& /opt/odoo-venv/bin/pip install "setuptools$setuptools_constraint" "pip>=21.3.1;python_version>='3.6'" \
RUN python$python_version -m venv /opt/odoo-venv \
&& /opt/odoo-venv/bin/pip install -U "setuptools$setuptools_constraint" "pip" \
&& /opt/odoo-venv/bin/pip list
ENV PATH=/opt/odoo-venv/bin:$PATH

Expand All @@ -128,11 +115,9 @@ RUN pip install --no-cache-dir --no-binary psycopg2 -r /tmp/ocb-requirements.txt
# Install other test requirements.
# - coverage
# - websocket-client is required for Odoo browser tests
# - odoo-autodiscover required for python2
RUN pip install --no-cache-dir \
coverage \
websocket-client \
"odoo-autodiscover>=2 ; python_version<'3'"
websocket-client

# Install Odoo (use ADD for correct layer caching)
ARG odoo_org_repo=odoo/odoo
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ These images provide the following guarantees:
- Odoo source code is in `/opt/odoo`.
- Odoo is installed in editable mode in a virtualenv isolated from system python packages.
- The Odoo configuration file exists at `$ODOO_RC`.
- The `python`, `pip` and `odoo` (`openerp-server` for Odoo < 10) commands
- The `python`, `pip` and `odoo` commands
found first in `PATH` are from that virtualenv.
- `coverage` is installed in that virtualenv.
- Prerequisites for running Odoo tests are installed in that virtualenv
Expand Down
2 changes: 1 addition & 1 deletion bin/oca_init_test_database
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ else
ADDONS=$(manifestoo --select-addons-dir ${ADDONS_DIR} --select-exclude "${EXCLUDE}" list-depends --separator=,)
fi

unbuffer $(which odoo || which openerp-server) \
unbuffer $(which odoo) \
-d ${PGDATABASE} \
-i ${ADDONS:-base} \
--stop-after-init
2 changes: 1 addition & 1 deletion bin/oca_run_tests
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if [ -z "$ADDONS" ]; then
fi

unbuffer coverage run --include "${ADDONS_DIR}/*" --branch \
$(which odoo || which openerp-server) \
$(which odoo) \
-d ${PGDATABASE} \
-i ${ADDONS} \
--test-enable \
Expand Down
5 changes: 1 addition & 4 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@

odoo_version_info = tuple(map(int, os.environ["ODOO_VERSION"].split(".")))

if odoo_version_info < (10, 0):
odoo_bin = "openerp-server"
else:
odoo_bin = "odoo"
odoo_bin = "odoo"


@contextlib.contextmanager
Expand Down
2 changes: 1 addition & 1 deletion tests/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ set -e
here=$(dirname $0)
testvenv=/tmp/testvenv

virtualenv -p python3 $testvenv
/usr/bin/python3 -m venv $testvenv
$testvenv/bin/pip install pytest
$testvenv/bin/pytest --color=yes --ignore $here/data $here "$@"
6 changes: 0 additions & 6 deletions tests/test_preinstalled.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,5 @@ def test_openerp_server_rc():
assert os.environ["OPENERP_SERVER"] == os.environ["ODOO_RC"]


@pytest.mark.skipif(odoo_version_info >= (10, 0), reason="Odoo>=10")
def test_import_openerp():
subprocess.check_call(["python", "-c", "import openerp; openerp.addons.__path__"])


@pytest.mark.skipif(odoo_version_info < (10, 0), reason="Odoo<10")
def test_import_odoo():
subprocess.check_call(["python", "-c", "import odoo; odoo.addons.__path__"])