e2e #409
This file contains hidden or 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: e2e | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| push: | |
| branches: | |
| - main | |
| schedule: | |
| - cron: "0 4 * * *" | |
| concurrency: | |
| group: ${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test-native: | |
| name: Odoo-only | Odoo ${{ matrix.odoo_version }} (Python ${{ matrix.python_version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # conservative python versions, based on | |
| # https://github.com/OCA/oca-ci/blob/master/.github/workflows/ci.yaml#L24 | |
| # and our experience/legacy projects needs | |
| - odoo_version: "12.0" | |
| python_version: "3.7" | |
| - odoo_version: "13.0" | |
| python_version: "3.7" | |
| - odoo_version: "14.0" | |
| python_version: "3.8" | |
| - odoo_version: "15.0" | |
| python_version: "3.8" | |
| - odoo_version: "16.0" | |
| python_version: "3.10" | |
| - odoo_version: "17.0" | |
| python_version: "3.10" | |
| - odoo_version: "18.0" | |
| python_version: "3.10" | |
| - odoo_version: "19.0" | |
| python_version: "3.10" | |
| # higher python versions | |
| - odoo_version: "18.0" | |
| python_version: "3.12" | |
| - odoo_version: "19.0" | |
| python_version: "3.12" | |
| - odoo_version: "master" | |
| python_version: "3.12" | |
| # https://github.com/odoo/odoo/blob/master/odoo/release.py#L40 | |
| - odoo_version: "master" | |
| python_version: "3.13" | |
| steps: | |
| # Cache the uv binary in GitHub Actions tool-cache so setup-uv | |
| # finds it and skips downloading from GitHub Releases. | |
| - name: Cache uv binary | |
| uses: actions/cache@v4 | |
| with: | |
| path: /opt/hostedtoolcache/uv | |
| key: uv-binary-${{ runner.os }}-0.10.8 | |
| # Pre-install uv via official action with caching to avoid | |
| # downloading from GitHub Releases on every matrix job. | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| version: "0.10.8" | |
| enable-cache: true | |
| ignore-empty-workdir: true | |
| - name: Bootstrap | |
| run: | | |
| mkdir -p ~/code | |
| git config --global url."https://github.com/".insteadOf "git@github.com:" | |
| curl -fsSL https://raw.githubusercontent.com/trobz/local.py/main/bootstrap.sh | bash | |
| cat > ~/code/config.toml << 'EOF' | |
| versions = ["${{ matrix.odoo_version }}"] | |
| [tools] | |
| uv = ["odoo-addons-path"] | |
| system_packages = ["postgresql"] | |
| [repos] | |
| odoo = ["odoo"] | |
| EOF | |
| tlc --yes install-tools | |
| tlc --yes init | |
| echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
| # Cache the Odoo source for the day to avoid cloning on every run. | |
| # The key includes the date so the cache is invalidated daily, | |
| # ensuring we always test against a fresh Odoo clone each day. | |
| - name: Cache Odoo ${{ matrix.odoo_version }} | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/code/odoo/odoo/${{ matrix.odoo_version }} | |
| key: odoo-${{ matrix.odoo_version }}-${{ runner.os }}-${{ env.TODAY }} | |
| - name: Pull repos | |
| run: tlc --yes pull-repos | |
| - name: Check out odoo-venv | |
| uses: actions/checkout@v4 | |
| - name: Install odoo-venv | |
| run: uv tool install . | |
| # The uv tool only supports installing Python versions that still have distributable builds. | |
| # Python 3.7 reached end-of-life (EOL) in June 2023, and prebuilt binaries have been | |
| # removed from Astral's distribution index. | |
| - name: Install Python ${{ matrix.python_version }} via pyenv | |
| if: matrix.python_version == '3.7' | |
| run: | | |
| curl -fsSL https://pyenv.run | bash | |
| export PYENV_ROOT="$HOME/.pyenv" | |
| export PATH="$PYENV_ROOT/bin:$PATH" | |
| eval "$(pyenv init - bash)" | |
| pyenv install 3.7.17 | |
| pyenv global 3.7.17 | |
| echo "$PYENV_ROOT/bin" >> $GITHUB_PATH | |
| echo "$PYENV_ROOT/shims" >> $GITHUB_PATH | |
| - name: Create Odoo virtual environment | |
| run: | | |
| odoo-venv create --verbose \ | |
| --preset ci \ | |
| --odoo-dir ~/code/odoo/odoo/${{ matrix.odoo_version }} \ | |
| --venv-dir ~/code/venvs/${{ matrix.odoo_version }} \ | |
| --python-version ${{ matrix.python_version }} \ | |
| --create-launcher \ | |
| --skip-on-failure | |
| - name: Start PostgreSQL | |
| run: sudo systemctl start postgresql | |
| - name: Ensure DB user | |
| run: tlc --yes ensure-db-user | |
| - name: Smoke-test Odoo launcher | |
| run: | | |
| version="${{ matrix.odoo_version }}" | |
| if [[ "$version" == "master" ]]; then | |
| # master tracks a moving target (e.g. 19.3); read the real major from release.py | |
| major=$(python3 -c "exec(open('$HOME/code/odoo/odoo/master/odoo/release.py').read()); print(version_info[0])") | |
| else | |
| major="${version%%.*}" | |
| fi | |
| odoo-v${major} --workers=2 --stop-after-init | |
| test-oca: | |
| name: With OCA modules | Odoo ${{ matrix.odoo_version }} (Python ${{ matrix.python_version }}) | |
| needs: test-native | |
| if: needs.test-native.result == 'success' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - odoo_version: "12.0" | |
| python_version: "3.7" | |
| - odoo_version: "13.0" | |
| python_version: "3.7" | |
| - odoo_version: "14.0" | |
| python_version: "3.8" | |
| - odoo_version: "15.0" | |
| python_version: "3.8" | |
| - odoo_version: "16.0" | |
| python_version: "3.10" | |
| - odoo_version: "17.0" | |
| python_version: "3.10" | |
| - odoo_version: "18.0" | |
| python_version: "3.10" | |
| - odoo_version: "19.0" | |
| python_version: "3.10" | |
| - odoo_version: "18.0" | |
| python_version: "3.12" | |
| - odoo_version: "19.0" | |
| python_version: "3.12" | |
| # master excluded: no all_repos_master.toml in trobz/odoo-addons-repos | |
| steps: | |
| # Cache the uv binary in GitHub Actions tool-cache so setup-uv | |
| # finds it and skips downloading from GitHub Releases. | |
| - name: Cache uv binary | |
| uses: actions/cache@v4 | |
| with: | |
| path: /opt/hostedtoolcache/uv | |
| key: uv-binary-${{ runner.os }}-0.10.8 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| version: "0.10.8" | |
| enable-cache: true | |
| ignore-empty-workdir: true | |
| - name: Bootstrap | |
| run: | | |
| mkdir -p ~/code | |
| git config --global url."https://github.com/".insteadOf "git@github.com:" | |
| curl -fsSL https://raw.githubusercontent.com/trobz/local.py/main/bootstrap.sh | bash | |
| # use the auto-generated per-version repo list from trobz/odoo-addons-repos | |
| curl -fsSL "https://raw.githubusercontent.com/trobz/odoo-addons-repos/main/all_repos_${{ matrix.odoo_version }}.toml" > ~/code/config.toml | |
| # append tools section (must come after top-level keys in the downloaded file) | |
| cat >> ~/code/config.toml << 'EOF' | |
| [tools] | |
| uv = ["odoo-addons-path"] | |
| system_packages = ["postgresql"] | |
| EOF | |
| tlc --yes install-tools | |
| tlc --yes init | |
| echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
| # Combined cache for Odoo source + OCA repos. | |
| # Falls back to the Odoo-only cache produced by the test-native job on first run. | |
| - name: Cache repos ${{ matrix.odoo_version }} | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/code/odoo/odoo/${{ matrix.odoo_version }} | |
| ~/code/oca/${{ matrix.odoo_version }} | |
| key: repos-${{ matrix.odoo_version }}-${{ runner.os }}-${{ env.TODAY }} | |
| restore-keys: | | |
| odoo-${{ matrix.odoo_version }}-${{ runner.os }}-${{ env.TODAY }} | |
| - name: Pull repos | |
| # Some OCA repos don't have branches for older Odoo versions — accept failures | |
| continue-on-error: true | |
| run: tlc --yes pull-repos | |
| - name: Check out odoo-venv | |
| uses: actions/checkout@v4 | |
| - name: Install odoo-venv | |
| run: uv tool install . | |
| - name: Install Python ${{ matrix.python_version }} via pyenv | |
| if: matrix.python_version == '3.7' | |
| run: | | |
| curl -fsSL https://pyenv.run | bash | |
| export PYENV_ROOT="$HOME/.pyenv" | |
| export PATH="$PYENV_ROOT/bin:$PATH" | |
| eval "$(pyenv init - bash)" | |
| pyenv install 3.7.17 | |
| pyenv global 3.7.17 | |
| echo "$PYENV_ROOT/bin" >> $GITHUB_PATH | |
| echo "$PYENV_ROOT/shims" >> $GITHUB_PATH | |
| - name: Create Odoo virtual environment | |
| run: | | |
| addons_path=$(odoo-addons-path ~/code/odoo/odoo/${{ matrix.odoo_version }} --addons-dir "~/code/oca/${{ matrix.odoo_version }}/*") | |
| odoo-venv create --verbose \ | |
| --preset ci \ | |
| --odoo-dir ~/code/odoo/odoo/${{ matrix.odoo_version }} \ | |
| --venv-dir ~/code/venvs/${{ matrix.odoo_version }} \ | |
| --python-version ${{ matrix.python_version }} \ | |
| --create-launcher \ | |
| --addons-path=$addons_path | |
| - name: Start PostgreSQL | |
| run: sudo systemctl start postgresql | |
| - name: Ensure DB user | |
| run: tlc --yes ensure-db-user | |
| - name: Smoke-test Odoo launcher | |
| run: | | |
| version="${{ matrix.odoo_version }}" | |
| major="${version%%.*}" | |
| odoo-v${major} --workers=2 --stop-after-init |