Skip to content

staging

staging #869

Workflow file for this run

name: tests
on:
pull_request:
branches:
- "16.0*"
push:
branches:
- "16.0"
jobs:
unreleased-deps:
runs-on: ubuntu-latest
name: Detect unreleased dependencies
steps:
- uses: actions/checkout@v2
- 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)
grep "^[^#].*/" ${reqfile} || result=$?
if [ $result -eq 0 ] ; then
echo "Unreleased dependencies found in ${reqfile}."
exit 1
fi
fi
done
test:
runs-on: ubuntu-latest
container: ghcr.io/oca/oca-ci/py3.10-ocb16.0:latest
name: Run tests
strategy:
fail-fast: false
services:
postgres:
image: postgres:12.0
env:
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoo
POSTGRES_DB: odoo
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v4
id: cache
with:
path: /tmp/src
key: gitaggregate
- name: Install addons and dependencies
run: |
apt -y install openssh-client
eval `ssh-agent -s`
mkdir -p /root/.ssh
ssh-keyscan -H github.com >> /root/.ssh/known_hosts
echo '${{ secrets.SANDBOX_DEPLOY_KEY }}' > /root/.ssh/sandbox_deploy_key
chmod 700 /root/.ssh
chmod 600 /root/.ssh/sandbox_deploy_key
ssh-add /root/.ssh/sandbox_deploy_key
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "$GITHUB_ACTOR"
pip install -r requirements.txt
pip install git-aggregator
mkdir -p /tmp/src/gitaggregate
cd /tmp/src/gitaggregate
gitaggregate --jobs 8 -c $GITHUB_WORKSPACE/repos.yml
find . -maxdepth 3 -mindepth 3 -name __manifest__.py -exec sh -c "ln -rs \$(dirname '{}') $ADDONS_PATH/" \;
pip install ../libreerp-git
cd $GITHUB_WORKSPACE
echo "addons_path=/tmp/src/libreerp-git/odoo/addons,/tmp/src/libreerp-git/addons,${ADDONS_PATH},${ADDONS_DIR}" >> ${ODOO_RC}
cat $ODOO_RC
- name: Check licenses
run: manifestoo -d . check-licenses
continue-on-error: true
- name: Check development status
run: manifestoo -d . check-dev-status --default-dev-status=Beta
continue-on-error: true
- name: Initialize test db
run: oca_init_test_database
- name: Run tests
run: oca_run_tests
- name: Generate coverage.xml
run: coverage xml --include '*.py'
- uses: codecov/codecov-action@v3
with:
files: coverage.xml
- name: Show files to be cached
run: du -chsx /tmp/src/*
- uses: actions/cache/save@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
path: /tmp/src
key: gitaggregate
- name: Update .po files
run: |
apt install gettext
git config --global --add safe.directory $(pwd)
LANG=he_IL
ADDONS=$(manifestoo --select-addons-dir ${ADDONS_DIR} list --separator=,)
for module in $(echo $ADDONS | tr ',' ' '); do
mkdir -p $module/i18n
/opt/odoo-venv/bin/odoo -d ${PGDATABASE} --i18n-export=/tmp/$module.pot --modules=$module --logfile=/dev/null
if [ -f $module/i18n/$LANG.po ]; then
TMPFILE=$(mktemp)
msgmerge --lang=$LANG --no-fuzzy-matching $module/i18n/$LANG.po /tmp/$module.pot --output-file=$TMPFILE
msgattrib --no-obsolete $TMPFILE > $module/i18n/$LANG.po
else
msginit --input /tmp/$module.pot --locale $LANG --no-translator -o $module/i18n/$LANG.po
fi
sed -i '/^"POT-Creation-Date:/d' $module/i18n/$LANG.po
git add $module/i18n/$LANG.po
done
if git commit -m '[UPD] translations' --dry-run; then
git fetch origin $GITHUB_HEAD_REF
git checkout $GITHUB_HEAD_REF
git commit -m '[UPD] translations'
git push origin $GITHUB_HEAD_REF
else
echo No changes, doing nothing
fi