Skip to content

Commit d7ac790

Browse files
committed
1 parent 68dad81 commit d7ac790

File tree

18 files changed

+1149
-0
lines changed

18 files changed

+1149
-0
lines changed

.DINAR/config.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
addons:
2+
# modules to install before running tests
3+
include:
4+
- contacts
5+
6+
# modules to exclude from installation/testing
7+
exclude:
8+
- hw_proxy
9+
10+
server_wide_modules:
11+
- web

.DINAR/image/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This folder is attached on image building as `custom/` folder in [doobba](https://github.com/Tecnativa/doodba#image-usage).
2+
Few additional [files](https://github.com/itpp-labs/DINAR/tree/master/embedded-files/.DINAR/image) are attached temporary on image building.

.DINAR/image/dependencies/pip.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Python dependencies

.DINAR/image/src/addons.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# see https://github.com/Tecnativa/doodba#optodoocustomsrcaddonsyaml

.DINAR/image/src/repos.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Documentation: https://github.com/Tecnativa/doodba#optodoocustomsrcreposyaml
2+
3+
# Odoo source.
4+
# Update this section to switch to OCA/OCB or apply custom patches
5+
odoo:
6+
defaults:
7+
depth: 1
8+
remotes:
9+
origin: https://github.com/odoo/odoo.git
10+
target: origin $ODOO_VERSION
11+
merges:
12+
- origin $ODOO_VERSION

.editorconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Configuration for known file extensions
2+
[*.{css,js,json,less,md,py,rst,sass,scss,xml,yaml,yml}]
3+
charset = utf-8
4+
end_of_line = lf
5+
indent_size = 4
6+
indent_style = space
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
10+
[*.{json,yml,yaml,rst,md}]
11+
indent_size = 2
12+
13+
# Do not configure editor for libs and autogenerated content
14+
[{*/static/{lib,src/lib}/**,*/static/description/index.html,*/readme/../README.rst}]
15+
charset = unset
16+
end_of_line = unset
17+
indent_size = unset
18+
indent_style = unset
19+
insert_final_newline = false
20+
trim_trailing_whitespace = false

.eslintrc.yml

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
env:
2+
browser: true
3+
4+
# See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449
5+
parserOptions:
6+
ecmaVersion: 2017
7+
8+
# Globals available in Odoo that shouldn't produce errorings
9+
globals:
10+
_: readonly
11+
$: readonly
12+
fuzzy: readonly
13+
jQuery: readonly
14+
moment: readonly
15+
odoo: readonly
16+
openerp: readonly
17+
Promise: readonly
18+
owl: readonly
19+
20+
# Styling is handled by Prettier, so we only need to enable AST rules;
21+
# see https://github.com/OCA/maintainer-quality-tools/pull/618#issuecomment-558576890
22+
rules:
23+
accessor-pairs: warn
24+
array-callback-return: warn
25+
callback-return: warn
26+
capitalized-comments:
27+
- warn
28+
- always
29+
- ignoreConsecutiveComments: true
30+
ignoreInlineComments: true
31+
complexity:
32+
- warn
33+
- 15
34+
constructor-super: warn
35+
dot-notation: warn
36+
eqeqeq: warn
37+
global-require: warn
38+
handle-callback-err: warn
39+
id-blacklist: warn
40+
id-match: warn
41+
init-declarations: error
42+
max-depth: warn
43+
max-nested-callbacks: warn
44+
max-statements-per-line: warn
45+
no-alert: warn
46+
no-array-constructor: warn
47+
no-caller: warn
48+
no-case-declarations: warn
49+
no-class-assign: warn
50+
no-cond-assign: error
51+
no-const-assign: error
52+
no-constant-condition: warn
53+
no-control-regex: warn
54+
no-debugger: error
55+
no-delete-var: warn
56+
no-div-regex: warn
57+
no-dupe-args: error
58+
no-dupe-class-members: error
59+
no-dupe-keys: error
60+
no-duplicate-case: error
61+
no-duplicate-imports: error
62+
no-else-return: warn
63+
no-empty-character-class: warn
64+
no-empty-function: error
65+
no-empty-pattern: error
66+
no-empty: warn
67+
no-eq-null: error
68+
no-eval: error
69+
no-ex-assign: error
70+
no-extend-native: warn
71+
no-extra-bind: warn
72+
no-extra-boolean-cast: warn
73+
no-extra-label: warn
74+
no-fallthrough: warn
75+
no-func-assign: error
76+
no-global-assign: error
77+
no-implicit-coercion:
78+
- warn
79+
- allow: ["~"]
80+
no-implicit-globals: warn
81+
no-implied-eval: warn
82+
no-inline-comments: warn
83+
no-inner-declarations: warn
84+
no-invalid-regexp: warn
85+
no-irregular-whitespace: warn
86+
no-iterator: warn
87+
no-label-var: warn
88+
no-labels: warn
89+
no-lone-blocks: warn
90+
no-lonely-if: error
91+
no-mixed-requires: error
92+
no-multi-str: warn
93+
no-native-reassign: error
94+
no-negated-condition: warn
95+
no-negated-in-lhs: error
96+
no-new-func: warn
97+
no-new-object: warn
98+
no-new-require: warn
99+
no-new-symbol: warn
100+
no-new-wrappers: warn
101+
no-new: warn
102+
no-obj-calls: warn
103+
no-octal-escape: warn
104+
no-octal: warn
105+
no-param-reassign: off
106+
no-path-concat: warn
107+
no-process-env: warn
108+
no-process-exit: warn
109+
no-proto: warn
110+
no-prototype-builtins: warn
111+
no-redeclare: warn
112+
no-regex-spaces: warn
113+
no-restricted-globals: warn
114+
no-restricted-imports: warn
115+
no-restricted-modules: warn
116+
no-restricted-syntax: warn
117+
no-return-assign: error
118+
no-script-url: warn
119+
no-self-assign: warn
120+
no-self-compare: warn
121+
no-sequences: warn
122+
no-shadow-restricted-names: warn
123+
no-shadow: warn
124+
no-sparse-arrays: warn
125+
no-sync: warn
126+
no-this-before-super: warn
127+
no-throw-literal: warn
128+
no-undef-init: warn
129+
no-undef: error
130+
no-unmodified-loop-condition: warn
131+
no-unneeded-ternary: error
132+
no-unreachable: error
133+
no-unsafe-finally: error
134+
no-unused-expressions: error
135+
no-unused-labels: error
136+
no-unused-vars:
137+
- error
138+
- args: none
139+
no-use-before-define: error
140+
no-useless-call: warn
141+
no-useless-computed-key: warn
142+
no-useless-concat: warn
143+
no-useless-constructor: warn
144+
no-useless-escape: warn
145+
no-useless-rename: warn
146+
no-void: warn
147+
no-with: warn
148+
operator-assignment: [error, always]
149+
prefer-const: warn
150+
radix: warn
151+
require-yield: warn
152+
sort-imports: warn
153+
spaced-comment: [error, always]
154+
space-before-function-paren: ["warn", {"anonymous": "always", "named": "never"}]
155+
strict: [error, function]
156+
use-isnan: error
157+
valid-jsdoc:
158+
- warn
159+
- prefer:
160+
arg: param
161+
argument: param
162+
augments: extends
163+
constructor: class
164+
exception: throws
165+
func: function
166+
method: function
167+
prop: property
168+
return: returns
169+
virtual: abstract
170+
yield: yields
171+
preferType:
172+
array: Array
173+
bool: Boolean
174+
boolean: Boolean
175+
number: Number
176+
object: Object
177+
str: String
178+
string: String
179+
requireParamDescription: false
180+
requireReturn: false
181+
requireReturnDescription: false
182+
requireReturnType: false
183+
valid-typeof: warn
184+
yoda: warn

.flake8

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[flake8]
2+
max-line-length = 80
3+
max-complexity = 16
4+
# B = bugbear
5+
# B9 = bugbear opinionated (incl line length)
6+
select = C,E,F,W,B,B9
7+
# E203: whitespace before ':' (black behaviour)
8+
# E501: flake8 line length (covered by bugbear B950)
9+
# W503: line break before binary operator (black behaviour)
10+
# C901: "method is too complex" -- it's too complex to fix existing modules. Disable for now
11+
ignore = E203,E501,W503,B950,C901

.github/workflows/DINAR-PORT.yml

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Copyright 2020 IT Projects Labs
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
name: "Port module"
15+
16+
on:
17+
issues:
18+
types:
19+
- opened
20+
- reopened
21+
22+
jobs:
23+
port:
24+
runs-on: ubuntu-latest
25+
if: "startsWith(github.event.issue.title, 'DINAR-PORT ')"
26+
steps:
27+
- name: Post link
28+
uses: KeisukeYamashita/create-comment@v1
29+
with:
30+
comment:
31+
"Porting is started. Check logs: https://github.com/${{ github.repository
32+
}}/actions/runs/${{ github.run_id }}"
33+
- name: Checkout DINAR
34+
uses: actions/checkout@v2
35+
with:
36+
path: DINAR
37+
repository: itpp-labs/DINAR-fork
38+
ref: master
39+
- uses: actions/setup-python@v2
40+
with:
41+
python-version: "3.7.x"
42+
- name: Install python tools
43+
run: |
44+
pip install plumbum pre-commit git-aggregator
45+
- name: Check Python Version
46+
run:
47+
echo "PY=$(python --version --version | sha256sum | cut -d' ' -f1)" >>
48+
$GITHUB_ENV
49+
- name: Analyze request
50+
env:
51+
TITLE: ${{ github.event.issue.title }}
52+
run: |
53+
# sets environment variables that available in next steps via $ {{ env.PORT_... }} notation
54+
python DINAR/workflow-files/analyze_port_trigger.py "$TITLE"
55+
- name: Checkout Repo
56+
uses: actions/checkout@v2
57+
with:
58+
path: REPO
59+
fetch-depth: 0
60+
ref: ${{ env.PORT_TO_BRANCH }}
61+
- uses: actions/cache@v1
62+
with:
63+
path: ~/.cache/pre-commit
64+
key: pre-commit|${{ env.PY }}|${{ hashFiles('REPO/.pre-commit-config.yaml') }}
65+
- name: Copy module to new branch
66+
run: |
67+
git config --global user.email "[email protected]"
68+
git config --global user.name "Mitchell Admin"
69+
cd REPO
70+
if [ ! -d ${{ env.PORT_MODULE }} ]
71+
then
72+
# apply original commit history
73+
if ! git format-patch --keep-subject --stdout origin/${{ env.PORT_TO_BRANCH }}..origin/${{ env.PORT_FROM_BRANCH }} -- ${{ env.PORT_MODULE }} | git am -3 --keep
74+
then
75+
# git am failed
76+
git am --abort
77+
fi
78+
fi
79+
if [ ! -d ${{ env.PORT_MODULE }} ]
80+
then
81+
# just copy source
82+
git checkout origin/${{ env.PORT_FROM_BRANCH }} -- ${{ env.PORT_MODULE }}
83+
git commit -m ":tada:${{ env.PORT_FROM_BRANCH_TAGS }} ${{ env.PORT_MODULE }}
84+
previous commits history: https://github.com/${{ github.repository }}/commits/${{ env.PORT_FROM_BRANCH }}/${{ env.PORT_MODULE }}
85+
> Made via .github/workflows/DINAR-PORT.yml"
86+
fi
87+
- name: make OCA/odoo-module-migrator
88+
run: |
89+
gitaggregate -c DINAR/workflow-files/odoo-module-migrator-mix.yml
90+
pip install -e ./odoo-module-migrator
91+
- name: apply OCA/odoo-module-migrator
92+
run: |
93+
LOG_FILE=../odoo-module-migrator.logs
94+
cd REPO
95+
odoo-module-migrate \
96+
--modules ${{ env.PORT_MODULE }} \
97+
--init-version-name ${{ env.PORT_FROM_BRANCH }} \
98+
--target-version-name ${{ env.PORT_TO_BRANCH }} \
99+
--no-commit \
100+
--no-pre-commit \
101+
2> $LOG_FILE || true
102+
cat $LOG_FILE
103+
104+
# remove colors
105+
sed -r -i "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g" $LOG_FILE
106+
# escape character
107+
# TODO: update KeisukeYamashita/create-comment to support reading comment's body from file
108+
echo 'MIGRATOR_LOGS<<EOF' >> $GITHUB_ENV
109+
cat $LOG_FILE >> $GITHUB_ENV
110+
echo 'EOF' >> $GITHUB_ENV
111+
112+
git add -A
113+
git commit -m ":arrow_up:${{ env.PORT_TO_BRANCH_TAGS }} OCA/odoo-module-migrator
114+
115+
close #${{ github.event.issue.number }}
116+
117+
> Made via .github/workflows/DINAR-PORT.yml"
118+
- name: pre-commit
119+
run: |
120+
cd REPO
121+
pre-commit run --files $(find ${{ env.PORT_MODULE }} -type f) || true
122+
git add -A
123+
git commit -m ":rainbow: pre-commit
124+
> Made via .github/workflows/DINAR-PORT.yml" || echo "pre-commit: no changes"
125+
- name: PR
126+
uses: peter-evans/create-pull-request@v3
127+
id: cpr
128+
with:
129+
path: REPO
130+
# GITHUB_TOKEN would not trigger PR checks
131+
token: ${{ secrets.DINAR_TOKEN }}
132+
branch: ${{ env.PORT_TO_BRANCH }}-${{ env.PORT_MODULE }}
133+
title: "[${{ env.PORT_TO_BRANCH }}] ${{ env.PORT_MODULE }}"
134+
body: |
135+
Made by [DINAR](https://github.com/itpp-labs/DINAR#readme) by request in #${{ github.event.issue.number }}
136+
- name: Post logs
137+
uses: KeisukeYamashita/create-comment@v1
138+
with:
139+
number: ${{ steps.cpr.outputs.pull-request-number }}
140+
comment: |
141+
[Migrator](https://github.com/OCA/odoo-module-migrator/)'s [logs](https://github.com/${{ github.repository
142+
}}/actions/runs/${{ github.run_id }}):
143+
144+
```
145+
${{ env.MIGRATOR_LOGS }}
146+
```

0 commit comments

Comments
 (0)