Skip to content

Commit 0dcbd53

Browse files
committed
- add wokflow
1 parent b1956b3 commit 0dcbd53

File tree

2 files changed

+118
-1
lines changed

2 files changed

+118
-1
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: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
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: Set PYTHONPATH environment variable
91+
run: echo "PYTHONPATH=${GITHUB_WORKSPACE}/release_notes_generator/release_notes_generator" >> $GITHUB_ENV
92+
93+
- name: Check code coverage with Pytest
94+
run: pytest --cov=. -v tests/ --cov-fail-under=80
95+
96+
mypy-check:
97+
runs-on: ubuntu-latest
98+
name: Mypy Type Check
99+
steps:
100+
- name: Checkout repository
101+
uses: actions/[email protected]
102+
with:
103+
persist-credentials: false
104+
105+
- name: Set up Python
106+
uses: actions/[email protected]
107+
with:
108+
python-version: '3.11'
109+
cache: 'pip'
110+
111+
- name: Install dependencies
112+
run: |
113+
pip install -r requirements.txt
114+
- name: Check types with Mypy
115+
id: check-types
116+
run: |
117+
mypy .

0 commit comments

Comments
 (0)