Skip to content

Commit

Permalink
Merge pull request #205 from martinhoyer/ci
Browse files Browse the repository at this point in the history
Add workflows for pre-commit and PyPI release
  • Loading branch information
maurizio-lombardi authored Dec 18, 2024
2 parents 731c5ab + 954c6c0 commit 474edd5
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 8 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: pre-commit

on:
pull_request:
push:
branches: [master]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/[email protected]
19 changes: 19 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
on:
release:
types:
- published

name: pypi-release

jobs:
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/targetcli
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ repos:
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ Contribute
----------
targetcli complies with PEP 621 and as such can be built and installed with tools like `build` and `pip`.

For development, consider using [Hatch](https://hatch.pypa.io):
`hatch shell` to create and enter a Python virtualenv with the project installed in editable mode
`pre-commit install` to enable pre-commit hooks
`hatch build` to create tarball and wheel
For development, consider using [Hatch](https://hatch.pypa.io):
`hatch shell` to create and enter a Python virtualenv with the project installed in editable mode
`pre-commit install` to enable pre-commit hooks
`hatch build` to create tarball and wheel

"fb" -- "free branch"
---------------------
Expand Down
8 changes: 4 additions & 4 deletions src/targetcli/targetcli_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,11 @@ def main():
if not is_root:
shell.con.display("You are not root, disabling privileged commands.\n")

try:
while not shell._exit:
while not shell._exit:
try:
shell.run_interactive()
except (RTSLibError, ExecutionError) as msg:
shell.log.error(str(msg))
except (RTSLibError, ExecutionError) as msg: # noqa: PERF203 - would otherwise exit shell
shell.log.error(str(msg))

if shell.prefs['auto_save_on_exit'] and is_root:
shell.log.info("Global pref auto_save_on_exit=true")
Expand Down

0 comments on commit 474edd5

Please sign in to comment.