Skip to content
Open
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
157 changes: 65 additions & 92 deletions .github/workflows/iriscast_package_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

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

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


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

```
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 = "[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 = []
6 changes: 0 additions & 6 deletions iriscasttools/requirements.txt

This file was deleted.

Loading