Skip to content

Commit

Permalink
Doodba copier template is born 👶
Browse files Browse the repository at this point in the history
Basically I'm replacing doodba-scaffolding. The README explains the important changes.

@Tecnativa TT20357
  • Loading branch information
Jairo Llopis authored and github-actions[bot] committed Mar 6, 2020
1 parent e6f8e81 commit e65754c
Show file tree
Hide file tree
Showing 396 changed files with 14,790 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .copier-answers.yml.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Changes here will be overwritten by Copier
{{ _copier_answers|to_nice_yaml }}
1 change: 1 addition & 0 deletions .docker/db-access.env.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PGPASSWORD={{ postgres_password }}
1 change: 1 addition & 0 deletions .docker/db-creation.env.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
POSTGRES_PASSWORD={{ postgres_password }}
1 change: 1 addition & 0 deletions .docker/odoo.env.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ADMIN_PASSWORD={{ odoo_admin_password }}
8 changes: 8 additions & 0 deletions .docker/{% if backup_dst %}backup.env{% endif %}.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#jinja2: lstrip_blocks: "true", trim_blocks: "true"
{%- if backup_aws_access_key_id %}
AWS_ACCESS_KEY_ID={{ backup_aws_access_key_id }}
{%- endif %}
{%- if backup_aws_secret_access_key %}
AWS_SECRET_ACCESS_KEY={{ backup_aws_secret_access_key }}
{%- endif %}
PASSPHRASE={{ backup_passphrase }}
1 change: 1 addition & 0 deletions .docker/{% if smtp_relay_host %}smtp.env{% endif %}.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
RELAY_PASSWORD={{ smtp_relay_password }}
46 changes: 46 additions & 0 deletions .env.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Odoo
ODOO_MAJOR={{ "%.0f"|format(odoo_version) }}
ODOO_MINOR={{ "%.1f"|format(odoo_version) }}
INITIAL_LANG={{ odoo_initial_lang }}
{%- if odoo_oci_image %}
ODOO_IMAGE={{ odoo_oci_image }}
{%- endif %}
ODOO_PROXY_MODE={{ (odoo_proxy is not none)|string|lower }}

# Domains
DOMAIN_TEST={{ domain_test or "" }}
DOMAIN_PROD={{ domain_prod or "" }}
{%- if domain_prod_alternatives %}
{%- for domain in domain_prod_alternatives %}
DOMAIN_PROD_ALT_{{ loop.index0 }}={{ domain }}
{%- endfor %}
{%- endif %}

# Database
DB_VERSION={{ postgres_version }}
DB_USER={{ postgres_username }}
DB_FILTER={{ odoo_dbfilter }}

# Real SMTP relay
SMTP_DEFAULT_FROM={{ smtp_default_from or "" }}
{%- if smtp_relay_host %}
SMTP_REAL_MAILNAME={{ smtp_canonical_default }}
SMTP_REAL_RELAY_HOST={{ smtp_relay_host }}
SMTP_REAL_RELAY_PORT={{ smtp_relay_port }}
SMTP_REAL_RELAY_USER={{ smtp_relay_user }}
SMTP_REAL_CANONICAL_DOMAINS={{
([smtp_canonical_default] + (smtp_canonical_domains or []))
|unique|sort|join(",")
}}
SMTP_REAL_NON_CANONICAL_DEFAULT={{ smtp_canonical_default }}
{%- endif %}
{%- if backup_dst %}

# Backup
BACKUP_DST={{ backup_dst }}
{%- if smtp_relay_host %}
BACKUP_EMAIL_FROM={{ backup_email_from }}
BACKUP_EMAIL_TO={{ backup_email_to }}
{%- endif %}
BACKUP_TZ={{ backup_tz }}
{%- endif %}
1 change: 1 addition & 0 deletions .eslintrc.yml.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{%- include "vendor/maintainer-quality-tools/sample_files/pre-commit-13.0/.eslintrc.yml" -%}
1 change: 1 addition & 0 deletions .flake8.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{%- include "vendor/maintainer-quality-tools/sample_files/pre-commit-13.0/.flake8" -%}
28 changes: 28 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: automerge
on:
pull_request:
types:
- edited
- labeled
- opened
- ready_for_review
- reopened
- synchronize
- unlabeled
- unlocked
pull_request_review:
types:
- submitted
status: {}
jobs:
automerge:
runs-on: ubuntu-latest
steps:
- name: automerge
uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_DELETE_BRANCH: "true"
MERGE_LABELS: "automerge,!work in progress"
MERGE_METHOD: "rebase"
UPDATE_METHOD: "rebase"
31 changes: 31 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: lint

