Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 161 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
**.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
*.ps
*.xlsx

.filestore/
src/
setup/
Dockerfile
.copier-answers.yml
.dockerignore
.filestore/
.editorconfig
.eslintrc.yml
.git
.github
.gitignore
.oca_hooks.cfg
.pre-commit-config.yaml
.prettierrc.yml
.pylintrc
.pylintrc-mandatory
.ruff.toml
.CONTRIBUTE.md
.pytest_cache/
.ruff_cache/
README.md
repos.yaml
requirements.txt
test-requirements.txt
oca_dependencies.txt
setup.cfg
tasks.py
.vscode
nohup.out
78 changes: 78 additions & 0 deletions .github/workflows/build-oca-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Build Docker Image

on:
pull_request:
branches:
- "14.0*"
push:
branches:
- "14.0"
tags:
- 'v14.0.*'

env:
OWNER: "oca"


jobs:
build_docker_image:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to ghcr.io
if: ${{ github.repository_owner == env.OWNER && github.ref == 'refs/heads/14.0' || startsWith(github.ref, 'refs/tags/') }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
tags: |
ghcr.io/${{ env.OWNER }}/oca-custom:14.0-oca-latest
cache-from: type=registry,ref=ghcr.io/oca/oca-custom:14.0-oca-latest
cache-to: type=local,dest=/tmp/.buildx-cache
pull: true
load: true
-
name: Test install oca_all in docker image
run: |
# First start installing the database
docker compose up --wait odoo
docker compose stop odoo
# purpose it to test update entrypoints
docker compose up --wait odoo
Comment on lines +53 to +54
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not strictly necessary and takes some time likes -u all. This test some how 000_10_odoo-update entry point with a database installed (it not strictly assert that the update has been done). While the -i oca_all test without odoo database!

Any opinion on this?

-
name: Push latests cache image
if: ${{ github.repository_owner == env.OWNER && github.ref == 'refs/heads/14.0' }}
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
tags: |
ghcr.io/${{ env.OWNER }}/oca-custom:14.0-oca-latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=inline
push: true
-
name: Push image with tag if tagged
if: ${{ github.repository_owner == env.OWNER && startsWith(github.ref, 'refs/tags/') }}
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
tags: |
ghcr.io/${{ env.OWNER }}/oca-custom:${{ github.ref_name }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=inline
push: true
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
# 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
echo "Ignore Unreleased dependencies found in ${reqfile}."
exit 0
fi
fi
done
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,5 @@ docs/_build/

# OCA rules
!static/lib/
src/
.env
111 changes: 111 additions & 0 deletions CONTRIBUTE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Contribute to the OCA's Odoo instance

This guide aims to help happy volunteers to contribute to the OCA's Odoo instance. I
suppose mainly the OCA's Internal Tools team.

It's split into 3 sections:

- [Concepts](#concepts): Main concepts to understand and general organization
- [Processes](#processes): Helping doing the work without missing crucial steps
- [HowTos](#howto): How to do specific tasks

## Concepts

This repository is setup as other OCA's repositories to launch CI as usual and as an
extra configuration in order to build the OCA' Docker image used by our Odoo instance,
as well as facilitate the bootstrapping of a development environment.

Managing and freezing modules versions rely on python tools:

- [uv](https://docs.astral.sh/uv/)
- [hatch-odoo](https://pypi.org/project/hatch-odoo/)

## Processes

Here we focus on what to do without explaining how to do it.

### Release

- Add a tag to any git commit (prefer a commit in the 14.0 branch even this is not
required which could helps if needs to quickly deliver a bug fix) and push it to the
repo (ie:
`git tag -am "New release 2025-05-24" v14.0-20250524 && git push oca v14.0-20250524`).

- This will will trigger other flow to create the docker image. Tag must matched
following pattern to trigner the CI `v14.0.*`.

- A new docker image should be available in the
[github docker registry](https://github.com/oca/oca-custom/pkgs/container/oca-custom)

### deployment

Ask administrator to deploy the given version.

## HowTos

Here we focus on how to do it, it's a suggest way to works but feel free to use your own
way.

### Setup developer environment

Requirements:

- Postgresql
- [uv](https://docs.astral.sh/uv/)
- Some dependencies to be able to build some python packages: `libpq-dev`,
`build-essential`, TODO
- wkhtmltopdf

Prepare a python virtual environment with the correct python version (which uv will
download for you if necessary) and install the required dependencies:

```bash
uv sync
```

### Development

For addons living in this repository, you can just change code and restart Odoo with the
`uv run` command.

For addons in other repositories, the procedure is as follows:

- check out the repository somewhere, ie /src/\$repo
- add the following line to `pyproject.toml` in the `[tool.uv.sources]` section:

odoo14-addon-$youraddon = { path = "/srv/$repo/setup/$youraddon", editable = true }

- run `uv sync`
- restart Odoo

### Setup database and launch tests

- setup database with demo data and all oca modules installed

```bash
uv run odoo -d oca-custom -i oca_all --stop-after-init --without-de
```

- run tests using pytest launcher

````bash
uv run pytest --odoo-database oca-custom --cov ./oca_psc_team/ oca_psc_team/
``

### Update OCB Branch

```bash
uv sync -P odoo
````

### Update a specific OCA module dependency using the latest pypi release

```bash
uv sync -P odoo14-addon-<module-name>
```

### Bump all dependencies to the latest version

```bash
uv sync -U
```
Loading