From d690fe27c6bf95a9b6dff6d49eb3b9ceaa23d3c3 Mon Sep 17 00:00:00 2001 From: Denis Roussel Date: Wed, 30 Mar 2022 11:35:35 +0200 Subject: [PATCH 1/2] Updated from template --- .copier-answers.yml | 5 +++- .eslintrc.yml | 2 +- .github/workflows/pre-commit.yml | 29 ++++++++++++++----- .pre-commit-config.yaml | 6 ++-- README.md | 6 ++-- .../models/intrastat_product_declaration.py | 12 ++++---- intrastat_product/tests/test_company.py | 2 +- .../tests/test_intrastat_product.py | 2 +- .../tests/test_purchase_order.py | 2 +- intrastat_product/tests/test_sale_order.py | 2 +- 10 files changed, 43 insertions(+), 25 deletions(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index a625fba..e9cea94 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,14 +1,17 @@ # Do NOT update manually; changes here will be overwritten by Copier -_commit: v1.3.6 +_commit: v1.5.2 _src_path: gh:oca/oca-addons-repo-template ci: Travis dependency_installation_mode: PIP generate_requirements_txt: true include_wkhtmltopdf: false odoo_version: 14.0 +org_name: Odoo Community Association (OCA) +org_slug: OCA rebel_module_groups: [] repo_description: 'TODO: add repo description.' repo_name: intrastat-extrastat repo_slug: intrastat-extrastat +repo_website: https://github.com/OCA/intrastat-extrastat travis_apt_packages: [] travis_apt_sources: [] diff --git a/.eslintrc.yml b/.eslintrc.yml index d4cc423..9429bc6 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -4,7 +4,7 @@ env: # See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449 parserOptions: - ecmaVersion: 2017 + ecmaVersion: 2019 overrides: - files: diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 80ab1a2..a7a1390 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -2,7 +2,12 @@ name: pre-commit on: pull_request: + branches: + - "14.0*" push: + branches: + - "14.0" + - "14.0-ocabot-*" jobs: pre-commit: @@ -10,11 +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 - # We also need to pin to an older version of python for older odoo versions - # where we are not using black > 21. Older black versions won't work with - # Python 3.9.8+, and we can't bump black without reformatting. - python-version: "3.9.7" - - 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/.pre-commit-config.yaml b/.pre-commit-config.yaml index a3bc5cb..08422f0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -46,7 +46,7 @@ repos: - --remove-duplicate-keys - --remove-unused-variables - repo: https://github.com/psf/black - rev: 20.8b1 + rev: 22.3.0 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-prettier @@ -120,7 +120,7 @@ repos: name: flake8 additional_dependencies: ["flake8-bugbear==20.1.4"] - repo: https://github.com/PyCQA/pylint - rev: pylint-2.5.3 + rev: v2.11.1 hooks: - id: pylint name: pylint with optional checks @@ -129,7 +129,7 @@ repos: - --exit-zero verbose: true additional_dependencies: &pylint_deps - - pylint-odoo==3.5.0 + - pylint-odoo==5.0.5 - id: pylint name: pylint with mandatory checks args: diff --git a/README.md b/README.md index 4a438a3..4bb5d15 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -[![Runbot Status](https://runbot.odoo-community.org/runbot/badge/flat/227/14.0.svg)](https://runbot.odoo-community.org/runbot/repo/github-com-oca-intrastat-extrastat-227) + +[![Runboat](https://img.shields.io/badge/runboat-Try%20me-875A7B.png)](https://runboat.odoo-community.org/builds?repo=OCA/intrastat-extrastat&target_branch=14.0) [![Build Status](https://travis-ci.com/OCA/intrastat-extrastat.svg?branch=14.0)](https://travis-ci.com/OCA/intrastat-extrastat) [![codecov](https://codecov.io/gh/OCA/intrastat-extrastat/branch/14.0/graph/badge.svg)](https://codecov.io/gh/OCA/intrastat-extrastat) [![Translation Status](https://translation.odoo-community.org/widgets/intrastat-extrastat-14-0/-/svg-badge.svg)](https://translation.odoo-community.org/engage/intrastat-extrastat-14-0/?utm_source=widget) @@ -34,12 +35,11 @@ addon | version | maintainers | summary This repository is licensed under [AGPL-3.0](LICENSE). -However, each module can have a totally different license, as long as they adhere to OCA +However, each module can have a totally different license, as long as they adhere to Odoo Community Association (OCA) policy. Consult each module's `__manifest__.py` file, which contains a `license` key that explains its license. ---- - OCA, or the [Odoo Community Association](http://odoo-community.org/), is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. diff --git a/intrastat_product/models/intrastat_product_declaration.py b/intrastat_product/models/intrastat_product_declaration.py index 772f7e9..f807dd8 100644 --- a/intrastat_product/models/intrastat_product_declaration.py +++ b/intrastat_product/models/intrastat_product_declaration.py @@ -199,7 +199,7 @@ class IntrastatProductDeclaration(models.Model): @api.depends("month") def _compute_check_validity(self): - """ TO DO: logic based upon computation lines """ + """TO DO: logic based upon computation lines""" for this in self: this.valid = True @@ -526,7 +526,7 @@ class IntrastatProductDeclaration(models.Model): return vat def _update_computation_line_vals(self, inv_line, line_vals, notedict): - """ placeholder for localization modules """ + """placeholder for localization modules""" def _handle_invoice_accessory_cost( self, @@ -602,7 +602,7 @@ class IntrastatProductDeclaration(models.Model): return False def _gather_invoices_init(self, notedict): - """ placeholder for localization modules """ + """placeholder for localization modules""" def _format_line_note(self, line, notedict, line_notes): indent = 8 * " " @@ -884,7 +884,7 @@ class IntrastatProductDeclaration(models.Model): return vals def generate_declaration(self): - """ generate declaration lines """ + """generate declaration lines""" self.ensure_one() assert self.valid, "Computation lines are not valid" self.message_post(body=_("Generate Declaration Lines")) @@ -915,7 +915,7 @@ class IntrastatProductDeclaration(models.Model): ) def generate_xml(self): - """ generate the INTRASTAT Declaration XML file """ + """generate the INTRASTAT Declaration XML file""" self.ensure_one() if self.xml_attachment_id: raise UserError( @@ -1099,7 +1099,7 @@ class IntrastatProductComputationLine(models.Model): @api.depends("transport_id") def _compute_check_validity(self): - """ TO DO: logic based upon fields """ + """TO DO: logic based upon fields""" for this in self: this.valid = True diff --git a/intrastat_product/tests/test_company.py b/intrastat_product/tests/test_company.py index 7fe99ac..60fb2b6 100644 --- a/intrastat_product/tests/test_company.py +++ b/intrastat_product/tests/test_company.py @@ -37,4 +37,4 @@ class TestIntrastatCompany(IntrastatProductCommon): class TestIntrastatProductCase(TestIntrastatCompany, SavepointCase): - """ Test Intrastat Product """ + """Test Intrastat Product""" diff --git a/intrastat_product/tests/test_intrastat_product.py b/intrastat_product/tests/test_intrastat_product.py index af0b265..e41a436 100644 --- a/intrastat_product/tests/test_intrastat_product.py +++ b/intrastat_product/tests/test_intrastat_product.py @@ -64,4 +64,4 @@ class TestIntrastatProduct(IntrastatProductCommon): class TestIntrastatProductCase(TestIntrastatProduct, SavepointCase): - """ Test Intrastat Product """ + """Test Intrastat Product""" diff --git a/intrastat_product/tests/test_purchase_order.py b/intrastat_product/tests/test_purchase_order.py index f6538c1..236ffe7 100644 --- a/intrastat_product/tests/test_purchase_order.py +++ b/intrastat_product/tests/test_purchase_order.py @@ -50,4 +50,4 @@ class TestIntrastatProductPurchase(IntrastatPurchaseCommon): class TestIntrastatProductPurchaseCase(TestIntrastatProductPurchase, SavepointCase): - """ Test Intrastat Purchase """ + """Test Intrastat Purchase""" diff --git a/intrastat_product/tests/test_sale_order.py b/intrastat_product/tests/test_sale_order.py index 7d5b411..7c01f1b 100644 --- a/intrastat_product/tests/test_sale_order.py +++ b/intrastat_product/tests/test_sale_order.py @@ -85,4 +85,4 @@ class TestIntrastatProductSale(IntrastatSaleCommon): class TestIntrastatProductSaleCase(TestIntrastatProductSale, SavepointCase): - """ Test Intrastat Sale """ + """Test Intrastat Sale""" From 0411bb15cf1d7210ef98eb32c60ebaec06f88203 Mon Sep 17 00:00:00 2001 From: Denis Roussel Date: Wed, 30 Mar 2022 11:44:19 +0200 Subject: [PATCH 2/2] Updated from template - Switch to Github actions --- .copier-answers.yml | 2 +- .github/workflows/test.yml | 69 ++++++++++++++++++++++++++++++++++++++ .travis.yml | 42 ----------------------- README.md | 3 +- 4 files changed, 72 insertions(+), 44 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.copier-answers.yml b/.copier-answers.yml index e9cea94..cee4051 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,7 +1,7 @@ # Do NOT update manually; changes here will be overwritten by Copier _commit: v1.5.2 _src_path: gh:oca/oca-addons-repo-template -ci: Travis +ci: GitHub dependency_installation_mode: PIP generate_requirements_txt: true include_wkhtmltopdf: false diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..1c4fe51 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,69 @@ +name: tests + +on: + pull_request: + branches: + - "14.0*" + push: + branches: + - "14.0" + - "14.0-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: + 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@v2 + 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' }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5e8e3a6..0000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -language: python -cache: - directories: - - $HOME/.cache/pip - - $HOME/.cache/pre-commit - -python: - - "3.6" - -addons: - postgresql: "9.6" - apt: - packages: - - expect-dev # provides unbuffer utility - -stages: - - test - -jobs: - include: - - stage: test - env: - - TESTS=1 ODOO_REPO="odoo/odoo" MAKEPOT="1" - - stage: test - env: - - TESTS=1 ODOO_REPO="OCA/OCB" -env: - global: - - VERSION="14.0" TESTS="0" LINT_CHECK="0" MAKEPOT="0" - - MQT_DEP=PIP - -install: - - git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git - ${HOME}/maintainer-quality-tools - - export PATH=${HOME}/maintainer-quality-tools/travis:${PATH} - - travis_install_nightly - -script: - - travis_run_tests - -after_success: - - travis_after_tests_success diff --git a/README.md b/README.md index 4bb5d15..747f6cb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ [![Runboat](https://img.shields.io/badge/runboat-Try%20me-875A7B.png)](https://runboat.odoo-community.org/builds?repo=OCA/intrastat-extrastat&target_branch=14.0) -[![Build Status](https://travis-ci.com/OCA/intrastat-extrastat.svg?branch=14.0)](https://travis-ci.com/OCA/intrastat-extrastat) +[![Pre-commit Status](https://github.com/OCA/intrastat-extrastat/actions/workflows/pre-commit.yml/badge.svg?branch=14.0)](https://github.com/OCA/intrastat-extrastat/actions/workflows/pre-commit.yml?query=branch%3A14.0) +[![Build Status](https://github.com/OCA/intrastat-extrastat/actions/workflows/test.yml/badge.svg?branch=14.0)](https://github.com/OCA/intrastat-extrastat/actions/workflows/test.yml?query=branch%3A14.0) [![codecov](https://codecov.io/gh/OCA/intrastat-extrastat/branch/14.0/graph/badge.svg)](https://codecov.io/gh/OCA/intrastat-extrastat) [![Translation Status](https://translation.odoo-community.org/widgets/intrastat-extrastat-14-0/-/svg-badge.svg)](https://translation.odoo-community.org/engage/intrastat-extrastat-14-0/?utm_source=widget)