-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from imrehg/tuning
Changes since the first release
- Loading branch information
Showing
12 changed files
with
186 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Python | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
python-version: ['3.9', '3.10'] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Switch to Current Branch | ||
run: git checkout ${{ env.BRANCH }} | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install 'poetry>=1.2.0b1' | ||
poetry plugin add poetry-dynamic-versioning-plugin | ||
poetry install | ||
- name: Run linting | ||
run: | | ||
poetry run isort --check src/ tests/ | ||
poetry run black --check src/ tests/ | ||
poetry run flake8 src/ tests/ | ||
poetry run mypy src | ||
poetry run bandit src | ||
- name: Run unit tests | ||
run: | | ||
poetry run coverage run -m pytest | ||
poetry run coverage report -m |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
|
||
# Ignore dynaconf secret files | ||
# Ignore various secret files | ||
.secrets.* | ||
.env | ||
|
||
# Coverage.py generated data | ||
.coverage | ||
# Built packages | ||
dist/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
FROM python:3.9 | ||
|
||
ENV PYTHONUNBUFFERED=1 \ | ||
# prevents python creating .pyc files | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
\ | ||
# pip | ||
PIP_NO_CACHE_DIR=off \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=on \ | ||
PIP_DEFAULT_TIMEOUT=100 \ | ||
\ | ||
# poetry minimal version | ||
POETRY_VERSION=1.2.0b1 \ | ||
# make poetry create the virtual environment in the project's root | ||
# it gets named `.venv` | ||
POETRY_VIRTUALENVS_IN_PROJECT=true \ | ||
# do not ask any interactive question | ||
POETRY_NO_INTERACTION=1 | ||
|
||
RUN pip install --upgrade pip \ | ||
&& pip install 'poetry>=$POETRY_VERSION' | ||
|
||
WORKDIR /opt/app | ||
|
||
# Install dependencies | ||
COPY pyproject.toml poetry.lock ./ | ||
|
||
# Install the dependencies first, then add the versioning | ||
# plugin to remove the need to mount the `.git` folder, and | ||
# thus caching better. | ||
RUN poetry install --without=dev --no-root \ | ||
&& poetry plugin add poetry-dynamic-versioning-plugin | ||
|
||
# Install the project | ||
COPY src ./src | ||
RUN --mount=source=.git,target=.git,type=bind \ | ||
poetry dynamic-versioning \ | ||
&& poetry install --without=dev | ||
|
||
CMD ["poetry", "run", "linkhub_exporter"] |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Copy this to `.env` and fill in your key | ||
DYNACONF_REQUEST_KEY='' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "linkhub_prometheus_exporter" | ||
version = "0.1.0" | ||
version = "0.0.0" | ||
description = "A Prometheus metrics exporter for Alcatel Linkhub 4G router boxes" | ||
authors = ["Gergely Imreh <[email protected]>"] | ||
|
||
|
@@ -35,13 +35,16 @@ module = [ | |
ignore_missing_imports = true | ||
|
||
[tool.poetry.scripts] | ||
exporter = "linkhub_prometheus_exporter.exporter:main" | ||
linkhub_exporter = "linkhub_prometheus_exporter.exporter:main" | ||
|
||
[tool.poetry-dynamic-versioning] | ||
enable = true | ||
vcs = "git" | ||
style = "pep440" | ||
|
||
[tool.poetry-dynamic-versioning.substitution] | ||
files = ["*/__init__.py", "*/*/__init__.py"] | ||
|
||
[build-system] | ||
requires = ["poetry>=1.2.0b1", "poetry-dynamic-versioning-plugin"] | ||
build-backend = "poetry.masonry.api" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
# Copy this file to `.secrets.toml` and fill in the values | ||
[default] | ||
request_key = '' |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Will be dynamically filled | ||
__version__ = "0.0.0" |
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
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
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