on:
pull_request:
push:
branches: [master]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install python
uses: actions/setup-python@v1
- name: Generate cache key PY
run:
echo "::set-env name=PY::$(python --version --version | sha256sum | cut -d' '
-f1)"
- uses: actions/cache@v1
with:
path: .venv
key: venv|${{ env.PY }}|${{ hashFiles('poetry.lock') }}
- uses: actions/cache@v1
with:
path: ~/.cache
key:
pre-commit|${{ env.PY }}|${{ hashFiles('poetry.lock') }}|${{
hashFiles('.pre-commit-config.yaml') }}
- run: pip install invoke poetry
- run: invoke develop
- run: invoke lint
48 changes: 48 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: test

on:
pull_request:
push:
branches: [master]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- 3.6
- 3.7
- 3.8
steps:
- uses: actions/checkout@v1
- name: Install Docker
uses: docker-practice/[email protected]
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Generate cache key PY for python ${{ matrix.python-version }}
run:
echo "::set-env name=PY::$(python --version --version | sha256sum | cut -d' '
-f1)"
- uses: actions/cache@v1
with:
path: .venv
key: venv|${{ env.PY }}|${{ hashFiles('poetry.lock') }}
- uses: actions/cache@v1
with:
path: ~/.cache
key:
pre-commit|${{ env.PY }}|${{ hashFiles('poetry.lock') }}|${{
hashFiles('.pre-commit-config.yaml') }}
- run: git config --global user.name CI
- run: git config --global user.email CI@GITHUB
- run: pip install invoke poetry
- run: invoke develop
# Precreate shared networks to avoid race conditions
- run: docker network create inverseproxy_shared
- run: docker network create globalwhitelist_shared
- run: invoke test --verbose
env:
QA_TEST: 1
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Ignore all src directories except private and files with a dot
/odoo/auto
/odoo/custom/src/.git/..

# Ignore docker-compose.yml by default, to allow easy defaults per clone
/docker-compose.yml

# Compiled formats, cache, temporary files, git garbage
**.~
**.mo
**.py[co]
**.egg-info
**.orig
**.rej

# User-specific or editor-specific development files and settings
/.venv
/doodba.*.code-workspace
/src

