-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (93 loc) · 3.46 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
name: tests
on:
pull_request:
branches:
- "16.0*"
push:
branches:
- "16.0"
- "16.0-ocabot-*"
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-22.04
container: ${{ matrix.container }}
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- container: ghcr.io/oca/oca-ci/py3.10-odoo16.0:latest
name: test with Odoo
- container: ghcr.io/oca/oca-ci/py3.10-ocb16.0:latest
makepo: "true"
name: test with OCB
services:
postgres:
image: postgres:12.0
env:
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoo
POSTGRES_DB: odoo
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- name: Install addons and dependencies
run: |
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "$GITHUB_ACTOR"
pip install git-aggregator
gitaggregate -c repos.yml
pip install -r requirements.txt
find . -maxdepth 3 -mindepth 3 -name __manifest__.py -exec sh -c "ln -rs \$(dirname '{}') $ADDONS_PATH/" \;
echo "addons_path=${ADDONS_PATH},${ADDONS_DIR}" >> ${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
- uses: codecov/codecov-action@v3
- name: Update .po files
run: |
. /opt/odoo-venv/bin/activate
git config --global --add safe.directory $(pwd)
dropdb ${PGDATABASE}
ADDONS=$(manifestoo --select-addons-dir ${ADDONS_DIR} list --separator=,)
/opt/odoo-venv/bin/odoo -d ${PGDATABASE} -i $(manifestoo --select-addons-dir ${ADDONS_DIR} --select-exclude "${EXCLUDE}" list-depends --separator=,) --stop-after-init --logfile=/dev/null
/opt/odoo-venv/bin/odoo -d ${PGDATABASE} -i $ADDONS --load-language=he_IL --stop-after-init --logfile=/dev/null
for module in $(echo $ADDONS | tr ',' ' '); do
mkdir -p $module/i18n
/opt/odoo-venv/bin/odoo -d ${PGDATABASE} -l he --i18n-export=$module/i18n/he.po --modules=$module --logfile=/dev/null
git add $module/i18n/he.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
if: ${{ matrix.makepo == 'true' }}