-
Notifications
You must be signed in to change notification settings - Fork 3
160 lines (143 loc) · 5.62 KB
/
build.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: Build
on:
push:
branches-ignore:
- 'dependabot/**'
paths-ignore:
- "docs/**"
- "*.md"
pull_request:
paths-ignore:
- "docs/**"
- "*.md"
release:
types: [created]
schedule:
-
cron: "0 1 * * 6" # Run at 1am every Saturday
workflow_dispatch: ~
jobs:
tests:
runs-on: ubuntu-latest
name: "Odoo ${{ matrix.odoo }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}"
strategy:
fail-fast: false
matrix:
odoo: [13, 14, 15, 16, 17]
symfony: ["^6.4", "^7.1"]
php: ["8.1", "8.2", "8.3"] # " required to keep the .0
exclude:
-
symfony: ^7.1
php: "8.1"
services:
postgres:
image: postgres
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: odoo
POSTGRES_USER: odoo
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
ODOO_API_HOST: http://localhost:8069
ODOO_API_DATABASE: odoo-master
ODOO_API_USERNAME: admin
ODOO_API_PASSWORD: admin
ODOO_API_INIT_MODULES: l10n_fr,account_accountant
steps:
-
name: Docker launch Odoo instance
run: |
docker run \
-d \
--rm \
-p 8069:8069 \
--network ${{ job.services.postgres.network }} \
-e "HOST=postgres" \
--name odoo \
-t odoo:${{ matrix.odoo }} \
-- \
--database "$ODOO_API_DATABASE" --init "$ODOO_API_INIT_MODULES"
docker ps --all --filter id=odoo --filter status=running --no-trunc --format "{{.ID}} {{.Status}}"
docker port odoo
-
uses: actions/checkout@v3
-
name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
extensions: intl, xmlrpc
tools: symfony
coverage: none
-
name: Restrict Symfony version
if: matrix.symfony != ''
run: |
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10"
composer global config --no-plugins allow-plugins.symfony/flex true
composer config extra.symfony.require "${{ matrix.symfony }}"
-
name: Get Composer cache directory
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
id: composer-cache
-
name: Cache Composer
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-
-
name: Install PHP dependencies
run: composer install --no-interaction
-
name: Composer validate
run: composer validate --strict
-
name: ECS check
run: vendor/bin/ecs check src tests
-
name: Wait until odoo is ready
run: |
while ! docker logs "odoo" 2>&1 | grep -q "odoo.modules.loading: Modules loaded";
do
sleep 1
echo "Checking if Odoo is fully up..."
done
echo "Odoo is UP !"
-
name: Build Odoo tests model classes
run: |
bin/odoo-model-classes-generator -vvv \
"./tests/TestModel/Object" \
"Tests\\FluxSE\\OdooApiClient\\TestModel\\Object" \
--only-model=account.account \
--only-model=account.journal \
--only-model=account.move \
--only-model=account.move.line \
--only-model=account.payment \
--only-model=account.payment.method \
--only-model=account.payment.register \
--only-model=account.tax \
--only-model=product.category \
--only-model=product.product \
--only-model=product.template \
--only-model=res.currency \
--only-model=res.partner \
--only-model=uom.uom
# Need classes from Odoo to be generated for the tests folder
-
name: Run PHPStan
run: vendor/bin/phpstan analyse -l max src/ tests/
-
name: Run PHPUnit
run: vendor/bin/phpunit --colors=always
-
name: Remove Odoo instance
run: docker rm -f "odoo"