-
Notifications
You must be signed in to change notification settings - Fork 288
95 lines (92 loc) · 3.13 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_target:
branches:
- "17.0"
push:
branches:
- "17.0"
env:
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
CI_PROJECT_NAMESPACE: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
CI_PROJECT_NAME: ${{ github.event.pull_request.head.repo.name || github.event.repository.name }}
jobs:
pre-commit-vauxoo:
runs-on: ubuntu-latest
name: pre-commit-vauxoo
steps:
- uses: actions/checkout@v3
with:
ref: ${{ env.CI_COMMIT_SHA }}
- name: Cache pre-commit and pip packages
id: cache-pre-commit-pip
uses: actions/cache@v3
with:
path: |
~/.cache/pre-commit
~/.cache/pip
key: cache-pre-commit-pip
- name: Install pre-commit-vauxoo
run: pip install --upgrade pre-commit-vauxoo
- name: Run pre-commit-vauxoo
run: pre-commit-vauxoo
no-dependency-files:
runs-on: ubuntu-latest
name: No dependency files
steps:
- uses: actions/checkout@v3
with:
ref: ${{ env.CI_COMMIT_SHA }}
- name: Ensure dependency files don't exist
run: |
for reqfile in requirements.txt oca_dependencies.txt ; do
if [ -f ${reqfile} ] ; then
echo "Please avoid adding requirement files to this repo, because requirements will be installed in all project depending on this one."
echo "If you need them for test to work, you can use test-${reqfile} instead of ${reqfile}"
exit 1
fi
done
build_docker:
runs-on: ubuntu-latest
name: Build Docker and test Odoo
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
steps:
- uses: actions/checkout@v3
with:
ref: ${{ env.CI_COMMIT_SHA }}
persist-credentials: false
- name: Cache pip packages
id: cache-pip-build
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: cache-pip-build
- name: Set ssh keys
run: |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<< "${{ secrets.PRIVATE_DEPLOY_KEY }}"
mkdir -p ~/.ssh/
ssh-keyscan -H git.vauxoo.com >> ~/.ssh/known_hosts
- name: Install dependencies
run: |
pip install -U deployv vxci
sudo apt update
sudo apt install dos2unix
- name: Build image
env:
PRIVATE_DEPLOY_KEY: ${{ secrets.PRIVATE_DEPLOY_KEY }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USER: ${{ secrets.DOCKER_USER }}
ORCHEST_REGISTRY: ${{ secrets.ORCHEST_REGISTRY }}
ORCHEST_TOKEN: ${{ secrets.ORCHEST_TOKEN }}
run: |
source variables.sh
vxci check_keys
vxci build_image --push_image
- name: Test odoo image
run: |
source variables.sh
slugified_branch=$(python -c "from vxci.common import slugify; print(slugify('${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}'))")
source ${slugified_branch}/image_name.env
vxci test_repo --allow_deprecated