-
Notifications
You must be signed in to change notification settings - Fork 313
85 lines (82 loc) · 2.57 KB
/
ci.yaml
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
name: ci
on:
pull_request:
push:
branches:
- master
schedule:
# See https://crontab.guru/weekly
- cron: 0 0 * * 0
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- name: Set PY
run:
echo "PY=$(python -c 'import hashlib,
sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')"
>> $GITHUB_ENV
- uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- uses: pre-commit/[email protected]
build-test-push:
runs-on: ubuntu-latest
needs: pre-commit
strategy:
fail-fast: false
matrix:
# Test modern Odoo versions with latest Postgres version
pg_version: ["12"]
odoo_version:
- "14.0"
- "13.0"
- "12.0"
- "11.0"
- "10.0"
# Test older Odoo versions with older Postgres versions
include:
- odoo_version: "9.0"
pg_version: "11"
- odoo_version: "8.0"
pg_version: "10"
- odoo_version: "7.0"
pg_version: "9.6"
env:
# Indicates what's the equivalent to tecnativa/doodba:latest image
LATEST_RELEASE: "14.0"
# Variables found by default in Docker Hub builder
DOCKER_REPO: tecnativa/doodba
DOCKER_TAG: ${{ matrix.odoo_version }}
GIT_SHA1: ${{ github.sha }}
# Other variables to configure tests and execution environment
DOCKER_BUILDKIT: 1
PG_VERSIONS: ${{ matrix.pg_version }}
steps:
# Prepare
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- run: pip install -r requirements-ci.txt
# Build images
- run: ./hooks/build
# Test
- run: python -m unittest -v tests
# Push
- name: push to docker hub
if: github.repository == 'Tecnativa/doodba' && github.ref == 'refs/heads/master'
env:
REGISTRY_HOST: docker.io
REGISTRY_PASSWORD: ${{ secrets.dockerhub_password }}
REGISTRY_USERNAME: ${{ secrets.dockerhub_username }}
run: ./hooks/push
- name: push to github registry
if: github.repository == 'Tecnativa/doodba' && github.ref == 'refs/heads/master'
env:
DOCKER_REPO_SUFFIX: /doodba
REGISTRY_HOST: docker.pkg.github.com
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
REGISTRY_USERNAME: ${{ github.actor }}
run: ./hooks/push