-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:odoonix/utils
- Loading branch information
Showing
10 changed files
with
132 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,33 @@ | ||
# This workflow will upload a Python Package to PyPI when a release is created | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries | ||
|
||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
# This workflows will upload a Python Package using Twine when a release is created | ||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
|
||
name: Upload Python Package | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
permissions: | ||
contents: read | ||
push: | ||
tags: | ||
- "**" | ||
|
||
jobs: | ||
release-build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Build release distributions | ||
run: | | ||
# NOTE: put your own distribution build steps here. | ||
python -m pip install build | ||
python -m build | ||
- name: Upload distributions | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: release-dists | ||
path: dist/ | ||
|
||
pypi-publish: | ||
publish-package: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- release-build | ||
permissions: | ||
# IMPORTANT: this permission is mandatory for trusted publishing | ||
id-token: write | ||
|
||
# Dedicated environments with protections for publishing are strongly recommended. | ||
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules | ||
environment: | ||
name: pypi | ||
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status: | ||
# url: https://pypi.org/p/YOURPROJECT | ||
# | ||
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string | ||
# ALTERNATIVE: exactly, uncomment the following line instead: | ||
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }} | ||
|
||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
steps: | ||
- name: Retrieve release distributions | ||
uses: actions/download-artifact@v4 | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
with: | ||
name: release-dists | ||
path: dist/ | ||
|
||
- name: Publish release distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
fetch-depth: 0 # avoids shallow checkout as needed by setuptools-scm | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
packages-dir: dist/ | ||
python-version: "3.10" | ||
- name: Build Project and Publish | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | ||
run: | | ||
python -m pip install --upgrade pip setuptools tox | ||
python -m tox -e clean,build | ||
python -m tox -e publish -- --verbose --repository pypi |
Submodule odoo
added at
a72ccd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
# https://setuptools.pypa.io/en/latest/references/keywords.html | ||
|
||
[metadata] | ||
name = utils | ||
name = otoolbox | ||
description = Utilities for Odoo from Odoonix | ||
author = Odoonix | ||
author_email = [email protected] | ||
|
@@ -87,6 +87,8 @@ testing = | |
# | ||
console_scripts = | ||
otoolbox = otoolbox:run | ||
otoolbox-workspace = otoolbox.workspace:run | ||
otoolbox-repo = otoolbox.repositories:run | ||
|
||
|
||
[tool:pytest] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,10 @@ | |
|
||
_logger = logging.getLogger(__name__) | ||
|
||
# GIT | ||
GIT_ADDRESS_HTTPS = "https://github.com/{path}.git" | ||
GIT_ADDRESS_SSH = "[email protected]:{path}.git" | ||
|
||
GIT_ERROR_TABLE = { | ||
2: { | ||
'level': 'fatal', | ||
|
@@ -18,6 +22,7 @@ | |
} | ||
} | ||
|
||
|
||
def _rais_git_error(context, error_code): | ||
if not error_code: | ||
return | ||
|
@@ -26,13 +31,13 @@ def _rais_git_error(context, error_code): | |
'message': "Unknown GIT error for distination path {path}. Error code is {error_code}. " | ||
"See .otoolbox/logs.text for more information." | ||
}) | ||
message = error['message'].format(error_code=error_code,**context.__dict__) | ||
message = error['message'].format(error_code=error_code, **context.__dict__) | ||
if env.context.get('continue_on_exception'): | ||
_logger.error(message) | ||
env.errors.append(message) | ||
else: | ||
raise RuntimeError( | ||
error['message'].format(error_code=error_code,**context.__dict__) | ||
error['message'].format(error_code=error_code, **context.__dict__) | ||
) | ||
|
||
|
||
|
@@ -48,13 +53,13 @@ def git_clone(context): | |
'clone', | ||
'--branch', branch_name, | ||
'--depth', depth, | ||
f"[email protected]:{context.path}.git" | ||
(GIT_ADDRESS_HTTPS if not env.context.get('ssh_git', False) | ||
else GIT_ADDRESS_SSH).format(path=context.path), | ||
], cwd=cwd) | ||
|
||
_rais_git_error(context=context, error_code=result) | ||
|
||
|
||
|
||
def git_pull(context): | ||
"""Pull the git repository from github | ||
""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.