-
Notifications
You must be signed in to change notification settings - Fork 14
108 lines (107 loc) · 3.57 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
105
106
107
108
name: tests
on:
pull_request:
branches:
- "15.0*"
- "17.0*"
push:
branches:
- "15.0*"
- "17.0*"
env:
OCA_GIT_USER_NAME: openg2p
OCA_GIT_USER_EMAIL: [email protected]
jobs:
unreleased-deps:
runs-on: ubuntu-22.04
name: Detect unreleased dependencies
steps:
- uses: actions/checkout@v3
- 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
matrix_prep:
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
BRANCH_NAME=$(echo ${{ github.base_ref || github.ref }} | sed -e 's,.*/\(.*\),\1,')
if [[ $BRANCH_NAME = 15.0* ]] ; then
matrix='{"include": [{
"container": "ghcr.io/oca/oca-ci/py3.8-odoo15.0:latest",
"makepot": "true",
"name": "test with Odoo 15"
},{
"container": "ghcr.io/oca/oca-ci/py3.8-ocb15.0:latest",
"name": "test with OCB 15"
}]}'
elif [[ $BRANCH_NAME = 17.0* ]] ; then
matrix='{"include": [{
"container": "ghcr.io/oca/oca-ci/py3.10-odoo17.0:latest",
"makepot": "true",
"name": "test with Odoo 17"
},{
"container": "ghcr.io/oca/oca-ci/py3.10-ocb17.0:latest",
"name": "test with OCB 17"
}]}'
fi
echo "matrix=$matrix" | tr -d '\n' >> $GITHUB_OUTPUT
test:
needs: matrix_prep
runs-on: ubuntu-22.04
container: ${{ matrix.container }}
name: ${{ matrix.name }}
permissions:
contents: write
strategy:
fail-fast: false
matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}}
services:
postgres:
image: postgres:12.0
env:
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoo
POSTGRES_DB: odoo
ports:
- 5432:5432
steps:
# TODO: Think of caching dependency install.
- run: DEBIAN_FRONTEND=noninteractive apt-get install -qq --no-install-recommends build-essential autoconf autotools-dev automake libtool
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Install test-pre-requirments
run: |
if [ -f test-pre-requirements.txt ]; then
pip install -r test-pre-requirements.txt
fi
- name: Install addons and dependencies
run: oca_install_addons
- 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@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Update .pot files
run: oca_export_and_push_pot https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
if: ${{ matrix.makepot == 'true' && github.event_name == 'push' && github.repository_owner == 'openg2p' }}