mirror of
https://github.com/XuehaiPan/nvitop.git
synced 2026-05-15 14:15:55 -06:00
feat(exporter): add Prometheus exporter (#92)
This commit is contained in:
parent
9ff3ec3400
commit
daf72c7bf3
24 changed files with 1475 additions and 37 deletions
42
.github/workflows/build.yaml
vendored
42
.github/workflows/build.yaml
vendored
|
|
@ -72,15 +72,22 @@ jobs:
|
|||
python -m venv venv &&
|
||||
(
|
||||
source venv/bin/activate &&
|
||||
python -m pip install --upgrade pip setuptools pre-commit pylint[spelling] mypy typing-extensions
|
||||
python -m pip install --upgrade pip setuptools pre-commit pylint[spelling] mypy typing-extensions &&
|
||||
python -m pip install -r requirements.txt &&
|
||||
python -m pip install -r nvitop-exporter/requirements.txt &&
|
||||
python -m pre_commit install --install-hooks &&
|
||||
python -m pre_commit run --all-files &&
|
||||
python -c 'import nvitop' &&
|
||||
python -m nvitop --version &&
|
||||
python -m nvitop --help &&
|
||||
python -m nvitop.select --version &&
|
||||
python -m nvitop.select --help
|
||||
python -m nvitop.select --help &&
|
||||
(
|
||||
cd nvitop-exporter &&
|
||||
python -c 'import nvitop_exporter' &&
|
||||
python -m nvitop_exporter --version &&
|
||||
python -m nvitop_exporter --help
|
||||
)
|
||||
)
|
||||
|
||||
- name: Test docker build
|
||||
|
|
@ -92,12 +99,17 @@ jobs:
|
|||
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
sed -i -E 's/^__release__\s*=.*$/__release__ = True/' nvitop/version.py
|
||||
sed -i -E 's/^__release__\s*=.*$/__release__ = True/' nvitop-exporter/nvitop_exporter/version.py
|
||||
|
||||
- name: Print version
|
||||
run: python setup.py --version
|
||||
run: |
|
||||
python setup.py --version
|
||||
python nvitop-exporter/setup.py --version
|
||||
|
||||
- name: Build sdist and wheels
|
||||
run: python -m build
|
||||
run: |
|
||||
python -m build --outdir dist .
|
||||
python -m build --outdir dist nvitop-exporter
|
||||
|
||||
- name: List built sdist and wheels
|
||||
run: ls -lh dist/
|
||||
|
|
@ -135,15 +147,23 @@ jobs:
|
|||
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
sed -i -E 's/^__release__\s*=.*$/__release__ = True/' nvitop/version.py
|
||||
sed -i -E 's/^__release__\s*=.*$/__release__ = True/' nvitop-exporter/nvitop_exporter/version.py
|
||||
|
||||
- name: Print version
|
||||
run: python setup.py --version
|
||||
run: |
|
||||
python setup.py --version
|
||||
python nvitop-exporter/setup.py --version
|
||||
|
||||
- name: Check consistency between the package version and release tag
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
PACKAGE_VER="v$(python setup.py --version)"
|
||||
RELEASE_TAG="${GITHUB_REF#refs/*/}"
|
||||
PACKAGE_VER="v$(python setup.py --version)"
|
||||
if [[ "${PACKAGE_VER}" != "${RELEASE_TAG}" ]]; then
|
||||
echo "package ver. (${PACKAGE_VER}) != release tag. (${RELEASE_TAG})"
|
||||
exit 1
|
||||
fi
|
||||
PACKAGE_VER="v$(python nvitop-exporter/setup.py --version)"
|
||||
if [[ "${PACKAGE_VER}" != "${RELEASE_TAG}" ]]; then
|
||||
echo "package ver. (${PACKAGE_VER}) != release tag. (${RELEASE_TAG})"
|
||||
exit 1
|
||||
|
|
@ -163,10 +183,10 @@ jobs:
|
|||
with:
|
||||
user: __token__
|
||||
password: ${{ secrets.TESTPYPI_UPLOAD_TOKEN }}
|
||||
repository_url: https://test.pypi.org/legacy/
|
||||
repository-url: https://test.pypi.org/legacy/
|
||||
verbose: true
|
||||
print_hash: true
|
||||
skip_existing: true
|
||||
print-hash: true
|
||||
skip-existing: true
|
||||
|
||||
- name: Publish to PyPI
|
||||
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
|
||||
|
|
@ -175,5 +195,5 @@ jobs:
|
|||
user: __token__
|
||||
password: ${{ secrets.PYPI_UPLOAD_TOKEN }}
|
||||
verbose: true
|
||||
print_hash: true
|
||||
skip_existing: true
|
||||
print-hash: true
|
||||
skip-existing: true
|
||||
|
|
|
|||
27
.github/workflows/lint.yaml
vendored
27
.github/workflows/lint.yaml
vendored
|
|
@ -40,6 +40,10 @@ jobs:
|
|||
- name: Check syntax (Python 3.7)
|
||||
run: |
|
||||
"${{ steps.py37.outputs.python-path }}" -m compileall nvitop
|
||||
(
|
||||
cd nvitop-exporter &&
|
||||
"${{ steps.py37.outputs.python-path }}" -m compileall nvitop_exporter
|
||||
)
|
||||
|
||||
- name: Upgrade pip
|
||||
run: |
|
||||
|
|
@ -67,6 +71,29 @@ jobs:
|
|||
"${{ steps.py37.outputs.python-path }}" -m nvitop.select --version
|
||||
"${{ steps.py37.outputs.python-path }}" -m nvitop.select --help
|
||||
|
||||
- name: Install dependencies for nvitop-exporter
|
||||
run: |
|
||||
python -m pip install -r nvitop-exporter/requirements.txt
|
||||
|
||||
- name: Import tests for nvitop-exporter
|
||||
run: |
|
||||
(
|
||||
cd nvitop-exporter &&
|
||||
python -c 'import nvitop_exporter' &&
|
||||
python -m nvitop_exporter --version &&
|
||||
python -m nvitop_exporter --help
|
||||
)
|
||||
|
||||
- name: Import tests for nvitop-exporter (Python 3.7)
|
||||
run: |
|
||||
(
|
||||
cd nvitop-exporter &&
|
||||
"${{ steps.py37.outputs.python-path }}" -m pip install -r requirements.txt &&
|
||||
"${{ steps.py37.outputs.python-path }}" -c 'import nvitop_exporter' &&
|
||||
"${{ steps.py37.outputs.python-path }}" -m nvitop_exporter --version &&
|
||||
"${{ steps.py37.outputs.python-path }}" -m nvitop_exporter --help
|
||||
)
|
||||
|
||||
- name: Install linters
|
||||
run: |
|
||||
python -m pip install --upgrade pre-commit pylint[spelling] mypy typing-extensions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue