From 68f43322fdc57063422fe3b628e4ba9e463b068f Mon Sep 17 00:00:00 2001 From: David Beal Date: Tue, 29 Nov 2022 21:33:26 +0100 Subject: [PATCH 1/2] UPD copier --- .copier-answers.yml | 21 ++++++--- .eslintrc.yml | 11 ++++- .flake8 | 2 +- .github/workflows/pre-commit.yml | 26 ++++++++--- .github/workflows/stale.yml | 69 +++++++++++++++++++++++++++++ .github/workflows/test.yml | 75 ++++++++++++++++++++++---------- .gitignore | 1 - .isort.cfg | 1 + .pre-commit-config.yaml | 29 ++++++------ .pylintrc | 2 + .pylintrc-mandatory | 1 + README.md | 35 +++++++++++++++ oca_dependencies.txt | 3 -- 13 files changed, 222 insertions(+), 54 deletions(-) create mode 100644 .github/workflows/stale.yml create mode 100644 README.md delete mode 100644 oca_dependencies.txt diff --git a/.copier-answers.yml b/.copier-answers.yml index 043c0bd..0a44841 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,16 +1,23 @@ # Do NOT update manually; changes here will be overwritten by Copier -_commit: v1.1.1 -_src_path: https://github.com/akretion/akretion-addons-repo-template.git -black_version: 20.8b1 +_commit: v1.11.1 +_src_path: https://github.com/oca/oca-addons-repo-template.git +ci: GitHub dependency_installation_mode: PIP generate_requirements_txt: true +github_check_license: true +github_enable_codecov: true +github_enable_makepot: true +github_enable_stale_action: true +github_enforce_dev_status_compatibility: true include_wkhtmltopdf: false -odoo_version: '14.0' -prettify_xml: true -python_line_length: 88 +odoo_version: 14 +org_name: Akretion +org_slug: akretion rebel_module_groups: [] -repo_description: Support +repo_description: Support ticket management dealing 2 odoo instance repo_name: Support repo_slug: support +repo_website: https://github.com/akretion/support travis_apt_packages: [] travis_apt_sources: [] + diff --git a/.eslintrc.yml b/.eslintrc.yml index 88f2881..9429bc6 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,9 +1,16 @@ env: browser: true + es6: true # See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449 parserOptions: - ecmaVersion: 2017 + ecmaVersion: 2019 + +overrides: + - files: + - "**/*.esm.js" + parserOptions: + sourceType: module # Globals available in Odoo that shouldn't produce errorings globals: @@ -14,7 +21,7 @@ globals: moment: readonly odoo: readonly openerp: readonly - Promise: readonly + owl: readonly # Styling is handled by Prettier, so we only need to enable AST rules; # see https://github.com/OCA/maintainer-quality-tools/pull/618#issuecomment-558576890 diff --git a/.flake8 b/.flake8 index 1edd1cd..e397e8e 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,5 @@ [flake8] -max-line-length = 89 +max-line-length = 88 max-complexity = 16 # B = bugbear # B9 = bugbear opinionated (incl line length) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index de5990e..ecc3eb1 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -2,9 +2,12 @@ name: pre-commit on: pull_request: + branches: + - "14*" push: branches: - - "14.0" + - "14" + - "14-ocabot-*" jobs: pre-commit: @@ -12,8 +15,21 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 + - name: Get python version + run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV + - uses: actions/cache@v1 with: - # The pylint-odoo version we use here does not support python 3.10 - # https://github.com/OCA/oca-addons-repo-template/issues/80 - python-version: "3.9" - - uses: pre-commit/action@v2.0.0 + 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 + - 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 diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..1693a12 --- /dev/null +++ b/.github/workflows/stale.yml @@ -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. diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 441f834..5d2f2c0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,38 +1,69 @@ -name: test Odoo addons +name: tests on: pull_request: branches: - - "14.0*" + - "14*" push: branches: - - "14.0" + - "14" + - "14-ocabot-*" jobs: + unreleased-deps: + runs-on: ubuntu-latest + name: Detect unreleased dependencies + steps: + - uses: actions/checkout@v2 + - 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-latest + container: ${{ matrix.container }} + name: ${{ matrix.name }} strategy: fail-fast: false matrix: - server_version: ["14.0"] - client_version: ["14.0", "12.0", "10.0", "8.0"] - env: - SERVER_VERSION: ${{ matrix.server_version }} - CLIENT_VERSION: ${{ matrix.client_version }} + include: + - container: ghcr.io/oca/oca-ci/py3.6-odoo14.0:latest + makepot: "true" + name: test with Odoo + - container: ghcr.io/oca/oca-ci/py3.6-ocb14.0:latest + name: test with OCB + services: + postgres: + image: postgres:9.6 + env: + POSTGRES_USER: odoo + POSTGRES_PASSWORD: odoo + POSTGRES_DB: odoo + ports: + - 5432:5432 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v2 with: persist-credentials: false - - name: Build - run: ./tools/build - - name: Init Server Database - run: ./tools/start-server init-db - - name: Start Server in Background - run: ./tools/start-server-deamon - - name: Init Client Database - run: ./tools/start-client init-db - - name: Run Client Test - run: ./tools/start-client run-test - - name: Convert Coverage file - run: ./tools/start-client convert-coverage - - uses: codecov/codecov-action@v2 + - 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 == 'akretion' }} diff --git a/.gitignore b/.gitignore index 43573df..c203d7c 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,6 @@ build/ develop-eggs/ dist/ eggs/ -lib/ lib64/ parts/ sdist/ diff --git a/.isort.cfg b/.isort.cfg index 7683bad..0ec187e 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -10,3 +10,4 @@ known_odoo=odoo known_odoo_addons=odoo.addons sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER default_section=THIRDPARTY +ensure_newline_before_comments = True diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ea0e19a..4363fb2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ exclude: | # 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$|.copier-answers.yml|/tests/([^/]+/)?cassettes/|^.github/| + .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) @@ -38,9 +38,15 @@ repos: rev: v1.4 hooks: - id: autoflake - args: ["-i", "--ignore-init-module-imports"] + args: + - --expand-star-imports + - --ignore-init-module-imports + - --in-place + - --remove-all-unused-imports + - --remove-duplicate-keys + - --remove-unused-variables - repo: https://github.com/psf/black - rev: "20.8b1" + rev: 22.3.0 hooks: - id: black args: [--line-length=88] @@ -88,6 +94,7 @@ repos: rev: v2.7.2 hooks: - id: pyupgrade + args: ["--keep-percent-format"] - repo: https://github.com/PyCQA/isort rev: 5.5.1 hooks: @@ -97,7 +104,7 @@ repos: - --settings=. exclude: /__init__\.py$ - repo: https://github.com/acsone/setuptools-odoo - rev: 2.6.0 + rev: 3.1.8 hooks: - id: setuptools-odoo-make-default - id: setuptools-odoo-get-requirements @@ -106,25 +113,21 @@ repos: - requirements.txt - --header - "# generated from manifests external_dependencies" - - repo: https://gitlab.com/PyCQA/flake8 + - repo: https://github.com/PyCQA/flake8 rev: 3.8.3 hooks: - id: flake8 name: flake8 additional_dependencies: ["flake8-bugbear==20.1.4"] - - repo: https://github.com/PyCQA/pylint - rev: pylint-2.5.3 + - repo: https://github.com/OCA/pylint-odoo + rev: 7.0.2 hooks: - - id: pylint + - id: pylint_odoo 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 + - id: pylint_odoo args: - --rcfile=.pylintrc-mandatory - additional_dependencies: *pylint_deps diff --git a/.pylintrc b/.pylintrc index a8c15ff..8df1136 100644 --- a/.pylintrc +++ b/.pylintrc @@ -1,3 +1,5 @@ + + [MASTER] load-plugins=pylint_odoo score=n diff --git a/.pylintrc-mandatory b/.pylintrc-mandatory index f62ccb1..f9af838 100644 --- a/.pylintrc-mandatory +++ b/.pylintrc-mandatory @@ -1,3 +1,4 @@ + [MASTER] load-plugins=pylint_odoo score=n diff --git a/README.md b/README.md new file mode 100644 index 0000000..f0fa204 --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ + + +[![Pre-commit Status](https://github.com/akretion/support/actions/workflows/pre-commit.yml/badge.svg?branch=14)](https://github.com/akretion/support/actions/workflows/pre-commit.yml?query=branch%3A14) +[![Build Status](https://github.com/akretion/support/actions/workflows/test.yml/badge.svg?branch=14)](https://github.com/akretion/support/actions/workflows/test.yml?query=branch%3A14) +[![codecov](https://codecov.io/gh/akretion/support/branch/14/graph/badge.svg)](https://codecov.io/gh/akretion/support) + + + + +# Support + +Support ticket management dealing 2 odoo instance + + + + + +[//]: # (addons) + +This part will be replaced when running the oca-gen-addons-table script from OCA/maintainer-tools. + +[//]: # (end addons) + + + +## Licenses + +This repository is licensed under [AGPL-3.0](LICENSE). + +However, each module can have a totally different license, as long as they adhere to Akretion +policy. Consult each module's `__manifest__.py` file, which contains a `license` key +that explains its license. + +---- + diff --git a/oca_dependencies.txt b/oca_dependencies.txt deleted file mode 100644 index 83d8cca..0000000 --- a/oca_dependencies.txt +++ /dev/null @@ -1,3 +0,0 @@ -project -rest-framework -server-auth https://github.com/akretion/server-auth 10.0-old-auth-api-key From dad017d118740ab6f2f77d1b4a4eb784e5c6cfd6 Mon Sep 17 00:00:00 2001 From: David Beal Date: Tue, 29 Nov 2022 21:37:17 +0100 Subject: [PATCH 2/2] UPD test-requirments --- test-requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index b8befd7..2ab6ad1 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,2 +1,2 @@ -odoo14-addon-project_time_in_day @ git+https://github.com/akretion/ak-odoo-incubator@14-project-estimation-step#subdirectory=setup/project_time_in_day -odoo14-addon-project_estimate_step @ git+https://github.com/akretion/ak-odoo-incubator@14-project-estimation-step#subdirectory=setup/project_estimate_step +odoo14-addon-project_time_in_day @ git+https://github.com/akretion/ak-odoo-incubator@14.0#subdirectory=setup/project_time_in_day +odoo14-addon-project_estimate_step @ git+https://github.com/akretion/ak-odoo-incubator@14.0#subdirectory=setup/project_estimate_step