# Project-specific docker configurations
/.docker/*.env
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "vendor/maintainer-quality-tools"]
path = vendor/maintainer-quality-tools
url = https://github.com/OCA/maintainer-quality-tools.git
branch = master
1 change: 1 addition & 0 deletions .isort.cfg.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{%- include "vendor/maintainer-quality-tools/sample_files/pre-commit-13.0/.isort.cfg" -%}
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/asottile/pyupgrade
rev: v2.0.1
rev: v2.1.0
hooks:
- id: pyupgrade
- repo: https://github.com/timothycrosley/isort
Expand Down
90 changes: 90 additions & 0 deletions .pre-commit-config.yaml.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{# We cannot use the same pre-commit config as MQT's because paths don't match
and it's designed only for Odoo 13.0+, so we design our own version, which
should be as close as possible to MQT's -#}
exclude: |
(?x)
# Files and folders generated by bots, to avoid loops
|/static/description/index\.html$|
# Library files can have extraneous formatting (even minimized)
/static/(src/)?lib/|
# You don't usually want a bot to modify your legal texts
(LICENSE.*|COPYING.*)
default_language_version:
python: python3
repos:
- repo: https://github.com/psf/black
rev: 19.10b0
hooks:
- id: black
- repo: https://github.com/prettier/prettier
rev: "1.19.1"
hooks:
- id: prettier
# TODO Avoid awebdeveloper/pre-commit-prettier if possible
# HACK https://github.com/prettier/prettier/issues/7407
- repo: https://github.com/awebdeveloper/pre-commit-prettier
rev: v0.0.1
hooks:
- id: prettier
name: prettier xml plugin
additional_dependencies:
- "[email protected]"
- "@prettier/[email protected]"
files: \.xml$
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v6.8.0
hooks:
- id: eslint
verbose: true
args:
- --color
- --fix
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: debug-statements
- id: flake8
name: flake8 except __init__.py
exclude: /__init__\.py$
additional_dependencies: ["flake8-bugbear==19.8.0"]
- id: flake8
name: flake8 only __init__.py
args: ["--extend-ignore=F401"] # ignore unused imports in __init__.py
files: /__init__\.py$
additional_dependencies: ["flake8-bugbear==19.8.0"]
- id: fix-encoding-pragma
{%- if odoo_version >= 11 %}
args: ["--remove"]
{%- endif %}
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: check-xml
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.4.4
hooks:
- id: pylint
name: pylint with optional checks
args: ["--rcfile=.pylintrc", "--exit-zero"]
verbose: true
additional_dependencies: ["pylint-odoo==3.1.0"]
- id: pylint
name: pylint with mandatory checks
args: ["--rcfile=.pylintrc-mandatory"]
additional_dependencies: ["pylint-odoo==3.1.0"]
- repo: https://github.com/asottile/pyupgrade
rev: v1.26.2
hooks:
- id: pyupgrade
- repo: https://github.com/timothycrosley/isort
rev: 4.3.21
hooks:
- id: isort
name: isort except __init__.py
exclude: /__init__\.py$
1 change: 1 addition & 0 deletions .prettierrc.yml.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{%- include "vendor/maintainer-quality-tools/sample_files/pre-commit-13.0/.prettierrc.yml" -%}
1 change: 1 addition & 0 deletions .pylintrc-mandatory.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{%- include "vendor/maintainer-quality-tools/sample_files/pre-commit-13.0/.pylintrc-mandatory" -%}
1 change: 1 addition & 0 deletions .pylintrc.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{%- include "vendor/maintainer-quality-tools/sample_files/pre-commit-13.0/.pylintrc" -%}
20 changes: 20 additions & 0 deletions .vscode/doodba.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// See spec in https://code.visualstudio.com/docs/editor/userdefinedsnippets
{
// See https://github.com/Tecnativa/doodba#optodoocustomsrcreposyaml
"Git aggregator repo": {
"prefix": "repo",
"scope": "yaml",
"body": [
"${10:repo-name}:",
"\tdefaults:",
"\t\tdepth: \\$DEPTH_MERGE",
"\tremotes:",
"\t\t${40:origin}: ${30:https://github.com/${20:OCA}/${10}.git}",
"\ttarget: ${40} \\$ODOO_VERSION",
"\tmerges:",
"\t\t- ${40} \\$ODOO_VERSION",
"\t\t- ${40} refs/pull/${50:1234}/head"
],
"description": "Git-aggregator repo definition with merges"
}
}
14 changes: 14 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"dchanco.vsc-invoke",
"EditorConfig.editorconfig",
"esbenp.prettier-vscode",
"mrorz.language-gettext",
"ms-azuretools.vscode-docker",
"ms-python.python",
"qub.qub-xml-vscode",
"samuelcolvin.jinjahtml",
"syler.sass-indented"
]
}
25 changes: 25 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
// More info on this file: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: pytest",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/.venv/bin/pytest",
"args": ["tests"],
"console": "integratedTerminal",
"subProcess": true
},
{
"name": "Python: pytest verbose",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/.venv/bin/pytest",
"args": ["-vv", "tests"],
"console": "integratedTerminal",
"justMyCode": false,
"subProcess": true
}
]
}
Loading

0 comments on commit e65754c

Please sign in to comment.