Skip to content

Commit 4e5b95f

Browse files
#54 - Add QA tooling (#55)
* #54 - Add QA tooling - initial setup of QA tools - applied Black * - add wokflow * Refactor access configuration loading and error handling in EventBridge writer for improved readability and maintainability Refactor event_gate_lambda and writer modules for improved type hinting, logging, and error handling; enhance readability and maintainability Refactor event writers to improve type hinting and logging; enhance error handling in write methods Add copyright headers and licensing information to source files Enhance error handling and logging in writers; refactor tests to use pytest Refactor code for consistency and readability; update requirements for testing and dependencies * Add CodeRabbit recommendations * Refactor configuration imports and enhance error handling in Kafka writer * Refactor import handling and improve error logging in Kafka writer and event gate lambda * Add more test * Enhance Kafka writer with configurable flush timeout and improved error handling * Add QA tooling documentation and configuration for testing environment * Remove section on running Action locally from developer documentation * Fixed PR comments * Update Python environment setup and enhance local development documentation --------- Co-authored-by: Oto Macenauer <[email protected]>
1 parent f687105 commit 4e5b95f

23 files changed

+2572
-634
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @ABMC831 @OlivieFranklova @Zejnilovic @oto-macenauer-absa @petr-pokorny-absa
1+
* @ABMC831 @Zejnilovic @oto-macenauer-absa @petr-pokorny-absa

.github/workflows/test.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: Build and Test
2+
on:
3+
pull_request:
4+
branches:
5+
- '**'
6+
types: [ opened, synchronize, reopened ]
7+
8+
jobs:
9+
static-code-analysis:
10+
runs-on: ubuntu-latest
11+
name: Pylint Static Code Analysis
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
with:
16+
persist-credentials: false
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.11'
22+
cache: 'pip'
23+
24+
- name: Install dependencies
25+
run: |
26+
pip install -r requirements.txt
27+
28+
- name: Analyze code with Pylint
29+
id: analyze-code
30+
run: |
31+
pylint_score=$(pylint $(git ls-files '*.py')| grep 'rated at' | awk '{print $7}' | cut -d'/' -f1)
32+
echo "PYLINT_SCORE=$pylint_score" >> $GITHUB_ENV
33+
34+
- name: Check Pylint score
35+
run: |
36+
if (( $(echo "$PYLINT_SCORE < 9.5" | bc -l) )); then
37+
echo "Failure: Pylint score is below 9.5 (project score: $PYLINT_SCORE)."
38+
exit 1
39+
else
40+
echo "Success: Pylint score is above 9.5 (project score: $PYLINT_SCORE)."
41+
fi
42+
43+
code-format-check:
44+
runs-on: ubuntu-latest
45+
name: Black Format Check
46+
steps:
47+
- name: Checkout repository
48+
uses: actions/[email protected]
49+
with:
50+
persist-credentials: false
51+
52+
- name: Set up Python
53+
uses: actions/[email protected]
54+
with:
55+
python-version: '3.11'
56+
cache: 'pip'
57+
58+
- name: Install dependencies
59+
run: |
60+
pip install -r requirements.txt
61+
62+
- name: Check code format with Black
63+
id: check-format
64+
run: |
65+
black --check $(git ls-files '*.py')
66+
67+
unit-test:
68+
name: Unit Tests
69+
runs-on: ubuntu-latest
70+
71+
defaults:
72+
run:
73+
shell: bash
74+
75+
steps:
76+
- uses: actions/checkout@v4
77+
with:
78+
fetch-depth: 0
79+
persist-credentials: false
80+
81+
- uses: actions/setup-python@v5
82+
with:
83+
python-version: '3.11'
84+
cache: 'pip'
85+
86+
- name: Install Python dependencies
87+
run: |
88+
pip install -r requirements.txt
89+
90+
- name: Check code coverage with Pytest
91+
run: pytest --cov=. -v tests/ --cov-fail-under=80
92+
93+
mypy-check:
94+
runs-on: ubuntu-latest
95+
name: Mypy Type Check
96+
steps:
97+
- name: Checkout repository
98+
uses: actions/[email protected]
99+
with:
100+
persist-credentials: false
101+
102+
- name: Set up Python
103+
uses: actions/[email protected]
104+
with:
105+
python-version: '3.11'
106+
cache: 'pip'
107+
108+
- name: Install dependencies
109+
run: |
110+
pip install -r requirements.txt
111+
- name: Check types with Mypy
112+
id: check-types
113+
run: |
114+
mypy .

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ __pycache__
66
/terraform/*.tfvars
77
/terraform/*.tfstate*
88
/terraform/.terraform*
9+
/.idea/

0 commit comments

Comments
 (0)