Skip to content
Closed
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
139 changes: 44 additions & 95 deletions .github/workflows/iriscast_package_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,124 +14,73 @@ 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
pip install setuptools wheel build

- name: Run tests
run: cd iriscasttools/ && python3 -m pytest .

- name: Analyse with pylint
- name: Build package
run: |
cd iriscasttools && pylint --recursive yes test iriscasttools
python -m build

build-wheel:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.x"]
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
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
- name: Upload artifacts
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
name: dist-${{ matrix.python-version }}
path: dist/

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
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
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

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: Generate Changelog
id: changelog
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"

- name: Get Package Version
id: version
run: echo "version=$(python iriscasttools/setup.py --version)" >> $GITHUB_ENV
if [ -z "${{ github.event.inputs.changelog }}" ]; then
echo "changelog=Release version ${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
else
echo "changelog=${{ github.event.inputs.changelog }}" >> $GITHUB_OUTPUT
fi

- name: Download Artifacts
id: download
uses: actions/download-artifact@v5
- name: Create Git Tag
uses: EndBug/latest-tag@latest
with:
path: iriscasttools/dist
tag-name: v${{ github.event.inputs.version }}

- name: Make Release
uses: ncipollo/release-action@v1
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
artifacts: iriscasttools/dist/*/*
tag: ${{ env.version }}
name: iriscasttools-${{ env.version }}
skipIfReleaseExists: true

tag_name: v${{ github.event.inputs.version }}
body: ${{ steps.changelog.outputs.changelog }}
files: |
dist/**/*.whl
dist/**/*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


2 changes: 2 additions & 0 deletions iriscasttools/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
dist/*
24 changes: 24 additions & 0 deletions iriscasttools/README.md
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 iriscasttools/iriscasttools/iriscasttools.egg-info/PKG-INFO
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 <cloud-support@stfc.ac.uk>
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

```
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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

10 changes: 10 additions & 0 deletions iriscasttools/iriscasttools/iriscasttools.egg-info/requires.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
psutil

[dev]
bumpversion

[test]
pytest
pytest-cov
black
pylint
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

80 changes: 80 additions & 0 deletions iriscasttools/pyproject.toml
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 = "cloud-support@stfc.ac.uk"}]
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 = []
6 changes: 0 additions & 6 deletions iriscasttools/requirements.txt

This file was deleted.

21 changes: 0 additions & 21 deletions iriscasttools/setup.py

This file was deleted.