[INIT] 19.0: CI config

This commit is contained in:
Luc De Meyer
2026-03-01 20:52:57 +01:00
commit 6fdeb820b1
16 changed files with 967 additions and 0 deletions

47
.github/workflows/pre-commit.yml vendored Normal file
View File

@@ -0,0 +1,47 @@
name: pre-commit
on:
pull_request:
branches:
- "19.0*"
push:
branches:
- "19.0"
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
cache-dependency-path: '.pre-commit-config.yaml'
- name: Get python version
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files --show-diff-on-failure --color=always
env:
# Consider valid a PR that changes README fragments but doesn't
# change the README.rst file itself. It's not really a problem
# because the bot will update it anyway after merge. This way, we
# lower the barrier for functional contributors that want to fix the
# readme fragments, while still letting developers get README
# auto-generated (which also helps functionals when using runboat).
# DOCS https://pre-commit.com/#temporarily-disabling-hooks
SKIP: oca-gen-addon-readme
- name: Check that all files generated by pre-commit are in git
run: |
newfiles="$(git ls-files --others --exclude-from=.gitignore)"
if [ "$newfiles" != "" ] ; then
echo "Please check-in the following files:"
echo "$newfiles"
exit 1
fi

137
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,137 @@
name: tests
on:
pull_request:
branches:
- "19.0*"
push:
branches:
- "19.0"
jobs:
unreleased-deps:
runs-on: ubuntu-latest
name: Detect unreleased dependencies
steps:
- uses: actions/checkout@v4
- run: |
for reqfile in requirements.txt test-requirements.txt ; do
if [ -f ${reqfile} ] ; then
result=0
# reject non-comment lines that contain a / (i.e. URLs, relative paths)
# unless they have a "# SKIP TEST" comment
grep "^[^#].*/" ${reqfile} | grep -v "# SKIP TEST" || result=$?
if [ $result -eq 0 ] ; then
echo "Unreleased dependencies found in ${reqfile}."
exit 1
fi
fi
done
test:
runs-on: ubuntu-latest
container: ${{ matrix.container }}
name: ${{ matrix.name }}
permissions:
pull-requests: write
contents: write
strategy:
fail-fast: false
matrix:
include:
- container: ghcr.io/oca/oca-ci/py3.10-odoo19.0:latest
name: test with Odoo Community
odoo_enterprise : 0
exclude_modules : ""
- container: ghcr.io/oca/oca-ci/py3.10-odoo19.0:latest
name: test with Odoo Enterprise
odoo_enterprise : 1
exclude_modules : ""
makepot: "true"
services:
postgres:
image: postgres:12.0
env:
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoo
POSTGRES_DB: odoo
ports:
- 5432:5432
env:
INSTALL_ADDONS_DIR: "/tmp/addons-merged"
ADDITIONAL_ADDONS_DIR: "/tmp/additional-addons"
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set pip constraints (pyOpenSSL / cryptography)
run: |
cat > /tmp/constraints.txt <<'EOF'
pyOpenSSL == 22.1.0
cryptography == 38.0.4
EOF
echo "PIP_CONSTRAINT=/tmp/constraints.txt" >> $GITHUB_ENV
- name: Upgrade pip in container
run: python -m pip install --upgrade pip
- name: Install Odoo upgrade util
run: python -m pip install git+https://github.com/odoo/upgrade-util@master
- name: Add Noviat CI Tools to PATH
run: |
git clone https://${{ secrets.PRIVATE_TOKEN }}@github.com/Noviat-CI/noviat-ci-tools.git /opt/noviat-ci-tools
echo "/opt/noviat-ci-tools" >> $GITHUB_PATH
- name: Clone Odoo Enterprise
if: ${{ matrix.odoo_enterprise == 1 }}
run : |
git clone https://${{ secrets.PRIVATE_TOKEN }}@github.com/odoo/enterprise.git --depth 1 -b 19.0 /opt/enterprise
- name: Clone Noviat Dependencies
env:
PRIVATE_TOKEN: ${{ secrets.PRIVATE_TOKEN }}
run: clone_oca_dependencies_by_noviat
- name: Create addons path
run: |
mkdir -p ${{ env.INSTALL_ADDONS_DIR }}/setup
find $(realpath $ADDONS_DIR) $(realpath ${{ env.ADDITIONAL_ADDONS_DIR }}) -name __manifest__.py -exec sh -c 'ln -s "$(dirname "$0")" "${{ env.INSTALL_ADDONS_DIR }}"' {} \;
find $(realpath $ADDONS_DIR) $(realpath ${{ env.ADDITIONAL_ADDONS_DIR }}) -iwholename '*/setup/*/setup.py' -exec sh -c 'ln -s "$(dirname "$0")" "${{ env.INSTALL_ADDONS_DIR }}/setup"' {} \;
if [ -n ${{ matrix.exclude}} ]
then
remove_excluded_modules ${{ env.INSTALL_ADDONS_DIR }} ${{ matrix.exclude }}
fi
- name: Update addons path with enterprise
if: ${{ matrix.odoo_enterprise == 1 }}
run: |
echo "ADDONS_PATH=/opt/odoo/addons,/opt/enterprise,${{ env.INSTALL_ADDONS_DIR }}" >> $GITHUB_ENV
- name: Update addons path without enterprise
if: ${{ matrix.odoo_enterprise == 0 }}
run: |
echo "ADDONS_PATH=/opt/odoo/addons,${{ env.INSTALL_ADDONS_DIR }}" >> $GITHUB_ENV
- name: Add addons to EXCLUDE PATH
if: ${{ matrix.EXCLUDE_MODULES }}
run: |
echo "server_wide_modules = web,module_change_auto_install" >> ${ODOO_RC}
echo "ODOO_MODULES_AUTO_INSTALL_DISABLED=${{ matrix.EXCLUDE_MODULES }}" >> $GITHUB_ENV
- name: Inject GitHub token for Noviat orgs in test-requirements.txt
run: |
sed -i -E "s#https://github.com/(Noviat-(Projects|Generic|ARP|Internal))#https://${{ secrets.PRIVATE_TOKEN }}@github.com/\1#g" test-requirements.txt
- name: Install addons and dependencies
run: |
(ADDONS_PATH=${ADDONS_PATH} ADDONS_DIR=${INSTALL_ADDONS_DIR} oca_install_addons)
- name: Initialize test db
run: oca_init_test_database
- name: Run tests
run: oca_run_tests
- name: Generate coverage files
run: |
coverage report -m
coverage xml -o coverage.xml
- name: Code Coverage Summary Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: 'coverage.xml'
badge: true
format: 'markdown'
output: 'both'
hide_complexity: true
- name: Write to Job Summary
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
- name: Update .pot files
run: noviat_export_and_push_pot https://x-access-token:${{ secrets.PRIVATE_TOKEN }}@github.com/${{ github.repository }}
if: ${{ matrix.makepot == 'true' && github.event_name == 'push' }}

View File

@@ -0,0 +1,41 @@
name: Update addons table after merge
on:
push:
branches:
- "19.0"
paths-ignore:
- "README.md"
permissions:
contents: write
jobs:
gen-addons-table:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install pre-commit
run: pip install pre-commit
- name: Run the manual hook to (re)generate the addons table
run: pre-commit run -a --hook-stage manual oca-gen-addons-table
continue-on-error: true
- name: Commit & push if changed
env:
PUSH_URL: https://x-access-token:${{ secrets.PRIVATE_TOKEN }}@github.com/${{ github.repository }}.git
run: |
if ! git diff --quiet; then
git config user.name "noviat-ci-bot"
git config user.email "bot+ci@noviat.com"
git add -A
git commit -m "update addons table"
git remote set-url origin "$PUSH_URL"
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git push origin HEAD:19.0
fi