[ADD] Older versions compatibility. #1445
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
pytest_addopts: | |
description: | |
Extra options for pytest; use -vv for full details; see | |
https://docs.pytest.org/en/latest/example/simple.html#how-to-change-command-line-options-defaults | |
required: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
LANG: "en_US.utf-8" | |
LC_ALL: "en_US.utf-8" | |
PIP_CACHE_DIR: ${{ github.workspace }}/.cache.~/pip | |
PIPX_HOME: ${{ github.workspace }}/.cache.~/pipx | |
POETRY_CACHE_DIR: ${{ github.workspace }}/.cache.~/pypoetry | |
POETRY_VIRTUALENVS_IN_PROJECT: "true" | |
PRE_COMMIT_HOME: ${{ github.workspace }}/.cache.~/pre-commit | |
PYTEST_ADDOPTS: ${{ github.event.inputs.pytest_addopts }} | |
PYTHONIOENCODING: "UTF-8" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- 3.8 | |
- 3.9 | |
- "3.10" | |
- 3.11 | |
odoo-version: | |
- 11.0 | |
- 12.0 | |
- 13.0 | |
- 14.0 | |
- 15.0 | |
- 16.0 | |
- 17.0 | |
include: | |
- python-version: "3.10" | |
odoo-version: 18.0 | |
- python-version: 3.11 | |
odoo-version: 18.0 | |
traefik_version: | |
- 1 | |
- 2 | |
- 3 | |
steps: | |
# Shared steps | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history for all tags and branches | |
- name: Install python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Compose | |
uses: ndeloof/install-compose-action@c036dce35dc2a23597c03aa05f32347b2cfa0437 | |
with: | |
version: v2.26.0 | |
legacy: false # force V2 | |
- name: Generate cache key CACHE | |
run: | |
echo "CACHE=${{ secrets.CACHE_DATE }} ${{ runner.os }} $(python -VV | | |
sha256sum | cut -d' ' -f1) ${{ hashFiles('pyproject.toml') }} ${{ | |
hashFiles('poetry.lock') }} ${{ hashFiles('.pre-commit-config.yaml') }}" >> | |
$GITHUB_ENV | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
.cache.~ | |
.venv | |
~/.local/bin | |
key: venv ${{ env.CACHE }} | |
- run: pip install poetry | |
- name: Patch $PATH | |
run: echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- run: poetry install --no-root | |
# Precreate shared networks to avoid race conditions | |
- run: docker network create inverseproxy_shared | |
- run: docker network create globalwhitelist_shared | |
# Let tests issue git commits | |
- run: git config --global user.name CI | |
- run: git config --global user.email CI@GITHUB | |
# Run all tests, which includes linters | |
# Non concurrent first (in parallel) | |
- run: poetry run invoke test | |
env: | |
SELECTED_ODOO_VERSIONS: ${{ matrix.odoo-version }} | |
TRAEFIK_VERSION: ${{ matrix.traefik_version }} | |
# Concurrent tests (isolated) | |
- run: poetry run invoke test --sequential | |
env: | |
SELECTED_ODOO_VERSIONS: ${{ matrix.odoo-version }} | |
TRAEFIK_VERSION: ${{ matrix.traefik_version }} |