feat(exporter): add Prometheus exporter #456
Workflow file for this run
This file contains 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
name: Lint | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.ref }}" | |
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
permissions: | |
contents: read | |
jobs: | |
lint: | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Set up Python | |
id: py | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.7 - 3.11" | |
update-environment: true | |
- name: Set up Python 3.7 | |
id: py37 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.7" | |
update-environment: false | |
- name: Check syntax (Python 3.7) | |
run: | | |
"${{ steps.py37.outputs.python-path }}" -m compileall nvitop | |
( | |
cd nvitop-prometheus-exporter && | |
"${{ steps.py37.outputs.python-path }}" -m compileall nvitop_prometheus_exporter | |
) | |
- name: Upgrade pip | |
run: | | |
python -m pip install --upgrade pip setuptools | |
- name: Install dependencies | |
run: | | |
python -m pip install -r requirements.txt | |
- name: Import tests | |
run: | | |
python -c 'import nvitop' | |
python -m nvitop --version | |
python -m nvitop --help | |
python -m nvitop.select --version | |
python -m nvitop.select --help | |
- name: Import tests (Python 3.7) | |
run: | | |
"${{ steps.py37.outputs.python-path }}" -m pip install --upgrade pip setuptools | |
"${{ steps.py37.outputs.python-path }}" -m pip install -r requirements.txt | |
"${{ steps.py37.outputs.python-path }}" -c 'import nvitop' | |
"${{ steps.py37.outputs.python-path }}" -m nvitop --version | |
"${{ steps.py37.outputs.python-path }}" -m nvitop --help | |
"${{ steps.py37.outputs.python-path }}" -m nvitop.select --version | |
"${{ steps.py37.outputs.python-path }}" -m nvitop.select --help | |
- name: Install dependencies for nvitop-prometheus-exporter | |
run: | | |
python -m pip install -r nvitop-prometheus-exporter/requirements.txt | |
- name: Import tests for nvitop-prometheus-exporter | |
run: | | |
( | |
cd nvitop-prometheus-exporter && | |
python -c 'import nvitop_prometheus_exporter' && | |
python -m nvitop_prometheus_exporter --version && | |
python -m nvitop_prometheus_exporter --help | |
) | |
- name: Import tests for nvitop-prometheus-exporter (Python 3.7) | |
run: | | |
( | |
cd nvitop-prometheus-exporter && | |
"${{ steps.py37.outputs.python-path }}" -m pip install -r requirements.txt && | |
"${{ steps.py37.outputs.python-path }}" -c 'import nvitop_prometheus_exporter' && | |
"${{ steps.py37.outputs.python-path }}" -m nvitop_prometheus_exporter --version && | |
"${{ steps.py37.outputs.python-path }}" -m nvitop_prometheus_exporter --help | |
) | |
- name: Install linters | |
run: | | |
python -m pip install --upgrade pre-commit pylint[spelling] mypy typing-extensions | |
- name: pre-commit | |
run: | | |
python -m pre_commit --version | |
python -m pre_commit install --install-hooks | |
python -m pre_commit run --all-files |