-
Notifications
You must be signed in to change notification settings - Fork 3
100 lines (96 loc) · 2.93 KB
/
test-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
name: test-build
on:
pull_request:
types: [opened, reopened, synchronize]
branches:
- "16.0"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
uses: ./.github/workflows/build-and-push.yml
with:
tags: ghcr.io/${{ github.repository_owner }}/curq-ci:pr-${{ github.event.pull_request.number }}
target: "ci"
cache: true
test:
runs-on: ubuntu-22.04
needs: [build]
container:
image: ghcr.io/${{ github.repository_owner }}/curq-ci:pr-${{ github.event.pull_request.number }}
services:
postgres:
image: postgres:13.0
env:
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoo
POSTGRES_DB: odoo
ports:
- 5432:5432
env:
DB_HOST: postgres
DB_PORT: "5432"
DB_USER: odoo
DB_PASSWORD: odoo
WORKERS: "0"
WITHOUT_DEMO: "False"
DOCKER: "true"
steps:
- name: Create config file
run: |
create_config_file.sh
- name: Wait for PostgreSQL
run: |
wait_for_postgres.sh
- name: Initialize test db
run: |
ADDONS=$(manifestoo -d /odoo/custom list | grep _install | paste -sd,)
unbuffer odoo -d odoo -i $ADDONS --stop-after-init | checklog-odoo -i WARNING
- name: Run tests
run: |
ADDONS=$(manifestoo -d /odoo/custom --separator , list)
unbuffer odoo -d odoo -u $ADDONS --test-enable --stop-after-init | checklog-odoo -i WARNING
migration-test:
runs-on: ubuntu-22.04
needs: [build]
services:
postgres:
image: postgres:13.0
env:
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoo
POSTGRES_DB: odoo
ports:
- 5432:5432
steps:
- name: Set up Docker
uses: docker/setup-docker-action@v4
- name: Prepare env files
run: |
BASE_IMAGE="ghcr.io/${{ github.repository_owner }}/curq-ci:${{ github.base_ref }}"
MODULES=$(docker run --rm $BASE_REF_IMAGE -c "manifestoo -d /odoo/custom list | grep _install | paste -sd,")
cat > .env.base <<EOF
DB_HOST=postgres
DB_PORT=5432
DB_USER=odoo
DB_PASSWORD=odoo
MODULES=$MODULES
WORKERS=0
MODE=InstallOnly
DOCKER=true
DB_NAME=main
DB_FILTER=^main$
EOF
- name: Initialize ${{ github.base_ref }}
run: |
docker run ghcr.io/${{ github.repository_owner }}/curq-ci:${{ github.base_ref }} \
--entrypoint /usr/local/bin/entrypoint.sh \
--env-file .env.base
- name: Test Update
run: |
docker run ghcr.io/${{ github.repository_owner }}/curq-ci:pr-${{ github.event.pull_request.number }} \
--entrypoint /usr/local/bin/entrypoint.sh \
--env-file .env.base \
-e MODE=UpdateOnly