-
-
Notifications
You must be signed in to change notification settings - Fork 0
GitHub actions #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7f6f5ac
Corrected printing of resulting json
LazyTarget 002ad37
Able to close the session
LazyTarget e2becd4
Trigger on version-tags
LazyTarget 5efdb7f
Flake8 config and resolving issues
LazyTarget 090bd79
Implementing retry_delay
LazyTarget aedcab9
Improved retry_delay
LazyTarget ddb7185
Corrections
LazyTarget 66d757a
Simplified library
LazyTarget 4582868
Simplify some more
LazyTarget b93c74f
Remove code-checker for Python v3.14
LazyTarget 63a3a39
Renamed module to pyopenhardwaremonitor
LazyTarget 6e5af92
Set version to v0.1.5
LazyTarget 70349dc
Set version to v0.1.6
LazyTarget fa2fc96
Implemented a simple Async Context Manager
LazyTarget 65696ea
Updating example and README
LazyTarget d89c90c
Adding workflows and pre-commit
LazyTarget a91619f
pre-commit run --all-files
LazyTarget File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| [flake8] | ||
| ignore = | ||
| # line too long | ||
| E501, | ||
|
|
||
| # insecure use of "random" module, prefer "random.SystemRandom", | ||
| DUO102, | ||
|
|
||
| # Standard pseudo-random generators are not suitable for security/cryptographic purposes | ||
| S311 | ||
|
|
||
| exclude = | ||
| # No need to traverse our git directory | ||
| .git, | ||
| # There's no value in checking cache directories | ||
| __pycache__, | ||
| # The conf file is mostly autogenerated, ignore it | ||
| docs/source/conf.py, | ||
| # This contains our built documentation | ||
| build, | ||
| # This contains builds of flake8 that we don't want to check | ||
| dist, | ||
| # This folder is for local debugging | ||
| .venv |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| --- | ||
| name-template: 'v$RESOLVED_VERSION' | ||
| tag-template: 'v$RESOLVED_VERSION' | ||
| change-template: '- #$NUMBER $TITLE' | ||
| sort-direction: ascending | ||
| exclude-contributors: | ||
| - 'github-actions[bot]' | ||
| - 'github-actions' | ||
| - 'renovate[bot]' | ||
| - 'renovate' | ||
| - 'pre-commit-ci' | ||
| - 'pre-commit-ci[bot]' | ||
| - 'crowdin-bot' | ||
| exclude-labels: | ||
| - 'skip-changelog' | ||
| - 'dependencies' | ||
| version-resolver: | ||
| major: | ||
| labels: | ||
| - 'major' | ||
| minor: | ||
| labels: | ||
| - 'minor' | ||
| patch: | ||
| labels: | ||
| - 'patch' | ||
| default: patch | ||
| autolabeler: | ||
| - label: 'ci/cd' | ||
| files: | ||
| - '/.github/**/*' | ||
| - label: 'documentation' | ||
| files: | ||
| - '*.md' | ||
| - '/docs/*' | ||
| branch: | ||
| - '/docs{0,1}\/.+/' | ||
| - label: 'bug' | ||
| branch: | ||
| - '/fix\/.+/' | ||
| title: | ||
| - '/fix/i' | ||
| - label: 'enhancement' | ||
| branch: | ||
| - '/feature\/.+/' | ||
| body: | ||
| - '/JIRA-[0-9]{1,4}/' | ||
| commitish: refs/heads/main | ||
| template: | | ||
| ## 🚀 Changes | ||
|
|
||
| $CHANGES | ||
|
|
||
| ## ❤️ Contributors | ||
| $CONTRIBUTORS |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| --- | ||
| name: "Lint" | ||
|
|
||
| on: | ||
| # push: | ||
| pull_request: | ||
| # schedule: | ||
| # - cron: "0 0 * * *" | ||
|
|
||
| jobs: | ||
| lint: | ||
| name: Lint | ||
| runs-on: "ubuntu-latest" | ||
| steps: | ||
| - name: "Checkout the repository" | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: "Set up Python" | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
| cache: "pip" | ||
|
|
||
| - name: "Install requirements" | ||
| run: python3 -m pip install -r requirements.txt | ||
|
|
||
| - name: "ruff check ." | ||
| run: python3 -m ruff check . | ||
|
|
||
| - name: yaml-lint | ||
| uses: ibiqlik/action-yamllint@v3 | ||
| with: | ||
| # file_or_dir: myfolder/*values*.yaml | ||
| config_file: .yamllint.yaml |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| --- | ||
| name: Release Drafter | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, master] | ||
| pull_request: | ||
| types: [opened, reopened, synchronize] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| update_release_draft: | ||
| permissions: | ||
| # write permission is required to create a github release | ||
| contents: write | ||
| # write permission is required for autolabeler | ||
| # otherwise, read permission is required at least | ||
| pull-requests: write | ||
| name: Update release draft | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Create Release | ||
| uses: release-drafter/release-drafter@v6 | ||
| with: | ||
| disable-releaser: github.ref != 'refs/heads/main' | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| --- | ||
| name: Sourcery (for Codebase) | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, master] | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| review-codebase-with-sourcery: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| # https://github.com/sourcery-ai/action | ||
| - uses: sourcery-ai/action@v1 | ||
| with: | ||
| token: ${{ secrets.SOURCERY_TOKEN }} |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| --- | ||
| name: Sourcery (for PR) | ||
|
|
||
| on: | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| review-pr-with-sourcery: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| # https://github.com/sourcery-ai/action | ||
| - uses: sourcery-ai/action@v1 | ||
| with: | ||
| token: ${{ secrets.SOURCERY_TOKEN }} | ||
| diff_ref: ${{ github.event.pull_request.base.sha }} |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| --- | ||
| repos: | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.9.7 | ||
| hooks: | ||
| - id: ruff | ||
| args: | ||
| - --fix | ||
| - id: ruff-format | ||
| files: ^((pyopenhardwaremonitor|tests)/.+)?[^/]+\.(py|pyi)$ | ||
|
|
||
| - repo: https://github.com/adrienverge/yamllint.git | ||
| rev: v1.35.1 | ||
| hooks: | ||
| - id: yamllint | ||
| language: python | ||
| types: [file, yaml] | ||
| files: ^((pyopenhardwaremonitor|tests)/.+)?[^/]+\.(yaml|yml)$ | ||
|
|
||
| - repo: https://github.com/sourcery-ai/sourcery | ||
| rev: v1.34.0 | ||
| hooks: | ||
| - id: sourcery | ||
| # The best way to use Sourcery in a pre-commit hook: | ||
| # * review only changed lines: | ||
| # * omit the summary | ||
| args: [--diff=git diff HEAD, --no-summary] | ||
| stages: [pre-push] |
This file contains hidden or 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,4 +1,4 @@ | ||
| # These are supported funding model platforms | ||
|
|
||
| --- | ||
| github: lazytarget | ||
| custom: "https://paypal.me/peteraslund" | ||
| custom: "https://paypal.me/peteraslund" |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| #!/usr/bin/env python3 | ||
| import asyncio | ||
| import json | ||
| from pyopenhardwaremonitor.api import OpenHardwareMonitorAPI | ||
|
|
||
|
|
||
| async def main(host=None, port=8085): | ||
| """Main example on using pyOpenHardwareMonitor""" | ||
| host = host or get_current_ip() | ||
| print("Running against: ", host, port) | ||
|
|
||
| # Example when using `async with` syntax | ||
| async with OpenHardwareMonitorAPI(host, port) as api: | ||
| data = await api.get_data() | ||
| j = json.dumps(data) | ||
| print(j) | ||
| return j | ||
|
|
||
| # Example with explicit method calls | ||
| # api = OpenHardwareMonitorAPI(host, port) | ||
| # data = await api.get_data() | ||
| # await api.close() | ||
| # j = json.dumps(data) | ||
| # print(j) | ||
| # return j | ||
|
|
||
|
|
||
| def get_current_ip() -> str: | ||
| """Gets the local IP-address of this machine""" | ||
| import socket | ||
|
|
||
| s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | ||
| s.connect(("8.8.8.8", 80)) | ||
| return str(s.getsockname()[0]) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| # if running on Windows | ||
| asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) | ||
|
|
||
| # Run main with async | ||
| asyncio.run(main()) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
openhardwaremonitor/__init__.py → pyopenhardwaremonitor/__init__.py
This file contains hidden or 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,3 +1 @@ | ||
| """Library to handle connection with a Open Hardware Monitor remote server""" | ||
|
|
||
| from .openhardwaremonitor import OpenHardwareMonitor |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Mention the new example file.
Consider adding a sentence like "A more detailed example can be found in
example.py" to the README to point readers to the new example file.