-
Notifications
You must be signed in to change notification settings - Fork 14
setup better python package builds for iriscasttools #262
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
Open
anish-mudaraddi
wants to merge
1
commit into
stfc:master
Choose a base branch
from
anish-mudaraddi:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 |
|---|---|---|
|
|
@@ -14,124 +14,97 @@ on: | |
|
|
||
| jobs: | ||
| test_and_lint: | ||
| runs-on: ubuntu-20.04 | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.x", "3.10", "3.6.8"] | ||
| python-version: ["3.x", "3.10"] | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Navigate to Folder | ||
| run: cd ./iriscasttools | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v6 | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| cache: "pip" | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r iriscasttools/requirements.txt | ||
|
|
||
| - name: Run tests | ||
| run: cd iriscasttools/ && python3 -m pytest . | ||
|
|
||
| - name: Analyse with pylint | ||
| run: | | ||
| cd iriscasttools && pylint --recursive yes test iriscasttools | ||
|
|
||
| build-wheel: | ||
| runs-on: ubuntu-20.04 | ||
|
|
||
| release: | ||
| runs-on: ubuntu-latest | ||
| if: github.ref == 'refs/heads/master' | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.x"] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v6 | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| cache: "pip" | ||
| - name: Get Package Version | ||
| id: version | ||
| run: echo "version=$(python iriscasttools/setup.py --version)" >> $GITHUB_ENV | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install setuptools wheel | ||
| - name: Build Wheels | ||
| run: cd iriscasttools && python setup.py bdist_wheel | ||
| - name: Upload Wheel | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: iriscasttools-${{ env.version }}-py3-none-any.whl | ||
| path: iriscasttools/dist/iriscasttools-${{ env.version }}-py3-none-any.whl | ||
| if-no-files-found: error | ||
| pip install setuptools wheel build | ||
|
|
||
| build-rpms: | ||
| runs-on: ubuntu-20.04 | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.10", "3.6.8"] | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| cache: "pip" | ||
| - name: Get Package Version | ||
| id: version | ||
| run: echo "version=$(python iriscasttools/setup.py --version)" >> $GITHUB_ENV | ||
| - name: Install dependencies | ||
| - name: Build package | ||
| run: | | ||
| sudo apt-get update && sudo apt-get install -y rpm | ||
| - name: Build RPM | ||
| run: | | ||
| cd iriscasttools | ||
| python_version=$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')") | ||
| echo -e "[install]\ninstall-lib=/usr/lib/python${python_version}/site-packages" > setup.cfg | ||
| python setup.py bdist_rpm | ||
| cd dist | ||
| mv iriscasttools-${{ env.version }}-1.noarch.rpm iriscasttools-${{ env.version }}-py${{ matrix.python-version }}.noarch.rpm | ||
| - uses: actions/upload-artifact@v4 | ||
| cd ./iriscasttools | ||
| python -m build | ||
|
|
||
| - name: Upload artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: iriscasttools-${{ env.version }}-py${{ matrix.python-version }}.noarch.rpm | ||
| path: iriscasttools/dist/iriscasttools-${{ env.version }}-py${{ matrix.python-version }}.noarch.rpm | ||
| if-no-files-found: error | ||
|
|
||
| name: dist-${{ matrix.python-version }} | ||
| path: ./iriscasttools/dist/ | ||
|
|
||
| publish: | ||
| runs-on: ubuntu-20.04 | ||
| if: github.ref == 'refs/heads/master' && github.event_name == 'push' | ||
| needs: | ||
| - test_and_lint | ||
| - build-wheel | ||
| - build-rpms | ||
| needs: release | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| path: dist | ||
|
|
||
| - name: Configure Git | ||
| - name: Get version from pyproject.toml | ||
| id: get_version | ||
| run: | | ||
| git config user.name "$GITHUB_ACTOR" | ||
| git config user.email "$[email protected]" | ||
| version=$(grep -m1 '^version' iriscasttools/pyproject.toml | sed -E 's/version *= *"([^"]+)"/\1/') | ||
| echo "version=$version" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Get Package Version | ||
| id: version | ||
| run: echo "version=$(python iriscasttools/setup.py --version)" >> $GITHUB_ENV | ||
| - name: Create tag for current version | ||
| run: | | ||
| version="${{ steps.get_version.outputs.version }}" | ||
| tag_name="iriscasttools-v${version}" | ||
|
|
||
| - name: Download Artifacts | ||
| id: download | ||
| uses: actions/download-artifact@v5 | ||
| with: | ||
| path: iriscasttools/dist | ||
| git config user.name "github-actions" | ||
| git config user.email "[email protected]" | ||
|
|
||
| - name: Make Release | ||
| uses: ncipollo/release-action@v1 | ||
| with: | ||
| artifacts: iriscasttools/dist/*/* | ||
| tag: ${{ env.version }} | ||
| name: iriscasttools-${{ env.version }} | ||
| skipIfReleaseExists: true | ||
| # Only tag if it doesn't already exist | ||
| if git rev-parse "$tag_name" >/dev/null 2>&1; then | ||
| echo "Tag $tag_name already exists. Skipping." | ||
| else | ||
| git tag "$tag_name" | ||
| git push origin "$tag_name" | ||
| fi | ||
|
|
||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v1 | ||
| with: | ||
| tag_name: iriscasttools-v${{ steps.get_version.outputs.version }} | ||
| files: | | ||
| dist/**/*.whl | ||
| dist/**/*.tar.gz | ||
| 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,2 @@ | ||
| dist | ||
| dist/* |
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 @@ | ||
| # IRISCAST Tools | ||
|
|
||
| > [!Warning] | ||
| > This package is deprecated and is not supported. | ||
|
|
||
| A python package that bundlels together a collection of energy usage monitoring scripts to be run on cloud hypervisors. | ||
|
|
||
| These scripts will collect power usage data using IPMI. | ||
|
|
||
| This package is intended to be installed onto HVs and a cronjob written to run this every 15mins to populate a csv - which can be read by filebeat/fluentd to a datastore. | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| pip install "iriscasttools @ git+https://github.com/stfc/SCD-OpenStack-Utils.git" | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| Run as a cron job: | ||
| ``` | ||
| python3 -m iriscasttols --as-csv >> /var/cache/iriscast/ipmi-stats-$(date -I).csv | ||
|
|
||
| ``` |
47 changes: 47 additions & 0 deletions
47
iriscasttools/iriscasttools/iriscasttools.egg-info/PKG-INFO
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,47 @@ | ||
| Metadata-Version: 2.4 | ||
| Name: iriscasttools | ||
| Version: 1.0.0 | ||
| Summary: python package for IRISCAST Tools | ||
| Author-email: STFC Cloud Team <[email protected]> | ||
| Project-URL: Repository, https://github.com/stfc/SCD-Openstack-Utils | ||
| Project-URL: Documentation, https://github.com/stfc/SCD-Openstack-Utils/iriscasttools/README.md | ||
| Project-URL: Issues, https://github.com/stfc/SCD-Openstack-Utils/issues | ||
| Keywords: python,openstack | ||
| Classifier: Development Status :: 4 - Beta | ||
| Classifier: Intended Audience :: Openstack Admins :: Monitoring Tools | ||
| Classifier: Programming Language :: Python :: 3 | ||
| Requires-Python: >=3.10 | ||
| Description-Content-Type: text/markdown | ||
| Requires-Dist: psutil | ||
| Provides-Extra: test | ||
| Requires-Dist: pytest; extra == "test" | ||
| Requires-Dist: pytest-cov; extra == "test" | ||
| Requires-Dist: black; extra == "test" | ||
| Requires-Dist: pylint; extra == "test" | ||
| Provides-Extra: dev | ||
| Requires-Dist: bumpversion; extra == "dev" | ||
|
|
||
| # IRISCAST Tools | ||
|
|
||
| > [!Warning] | ||
| > This package is deprecated and is not supported. | ||
|
|
||
| A python package that bundlels together a collection of energy usage monitoring scripts to be run on cloud hypervisors. | ||
|
|
||
| These scripts will collect power usage data using IPMI. | ||
|
|
||
| This package is intended to be installed onto HVs and a cronjob written to run this every 15mins to populate a csv - which can be read by filebeat/fluentd to a datastore. | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| pip install "iriscasttools @ git+https://github.com/stfc/SCD-OpenStack-Utils.git" | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| Run as a cron job: | ||
| ``` | ||
| python3 -m iriscasttols --as-csv >> /var/cache/iriscast/ipmi-stats-$(date -I).csv | ||
|
|
||
| ``` |
9 changes: 9 additions & 0 deletions
9
iriscasttools/iriscasttools/iriscasttools.egg-info/SOURCES.txt
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,9 @@ | ||
| README.md | ||
| pyproject.toml | ||
| iriscasttools/iriscasttools.egg-info/PKG-INFO | ||
| iriscasttools/iriscasttools.egg-info/SOURCES.txt | ||
| iriscasttools/iriscasttools.egg-info/dependency_links.txt | ||
| iriscasttools/iriscasttools.egg-info/requires.txt | ||
| iriscasttools/iriscasttools.egg-info/top_level.txt | ||
| test/test_stats.py | ||
| test/test_utils.py |
1 change: 1 addition & 0 deletions
1
iriscasttools/iriscasttools/iriscasttools.egg-info/dependency_links.txt
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 @@ | ||
|
|
10 changes: 10 additions & 0 deletions
10
iriscasttools/iriscasttools/iriscasttools.egg-info/requires.txt
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,10 @@ | ||
| psutil | ||
|
|
||
| [dev] | ||
| bumpversion | ||
|
|
||
| [test] | ||
| pytest | ||
| pytest-cov | ||
| black | ||
| pylint |
1 change: 1 addition & 0 deletions
1
iriscasttools/iriscasttools/iriscasttools.egg-info/top_level.txt
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 @@ | ||
|
|
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,80 @@ | ||
| [build-system] | ||
| requires = ["setuptools"] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [tool.setuptools.packages.find] | ||
| where = ["iriscasttools"] | ||
|
|
||
| [project] | ||
| name = "iriscasttools" | ||
| version = "1.0.0" | ||
| description = "python package for IRISCAST Tools" | ||
| authors = [{name = "STFC Cloud Team", email = "[email protected]"}] | ||
| readme = "README.md" | ||
| requires-python = ">=3.10" | ||
| keywords = ["python", "openstack"] | ||
| classifiers = [ | ||
| "Development Status :: 4 - Beta", | ||
| "Intended Audience :: Openstack Admins :: Monitoring Tools", | ||
| "Programming Language :: Python :: 3", | ||
| ] | ||
| dependencies = [ | ||
| "psutil", | ||
| ] | ||
|
|
||
| [project.urls] | ||
| Repository = "https://github.com/stfc/SCD-Openstack-Utils" | ||
| Documentation = "https://github.com/stfc/SCD-Openstack-Utils/iriscasttools/README.md" | ||
| Issues = "https://github.com/stfc/SCD-Openstack-Utils/issues" | ||
|
|
||
| # Optional dependency groups | ||
| [project.optional-dependencies] | ||
| test = [ | ||
| "pytest", | ||
| "pytest-cov", | ||
| "black", | ||
| "pylint", | ||
| ] | ||
|
|
||
| dev = [ | ||
| "bumpversion" | ||
| ] | ||
|
|
||
| [tool.pytest.ini_options] | ||
| pythonpath = ["iriscasttools"] | ||
| testpaths = ["tests"] | ||
| python_files = ["*.py"] | ||
| python_functions = ["test_*"] | ||
|
|
||
|
|
||
| [tool.black] | ||
| line-length = 88 | ||
| target-version = ['py38'] | ||
| include = '\.pyi?$' | ||
|
|
||
| [tool.pylint.format] | ||
| max-line-length=118 | ||
| disable=[ | ||
| "C00114", # Missing module string - we don't need module strings for the small repo | ||
| "W1401", # Influxdb required backslashes | ||
| "R0801" # Duplicate code due to test case | ||
| ] | ||
|
|
||
| [tool.bumpversion] | ||
| current_version = "1.0.0" | ||
| parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)" | ||
| serialize = ["{major}.{minor}.{patch}"] | ||
| search = "{current_version}" | ||
| replace = "{new_version}" | ||
| regex = false | ||
| ignore_missing_version = false | ||
| ignore_missing_files = false | ||
| tag = false | ||
| allow_dirty = true | ||
| commit = true | ||
| message = "Bump version: {current_version} → {new_version}" | ||
| moveable_tags = [] | ||
| commit_args = "--no-verify" | ||
| setup_hooks = [] | ||
| pre_commit_hooks = [] | ||
| post_commit_hooks = [] |
This file was deleted.
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.
Why this change? It should be explained in the commit message...