-
Notifications
You must be signed in to change notification settings - Fork 1
Cloud agnostic logger #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
andrei-kalashnikov
wants to merge
15
commits into
main
Choose a base branch
from
feature/andrey/cloud-agnostic-logger
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
20d9996
Dependencies update, configuration fix, tests basics
andrei-kalashnikov 27f2be7
Formatter fixes
andrei-kalashnikov e59cc9d
Mypy issues fix
andrei-kalashnikov fe93449
Refactoring
andrei-kalashnikov 43b3f9b
Test for middleware
andrei-kalashnikov 1df7957
Tests for LogRequestAndResponseMiddleware
andrei-kalashnikov 129c416
Tests for GrapheneSetUserContextMiddleware
andrei-kalashnikov fb04baa
Tests for formatters
andrei-kalashnikov 2a37aab
mypy fixes, polishing
andrei-kalashnikov b493cdc
mypy fixes, polishing
andrei-kalashnikov 2e8b055
mypy fixes, polishing
andrei-kalashnikov c3a0bb0
Readme fixes, pr validation pipeline
andrei-kalashnikov ee61074
Python version up for configs, pipelines fixes
andrei-kalashnikov c990f60
Taskfile fix
andrei-kalashnikov 5cdb716
Cleanup
andrei-kalashnikov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,20 @@ | ||
[run] | ||
omit = | ||
*/.local/* | ||
*/apps.py | ||
*/admin.py | ||
*/journey_tests/* | ||
*/asgi.py | ||
*/wsgi.py | ||
*/settings* | ||
*/manage.py | ||
*/streamlit_main.py | ||
*/migrations/* | ||
source = django_google_structured_logger | ||
relative_files = True | ||
|
||
[html] | ||
directory = coverage-reports | ||
|
||
[xml] | ||
output = coverage-reports/coverage.xml |
This file contains hidden or 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,60 @@ | ||
name: PR Validation | ||
|
||
on: | ||
pull_request: | ||
branches: main | ||
push: | ||
branches: main | ||
|
||
jobs: | ||
quality-check: | ||
runs-on: ubuntu-24.04 | ||
name: Source code quality check | ||
steps: | ||
- name: Get latest SHA on the branch | ||
id: get_sha | ||
run: | | ||
echo "COMMIT_SHA=${{ github.event.pull_request.head.sha || github.sha }}" >> $GITHUB_OUTPUT | ||
|
||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ steps.get_sha.outputs.COMMIT_SHA }} | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.13" | ||
|
||
- name: Install Poetry and dependencies | ||
run: | | ||
pip install poetry==2.1.2 | ||
poetry sync -vv --all-groups --no-cache --no-interaction | ||
|
||
- name: Run tests | ||
run: | | ||
echo '### tests result' >> $GITHUB_STEP_SUMMARY | ||
echo '```' >> $GITHUB_STEP_SUMMARY | ||
poetry run pytest >> $GITHUB_STEP_SUMMARY | ||
echo '```' >> $GITHUB_STEP_SUMMARY | ||
|
||
- name: Type checks | ||
run: | | ||
echo '### mypy checks' >> $GITHUB_STEP_SUMMARY | ||
echo '```' >> $GITHUB_STEP_SUMMARY | ||
poetry run mypy django_google_structured_logger >> $GITHUB_STEP_SUMMARY | ||
poetry run mypy tests >> $GITHUB_STEP_SUMMARY | ||
echo '```' >> $GITHUB_STEP_SUMMARY | ||
|
||
- name: Lint | ||
run: | | ||
echo '### ruff linter checks' >> $GITHUB_STEP_SUMMARY | ||
echo '```' >> $GITHUB_STEP_SUMMARY | ||
poetry run ruff check >> $GITHUB_STEP_SUMMARY | ||
echo '```' >> $GITHUB_STEP_SUMMARY | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v5 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: ./coverage-reports/coverage.xml |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,105 @@ | ||
# https://taskfile.dev | ||
|
||
version: "3" | ||
|
||
vars: | ||
GITHUB_REPOSITORY_OWNER: muehlemann-popp | ||
GITHUB_REPOSITORY: django-google-structured-logger | ||
GIT_SHA: | ||
sh: git rev-parse --short=8 HEAD | ||
CURRENT_DATETIME: | ||
sh: date +"%Y-%m-%d_%H-%M-%S" | ||
DIR_SRC: ./django_google_structured_logger | ||
DIR_TESTS: ./tests | ||
|
||
tasks: | ||
default: | ||
desc: Display list of all available tasks | ||
cmds: | ||
- task --list-all | ||
silent: true | ||
|
||
# Local environment | ||
|
||
poetry:install: | ||
desc: Install dependencies without changes in lock file | ||
cmds: | ||
- poetry install -vv --all-groups | ||
|
||
poetry:install:ci: | ||
desc: Install dependencies like in CI pipeline | ||
cmds: | ||
- poetry sync -vv --without=dev --no-cache --no-interaction | ||
|
||
# Python Specific | ||
|
||
py:format:src: | ||
desc: Format python files in src directory | ||
dir: "{{.DIR_SRC}}" | ||
cmds: | ||
- poetry run ruff check --select I --fix | ||
- poetry run ruff format | ||
|
||
py:format:tests: | ||
desc: Format python files in tests directory | ||
dir: "{{.DIR_TESTS}}" | ||
cmds: | ||
- poetry run ruff check --select I --fix | ||
- poetry run ruff format | ||
|
||
py:format:all: | ||
desc: Format all Python files in src and tests directories | ||
cmds: | ||
- task: py:format:src | ||
- task: py:format:tests | ||
|
||
checks:mypy: | ||
desc: Run mypy check | ||
cmds: | ||
- poetry run mypy {{.DIR_SRC}} | ||
- poetry run mypy {{.DIR_TESTS}} | ||
|
||
checks:tests: | ||
desc: Run tests | ||
cmds: | ||
- poetry run pytest | ||
|
||
checks:ruff: | ||
desc: Run ruff checks | ||
cmds: | ||
- poetry run ruff check --fix | ||
|
||
checks:coverage: | ||
desc: Run code coverage check | ||
ignore_error: true | ||
cmds: | ||
- poetry run coverage run -m pytest -vv {{.CLI_ARGS}} | ||
|
||
precommit: | ||
desc: Run all checks | ||
cmds: | ||
- task: py:format:all | ||
- task: checks:ruff | ||
- task: checks:mypy | ||
- task: checks:coverage | ||
|
||
# GitHub CLI | ||
|
||
github:repository:getid: | ||
desc: Get repository id with GitHub CLI | ||
cmds: | ||
- "gh api -H 'Accept: application/vnd.github+json' repos/{{ .GITHUB_REPOSITORY_OWNER }}/{{ .CLI_ARGS | default .GITHUB_REPOSITORY_NAME }} | jq .id" | ||
|
||
# git cli | ||
|
||
git:diff: | ||
desc: Prepare git diff for review | ||
cmds: | ||
- mkdir -p ./var | ||
- git diff > ./var/git_diff | ||
|
||
git:diff:main: | ||
desc: Prepare comparison between current branch and main branch for review | ||
cmds: | ||
- mkdir -p ./var | ||
- git diff main..HEAD > ./var/git_diff |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking further, I want to use a common logger for VarioSystems FastAPI project. Is it compatible?