Skip to content

Commit

Permalink
TA#64835 [IMP] Add precommit, flake8 and github workflow (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
majouda authored Apr 17, 2024
1 parent b822769 commit 9e8d9d2
Show file tree
Hide file tree
Showing 416 changed files with 79 additions and 7,884 deletions.
16 changes: 0 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,6 @@ jobs:
- store_test_results:
path: .log

testcafe:
machine: true
steps:
- checkout

- run:
name: Build -- Init Database
command: docker-compose run --rm odoo odoo --stop-after-init -i main

# - run:
# name: Run Tests With Chrome
# command: docker-compose run --rm testcafe 'chrome:headless --no-sandbox' /tests/*.js --skip-js-errors --speed 0.5

# job that find the next tag for the current branch/repo and push the tag to github.
# it will trigger the publish of a new docker image.
auto-tag:
Expand All @@ -68,9 +55,6 @@ workflows:
jobs:
- tests:
context: quay.io

- testcafe

- auto-tag:
context: nws
requires:
Expand Down
23 changes: 0 additions & 23 deletions .docker_files/main/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,53 +22,33 @@
"project_cost_smart_button",
"project_default_task_stage",
"project_enhanced",
# "project_estimation",
# "project_estimation_material",
"project_form_with_dates",
"project_group_create",
"project_hide_create_sale_order",
"project_iteration",
"project_iteration_parent_only",
"project_iteration_parent_type_required",
# "project_iteration_sale_inheritance",
# "project_kanban_dates",
# "project_kanban_to_form",
"project_lump_sum",
"project_material",
"project_material_direct",
# "project_material_progress",
# "project_material_quantity_filters",
# "project_milestone_dependency",
"project_milestone_enhanced",
"project_milestone_estimated_hours",
# "project_milestone_remaining_hours",
"project_milestone_spent_hours",
# "project_milestone_start_date",
"project_milestone_time_report",
# "project_milestone_type",
"project_milestone_time_kpi",
# "project_milestone_timeline",
# "project_milestone_timeline_color",
# "project_milestone_week_duration",
"project_no_quick_create",
"project_outsourcing",
"project_outsourcing_timesheet_automation",
# "project_portal_hide_timesheets",
# "project_portal_no_subtask",
"project_portal_parent_task",
"project_remaining_hours_update",
# "project_role_milestone",
"project_stage",
"project_stage_allow_timesheet",
"project_stage_no_quick_create",
"project_task_analytic_lines",
# "project_task_analytic_lines_stock",
# "project_task_customer_reference",
"project_task_date_planned",
"project_task_deadline_from_project",
"project_task_dependency_more_info",
"project_task_description_template",
# "project_task_editable_list_stage",
"project_task_editable_list_view",
"project_task_full_text_search",
"project_task_id_in_display_name",
Expand All @@ -91,9 +71,6 @@
"stock_location_production",
"project_wip",
"project_wip_material",
# "project_wip_outsourcing",
# "project_wip_supply_cost",
# "project_wip_timesheet",
"timesheet_task_project_no_change",
],
"installable": True,
Expand Down
4 changes: 2 additions & 2 deletions .docker_files/odoo.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ demo = {}
email_from = False
geoip_database = /usr/share/GeoIP/GeoLiteCity.dat
import_partial =
limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
limit_memory_hard = 4026531840
limit_memory_soft = 3355443200
limit_request = 8192
limit_time_cpu = 1500
limit_time_real = 1500
Expand Down
12 changes: 12 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[flake8]
max-line-length = 88
max-complexity = 16
# B = bugbear
# B9 = bugbear opinionated (incl line length)
select = C,E,F,W,B,B9
# E203: whitespace before ':' (black behaviour)
# E501: flake8 line length (covered by bugbear B950)
# W503: line break before binary operator (black behaviour)
ignore = E203,E501,W503,F821
per-file-ignores=
__init__.py:F401
36 changes: 36 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: pre-commit

on:
pull_request:
branches:
- "14.0*"
push:
branches:
- "14.0"

jobs:
pre-commit:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
with:
python-version: "3.11"
- 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
- 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
37 changes: 28 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
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$|
# Don't bother non-technical authors with formatting issues in docs
readme/.*\.(rst|md)$|
# Ignore build and dist directories in addons
/build/|/dist/|
# You don't usually want a bot to modify your legal texts
(LICENSE.*|COPYING.*)
default_language_version:
python: python3
node: "14.13.0"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
- repo: https://github.com/PyCQA/flake8
rev: 3.8.3
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 19.3b0
hooks:
- id: black
- id: flake8
name: flake8
additional_dependencies: ["flake8-bugbear==20.1.4"]
16 changes: 0 additions & 16 deletions .testcafe/Dockerfile

This file was deleted.

21 changes: 0 additions & 21 deletions .testcafe/entrypoint.sh

This file was deleted.

39 changes: 0 additions & 39 deletions .testcafe/tests/common.js

This file was deleted.

40 changes: 0 additions & 40 deletions .testcafe/tests/testProjectTemplate.js

This file was deleted.

Empty file removed .unported/__init__.py
Empty file.
4 changes: 0 additions & 4 deletions .unported/portal_project_list_hours_spent/README.rst

This file was deleted.

2 changes: 0 additions & 2 deletions .unported/portal_project_list_hours_spent/__init__.py

This file was deleted.

15 changes: 0 additions & 15 deletions .unported/portal_project_list_hours_spent/__manifest__.py

This file was deleted.

Binary file not shown.
38 changes: 0 additions & 38 deletions .unported/portal_project_timesheet_conditional/README.rst

This file was deleted.

4 changes: 0 additions & 4 deletions .unported/portal_project_timesheet_conditional/__init__.py

This file was deleted.

Loading

0 comments on commit 9e8d9d2

Please sign in to comment.