Skip to content

Commit

Permalink
Merge pull request #7 from gonicus/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
fluxxcode authored Dec 20, 2023
2 parents ea402e3 + 2b0bb89 commit adb1d1c
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 5 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

name: Create and publish a Docker image to GitHub packages

on:
push:
tags:
- "v*"

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-20.04

permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
19 changes: 19 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: flake8 Lint

on: [push, pull_request]

jobs:
flake8-lint:
runs-on: ubuntu-latest
name: Lint
steps:
- name: Check out source repository
uses: actions/checkout@v3
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: flake8 Lint
uses: py-actions/flake8@v2
with:
max-line-length: "120"
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: test

on: [push, pull_request]

jobs:
unit-tests:
runs-on: ubuntu-20.04
name: test
steps:
- uses: actions/checkout@v4
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: "3.8.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry install
- name: Run tests
run: poetry run python -m unittest -v test/test*.py
2 changes: 1 addition & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ami_client:

# General config
general:
log_level: "DEBUG"
log_level: "INFO"
login_validation_timeout: 10
response_timeout: 10
ping_timeout: 20
Expand Down
8 changes: 4 additions & 4 deletions test/test_metric_values.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import unittest
from dataclasses import dataclass
from typing import Dict, Any, Sequence, List
from metric_values import MetricValue, MetricValueCounter, MetricValueGauge
from prometheus_client import Counter, Gauge
from metric_values import MetricValueCounter, MetricValueGauge
from prometheus_client import Gauge


@dataclass
Expand All @@ -21,7 +21,7 @@ def inc(self, val):
self.last_inc = val

def labels(self, **labelkwargs: Any):
label_values = tuple(str(labelkwargs[l]) for l in self.__label_names)
label_values = tuple(str(labelkwargs[label]) for label in self.__label_names)

if label_values in self.child_counters:
return self.child_counters[label_values]
Expand All @@ -45,7 +45,7 @@ def inc(self, val):
self.last_inc = val

def labels(self, **labelkwargs: Any):
label_values = tuple(str(labelkwargs[l]) for l in self.__label_names)
label_values = tuple(str(labelkwargs[label]) for label in self.__label_names)

if label_values in self.child_gauges:
return self.child_gauges[label_values]
Expand Down

0 comments on commit adb1d1c

Please sign in to comment.