Skip to content

Commit

Permalink
[UPD] Repo template
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-pelykh committed Jan 26, 2024
1 parent c39b3aa commit a4db05a
Show file tree
Hide file tree
Showing 29 changed files with 809 additions and 310 deletions.
23 changes: 23 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Do NOT update manually; changes here will be overwritten by Copier
_commit: v1.20
_src_path: git+https://github.com/oca/oca-addons-repo-template
ci: GitHub
convert_readme_fragments_to_markdown: false
generate_requirements_txt: true
github_check_license: true
github_ci_extra_env: {}
github_enable_codecov: true
github_enable_makepot: true
github_enable_stale_action: true
github_enforce_dev_status_compatibility: true
include_wkhtmltopdf: false
odoo_test_flavor: Both
odoo_version: 12.0
org_name: Odoo Community Association (OCA)
org_slug: OCA
rebel_module_groups: []
repo_description: This project includes modules that handle payment related tasks
repo_name: Odoo account payment modules
repo_slug: account-payment
repo_website: https://github.com/OCA/account-payment

4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[.eslintrc,*.{json,yml,yaml,rst,md}]
[*.{json,yml,yaml,rst,md}]
indent_size = 2

# Do not configure editor for libs and autogenerated content
[*/static/{lib,src/lib}/**,*/static/description/index.html,*/readme/../README.rst]
[{*/static/{lib,src/lib}/**,*/static/description/index.html,*/readme/../README.rst}]
charset = unset
end_of_line = unset
indent_size = unset
Expand Down
11 changes: 11 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[flake8]
# E123,E133,E226,E241,E242 are ignored by default by pep8 and flake8
# F811 is legal in odoo 8 when we implement 2 interfaces for a method
# F601 pylint support this case with expected tests
# W503 changed by W504 and OCA prefers allow both
# E203: whitespace before ':' (black behaviour and not pep8 compliant)
ignore = E123,E133,E226,E241,E242,F811,F601,W503,W504,E203
max-line-length = 88
per-file-ignores=
__init__.py:F401

46 changes: 46 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: pre-commit

on:
pull_request:
branches:
- "12.0*"
push:
branches:
- "12.0"
- "12.0-ocabot-*"

jobs:
pre-commit:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
with:
python-version: "3.6"
- name: Get python version
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files --show-diff-on-failure --color=always
env:
# Consider valid a PR that changes README fragments but doesn't
# change the README.rst file itself. It's not really a problem
# because the bot will update it anyway after merge. This way, we
# lower the barrier for functional contributors that want to fix the
# readme fragments, while still letting developers get README
# auto-generated (which also helps functionals when using runboat).
# DOCS https://pre-commit.com/#temporarily-disabling-hooks
SKIP: oca-gen-addon-readme
- name: Check that all files generated by pre-commit are in git
run: |
newfiles="$(git ls-files --others --exclude-from=.gitignore)"
if [ "$newfiles" != "" ] ; then
echo "Please check-in the following files:"
echo "$newfiles"
exit 1
fi
69 changes: 69 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Mark stale issues and pull requests

on:
schedule:
- cron: "0 12 * * 0"

jobs:
stale:
runs-on: ubuntu-latest
steps:
- name: Stale PRs and issues policy
uses: actions/stale@v4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# General settings.
ascending: true
remove-stale-when-updated: true
# Pull Requests settings.
# 120+30 day stale policy for PRs
# * Except PRs marked as "no stale"
days-before-pr-stale: 120
days-before-pr-close: 30
exempt-pr-labels: "no stale"
stale-pr-label: "stale"
stale-pr-message: >
There hasn't been any activity on this pull request in the past 4 months, so
it has been marked as stale and it will be closed automatically if no
further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply
the "no stale" label.
# Issues settings.
# 180+30 day stale policy for open issues
# * Except Issues marked as "no stale"
days-before-issue-stale: 180
days-before-issue-close: 30
exempt-issue-labels: "no stale,needs more information"
stale-issue-label: "stale"
stale-issue-message: >
There hasn't been any activity on this issue in the past 6 months, so it has
been marked as stale and it will be closed automatically if no further
activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to
apply the "no stale" label.
# 15+30 day stale policy for issues pending more information
# * Issues that are pending more information
# * Except Issues marked as "no stale"
- name: Needs more information stale issues policy
uses: actions/stale@v4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
ascending: true
only-labels: "needs more information"
exempt-issue-labels: "no stale"
days-before-stale: 15
days-before-close: 30
days-before-pr-stale: -1
days-before-pr-close: -1
remove-stale-when-updated: true
stale-issue-label: "stale"
stale-issue-message: >
This issue needs more information and there hasn't been any activity
recently, so it has been marked as stale and it will be closed automatically
if no further activity occurs in the next 30 days.
If you think this is a mistake, please ask a PSC member to remove the "needs
more information" label.
69 changes: 69 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: tests

