From 6f8dfb7912950bcb6cb84e5a59556316a6e3ce20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Didderen?= Date: Fri, 14 Mar 2025 00:13:45 +0100 Subject: [PATCH] update ci --- .copier-answers.yml | 14 +- .eslintrc.yml | 2 +- .github/workflows/pre-commit.yml | 45 +++++++ .github/workflows/test.yml | 123 ++++++++++++++++++ .gitignore | 13 ++ .gitlab-ci.yml | 14 -- .pre-commit-config.yaml | 42 +++--- .ruff.toml | 1 + README.md | 15 ++- account_ebics/__manifest__.py | 2 +- account_ebics_batch/__manifest__.py | 2 +- account_ebics_batch_payment/__manifest__.py | 2 +- .../__manifest__.py | 2 +- account_ebics_oe/__manifest__.py | 2 +- account_ebics_payment_order/__manifest__.py | 2 +- 15 files changed, 234 insertions(+), 47 deletions(-) create mode 100644 .github/workflows/pre-commit.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .gitlab-ci.yml diff --git a/.copier-answers.yml b/.copier-answers.yml index ca1fff7..397e510 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,12 +1,12 @@ # Do NOT update manually; changes here will be overwritten by Copier -_commit: v3.1 -_src_path: https://picasso.noviat.com/ci/addons-repo-template.git -ci_exclude_modules: account_asset -customer_slug: Noviat_Generic -odoo_enterprise: 1 +_commit: v4.5 +_src_path: git@github.com:Noviat-CI/addons-repo-template.git +ci_disable_autoinstall_modules: account_asset +odoo_test_flavor: Both odoo_version: 17.0 org_slug: Noviat +rebel_module_groups: [] repo_name: Modules dedicated to manage the EBICS protocol -repo_slug: accounting-ebics -repo_type: Customer/Generic Addons +repo_slug: account_ebics +repo_type: customer diff --git a/.eslintrc.yml b/.eslintrc.yml index fed88d7..0b38203 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: 2019 + ecmaVersion: 2022 overrides: - files: diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..5658a74 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,45 @@ +name: pre-commit + +on: + pull_request: + branches: + - "17.0*" + push: + branches: + - "17.0" + +jobs: + pre-commit: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Get python version + run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV + - uses: actions/cache@v4 + 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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..437ac4b --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,123 @@ +name: tests + +on: + pull_request: + branches: + - "17.0*" + push: + branches: + - "17.0" + +jobs: + unreleased-deps: + runs-on: ubuntu-latest + name: Detect unreleased dependencies + steps: + - uses: actions/checkout@v4 + - 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-22.04 + container: ${{ matrix.container }} + name: ${{ matrix.name }} + permissions: + pull-requests: write + contents: write + strategy: + fail-fast: false + matrix: + include: + - container: ghcr.io/oca/oca-ci/py3.10-odoo17.0:latest + name: test with Odoo Community + odoo_enterprise : 0 + exclude_modules : "account_asset" + exclude: "account_ebics_batch_payment,account_ebics_oe" + - container: ghcr.io/oca/oca-ci/py3.10-odoo17.0:latest + name: test with Odoo Enterprise + odoo_enterprise : 1 + exclude_modules : "account_asset" + makepot: true + services: + postgres: + image: postgres:12.0 + env: + POSTGRES_USER: odoo + POSTGRES_PASSWORD: odoo + POSTGRES_DB: odoo + ports: + - 5432:5432 + env: + INSTALL_ADDONS_DIR: "/tmp/addons-merged" + ADDITIONAL_ADDONS_DIR: "/tmp/additional-addons" + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Add Noviat CI Tools to PATH + run: | + git clone https://${{ secrets.PRIVATE_TOKEN }}@github.com/Noviat-CI/noviat-ci-tools.git /opt/noviat-ci-tools + echo "/opt/noviat-ci-tools" >> $GITHUB_PATH + - name: Clone Odoo Enterprise + if: ${{ matrix.odoo_enterprise == 1 }} + run : | + git clone https://${{ secrets.PRIVATE_TOKEN }}@github.com/odoo/enterprise.git --depth 1 -b 17.0 /opt/enterprise + - name: Clone Noviat Dependencies + env: + PRIVATE_TOKEN: ${{ secrets.PRIVATE_TOKEN }} + run: clone_oca_dependencies_by_noviat + - name: Create addons path + run: | + mkdir -p ${{ env.INSTALL_ADDONS_DIR }}/setup + find $(realpath $ADDONS_DIR) $(realpath ${{ env.ADDITIONAL_ADDONS_DIR }}) -name __manifest__.py -exec sh -c 'ln -s "$(dirname "$0")" "${{ env.INSTALL_ADDONS_DIR }}"' {} \; + find $(realpath $ADDONS_DIR) $(realpath ${{ env.ADDITIONAL_ADDONS_DIR }}) -iwholename '*/setup/*/setup.py' -exec sh -c 'ln -s "$(dirname "$0")" "${{ env.INSTALL_ADDONS_DIR }}/setup"' {} \; + if [ -n ${{ matrix.exclude}} ] + then + remove_excluded_modules ${{ env.INSTALL_ADDONS_DIR }} ${{ matrix.exclude }} + fi + - name: Update addons path with enterprise + if: ${{ matrix.odoo_enterprise == 1 }} + run: | + echo "ADDONS_PATH=/opt/odoo/addons,/opt/enterprise,${{ env.INSTALL_ADDONS_DIR }}" >> $GITHUB_ENV + - name: Update addons path without enterprise + if: ${{ matrix.odoo_enterprise == 0 }} + run: | + echo "ADDONS_PATH=/opt/odoo/addons,${{ env.INSTALL_ADDONS_DIR }}" >> $GITHUB_ENV + - name: Add addons to EXCLUDE PATH + if: ${{ env.EXCLUDE_MODULES }} + run: | + echo "server_wide_modules = web,module_change_auto_install" >> ${ODOO_RC} + echo "modules_auto_install_disabled = $EXCLUDE_MODULES" >> ${ODOO_RC} + - name: Install addons and dependencies + run: | + (ADDONS_PATH=${ADDONS_PATH} ADDONS_DIR=${INSTALL_ADDONS_DIR} oca_install_addons) + - name: Initialize test db + run: oca_init_test_database + - name: Run tests + run: oca_run_tests + - name: Generate coverage files + run: | + coverage report -m + coverage xml -o coverage.xml + - name: Code Coverage Summary Report + uses: irongut/CodeCoverageSummary@v1.3.0 + with: + filename: 'coverage.xml' + badge: true + format: 'markdown' + output: 'both' + hide_complexity: true + - name: Write to Job Summary + run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY + - name: Update .pot files + run: noviat_export_and_push_pot https://x-access-token:${{ secrets.PRIVATE_TOKEN }}@github.com/${{ github.repository }} + if: ${{ matrix.makepot == 'true' && github.event_name == 'push' }} diff --git a/.gitignore b/.gitignore index 16a389c..fa3b868 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,19 @@ var/ *.egg *.eggs +# Windows installers +*.msi + +# Debian packages +*.deb + +# Redhat packages +*.rpm + +# MacOS packages +*.dmg +*.pkg + # Installer logs pip-log.txt pip-delete-this-directory.txt diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 529a484..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,14 +0,0 @@ -include: - - project: "ci/gitlabci-odoo" - ref: main - file: "/odoo-tests.template.yml" - -variables: - ODOO_CI_IMAGE: ghcr.io/oca/oca-ci/py3.10-odoo17.0:latest - VERSION: "17.0" - ODOO_BRANCH: "17.0" - ENTERPRISE: "1" - ODOO_PRECOMMIT: "1" - ODOO_TEST: "1" - ODOO_GENERATE_POT: "1" - EXCLUDE_MODULES: "account_asset" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8445d64..30eecfa 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$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/| + .svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/|^eslint.config.cjs|^prettier.config.cjs| # Maybe reactivate this when all README files include prettier ignore tags? ^README\.md$| # Library files can have extraneous formatting (even minimized) @@ -16,6 +16,8 @@ exclude: | readme/.*\.(rst|md)$| # Ignore build and dist directories in addons /build/|/dist/| + # Ignore test files in addons + /tests/samples/.*| # You don't usually want a bot to modify your legal texts (LICENSE.*|COPYING.*) default_language_version: @@ -36,42 +38,50 @@ repos: entry: found a en.po file language: fail files: '[a-zA-Z0-9_]*/i18n/en\.po$' - - repo: https://github.com/sbidoul/whool - rev: v0.5 - hooks: - - id: whool-init - repo: https://github.com/oca/maintainer-tools - rev: 9a170331575a265c092ee6b24b845ec508e8ef75 + rev: d5fab7ee87fceee858a3d01048c78a548974d935 hooks: # update the NOT INSTALLABLE ADDONS section above - id: oca-update-pre-commit-excluded-addons - id: oca-fix-manifest-website - args: ["https://www.noviat.com"] - - id: oca-gen-external-dependencies + args: ["https://www.noviat.com/"] + - id: oca-gen-addons-table - repo: https://github.com/OCA/odoo-pre-commit-hooks rev: v0.0.25 hooks: - id: oca-checks-odoo-module - id: oca-checks-po - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.7.1 + args: + - --disable=po-pretty-format + - repo: local hooks: - id: prettier name: prettier (with plugin-xml) + entry: prettier + args: + - --write + - --list-different + - --ignore-unknown + types: [text] + files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$ + language: node additional_dependencies: - "prettier@2.7.1" - "@prettier/plugin-xml@2.2.0" - args: - - --plugin=@prettier/plugin-xml - files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$ - - repo: https://github.com/pre-commit/mirrors-eslint - rev: v8.24.0 + - repo: local hooks: - id: eslint - verbose: true + name: eslint + entry: eslint args: - --color - --fix + verbose: true + types: [javascript] + language: node + additional_dependencies: + - "eslint@8.24.0" + - "eslint-plugin-jsdoc@" - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.3.0 hooks: diff --git a/.ruff.toml b/.ruff.toml index 0240c75..8e8eccb 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -10,6 +10,7 @@ extend-select = [ "I", # isort "UP", # pyupgrade ] +extend-safe-fixes = ["UP008"] exclude = ["setup/*"] [format] diff --git a/README.md b/README.md index d9bbc05..6bfb85b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![pipeline status](https://picasso.noviat.com/Noviat/Noviat_Generic/accounting-ebics/badges/17.0/pipeline.svg)](https://picasso.noviat.com/Noviat/Noviat_Generic/accounting-ebics/-/commits/17.0) -[![coverage report](https://picasso.noviat.com/Noviat/Noviat_Generic/accounting-ebics/badges/17.0/coverage.svg)](http://noviat.picasso-pages.noviat.com/Noviat_Generic/accounting-ebics) +[![Pre-commit Status](https://github.com/Noviat/account_ebics/actions/workflows/pre-commit.yml/badge.svg?branch=17.0)](https://github.com/Noviat/account_ebics/actions/workflows/pre-commit.yml?query=branch%3A17.0) +[![Build Status](https://github.com/Noviat/account_ebics/actions/workflows/test.yml/badge.svg?branch=17.0)](https://github.com/Noviat/account_ebics/actions/workflows/test.yml?query=branch%3A17.0) @@ -11,7 +11,16 @@ [//]: # (addons) -This part will be replaced when running the oca-gen-addons-table script from OCA/maintainer-tools. +Available addons +---------------- +addon | version | maintainers | summary +--- | --- | --- | --- +[account_ebics](account_ebics/) | 17.0.1.2.0 | | EBICS banking protocol +[account_ebics_batch](account_ebics_batch/) | 17.0.1.0.1 | | EBICS Files automated import and processing +[account_ebics_batch_payment](account_ebics_batch_payment/) | 17.0.1.0.3 | | Upload Batch Payment via EBICS +[account_ebics_oca_statement_import](account_ebics_oca_statement_import/) | 17.0.1.0.1 | | Use OCA Bank Statement Import with account_ebics +[account_ebics_oe](account_ebics_oe/) | 17.0.1.0.0 | | Deploy account_ebics module on Odoo Enterprise +[account_ebics_payment_order](account_ebics_payment_order/) | 17.0.1.1.0 | | Upload Payment Order via EBICS [//]: # (end addons) diff --git a/account_ebics/__manifest__.py b/account_ebics/__manifest__.py index df81bb9..63254ab 100644 --- a/account_ebics/__manifest__.py +++ b/account_ebics/__manifest__.py @@ -6,7 +6,7 @@ "version": "17.0.1.2.0", "license": "LGPL-3", "author": "Noviat", - "website": "https://www.noviat.com", + "website": "https://www.noviat.com/", "category": "Accounting & Finance", "depends": ["account"], "data": [ diff --git a/account_ebics_batch/__manifest__.py b/account_ebics_batch/__manifest__.py index e975a3d..46f1649 100644 --- a/account_ebics_batch/__manifest__.py +++ b/account_ebics_batch/__manifest__.py @@ -6,7 +6,7 @@ "version": "17.0.1.0.1", "license": "AGPL-3", "author": "Noviat", - "website": "https://www.noviat.com", + "website": "https://www.noviat.com/", "category": "Accounting & Finance", "summary": "EBICS Files automated import and processing", "depends": ["account_ebics"], diff --git a/account_ebics_batch_payment/__manifest__.py b/account_ebics_batch_payment/__manifest__.py index 7c71fee..37759aa 100644 --- a/account_ebics_batch_payment/__manifest__.py +++ b/account_ebics_batch_payment/__manifest__.py @@ -6,7 +6,7 @@ "version": "17.0.1.0.3", "license": "LGPL-3", "author": "Noviat", - "website": "https://www.noviat.com", + "website": "https://www.noviat.com/", "category": "Accounting & Finance", "depends": ["account_ebics", "account_batch_payment"], "data": ["views/account_batch_payment_views.xml"], diff --git a/account_ebics_oca_statement_import/__manifest__.py b/account_ebics_oca_statement_import/__manifest__.py index f7408c9..b7e5a3d 100644 --- a/account_ebics_oca_statement_import/__manifest__.py +++ b/account_ebics_oca_statement_import/__manifest__.py @@ -6,7 +6,7 @@ "summary": "Use OCA Bank Statement Import with account_ebics", "version": "17.0.1.0.1", "author": "Noviat", - "website": "https://www.noviat.com", + "website": "https://www.noviat.com/", "category": "Hidden", "license": "LGPL-3", "depends": [ diff --git a/account_ebics_oe/__manifest__.py b/account_ebics_oe/__manifest__.py index febe3ff..36fb821 100644 --- a/account_ebics_oe/__manifest__.py +++ b/account_ebics_oe/__manifest__.py @@ -6,7 +6,7 @@ "summary": "Deploy account_ebics module on Odoo Enterprise", "version": "17.0.1.0.0", "author": "Noviat", - "website": "https://www.noviat.com", + "website": "https://www.noviat.com/", "category": "Hidden", "license": "LGPL-3", "depends": [ diff --git a/account_ebics_payment_order/__manifest__.py b/account_ebics_payment_order/__manifest__.py index 9e498ba..184bb7c 100644 --- a/account_ebics_payment_order/__manifest__.py +++ b/account_ebics_payment_order/__manifest__.py @@ -6,7 +6,7 @@ "version": "17.0.1.1.0", "license": "LGPL-3", "author": "Noviat", - "website": "https://www.noviat.com", + "website": "https://www.noviat.com/", "category": "Accounting & Finance", "depends": ["account_ebics", "account_payment_order"], "data": [