-
Notifications
You must be signed in to change notification settings - Fork 114
104 lines (100 loc) · 3.14 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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
include:
- python-version: "3.10"
odoo-version: 17.0
- python-version: 3.11
odoo-version: 17.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 }}