on:
pull_request:
branches:
- "12.0*"
push:
branches:
- "12.0"
- "12.0-ocabot-*"

jobs:
unreleased-deps:
runs-on: ubuntu-latest
name: Detect unreleased dependencies
steps:
- uses: actions/checkout@v3
- run: |
for reqfile in requirements.txt test-requirements.txt ; do
if [ -f ${reqfile} ] ; then
result=0
# reject non-comment lines that contain a / (i.e. URLs, relative paths)
grep "^[^#].*/" ${reqfile} || result=$?
if [ $result -eq 0 ] ; then
echo "Unreleased dependencies found in ${reqfile}."
exit 1
fi
fi
done
test:
runs-on: ubuntu-20.04
container: ${{ matrix.container }}
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- container: ghcr.io/oca/oca-ci/py3.6-odoo12.0:latest
name: test with Odoo
- container: ghcr.io/oca/oca-ci/py3.6-ocb12.0:latest
name: test with OCB
makepot: "true"
services:
postgres:
image: postgres:9.6
env:
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoo
POSTGRES_DB: odoo
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Install addons and dependencies
run: oca_install_addons
- name: Check licenses
run: manifestoo -d . check-licenses
- name: Check development status
run: manifestoo -d . check-dev-status --default-dev-status=Beta
- name: Initialize test db
run: oca_init_test_database
- name: Run tests
run: oca_run_tests
- uses: codecov/codecov-action@v1
- name: Update .pot files
run: oca_export_and_push_pot https://x-access-token:${{ secrets.GIT_PUSH_TOKEN }}@github.com/${{ github.repository }}
if: ${{ matrix.makepot == 'true' && github.event_name == 'push' && github.repository_owner == 'OCA' }}
20 changes: 19 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
/.venv
/.pytest_cache
/.ruff_cache

# C extensions
*.so
Expand All @@ -13,7 +16,6 @@ build/
develop-eggs/
dist/
eggs/
lib/
lib64/
parts/
sdist/
Expand Down Expand Up @@ -41,6 +43,19 @@ coverage.xml
# Pycharm
.idea

# Eclipse
.settings

# Visual Studio cache/options directory
.vs/
.vscode

# OSX Files
.DS_Store

# Django stuff:
*.log

# Mr Developer
.mr.developer.cfg
.project
Expand All @@ -55,3 +70,6 @@ docs/_build/
# Backup files
*~
*.swp

# OCA rules
!static/lib/
2 changes: 2 additions & 0 deletions .oca_hooks.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[MESSAGES_CONTROL]
disable=xml-deprecated-data-node,xml-deprecated-tree-attribute
59 changes: 59 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
exclude: |
(?x)
# NOT INSTALLABLE ADDONS
# END NOT INSTALLABLE ADDONS
# Files and folders generated by bots, to avoid loops
^setup/|/static/description/index\.html$|
# We don't want to mess with tool-generated files
.svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/|
# Maybe reactivate this when all README files include prettier ignore tags?
^README\.md$|
# Library files can have extraneous formatting (even minimized)
/static/(src/)?lib/|
# Repos using Sphinx to generate docs don't need prettying
^docs/_templates/.*\.html$|
# You don't usually want a bot to modify your legal texts
(LICENSE.*|COPYING.*)
default_language_version:
python: python3.6
repos:
- repo: https://github.com/oca/maintainer-tools
rev: ab1d7f6
hooks:
# update the NOT INSTALLABLE ADDONS section above
- id: oca-update-pre-commit-excluded-addons
- id: oca-fix-manifest-website
args: ["https://github.com/OCA/account-payment"]
- repo: https://github.com/acsone/setuptools-odoo
rev: 3.1.8
hooks:
- id: setuptools-odoo-make-default
- id: setuptools-odoo-get-requirements
args:
- --output
- requirements.txt
- --header
- "# generated from manifests external_dependencies"
- repo: https://github.com/OCA/mirrors-flake8
rev: v3.4.1
hooks:
- id: flake8
name: flake8 excluding __init__.py
exclude: __init__\.py
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.5.3
hooks:
- id: pylint
name: pylint with optional checks
args:
- --rcfile=.pylintrc
- --exit-zero
verbose: true
additional_dependencies: &pylint_deps
- pylint-odoo==3.5.0
- id: pylint
name: pylint with mandatory checks
args:
- --rcfile=.pylintrc-mandatory
additional_dependencies: *pylint_deps

Loading

0 comments on commit a4db05a

Please sign in to comment.