Skip to content

Commit df943f6

Browse files
committed
Adds code coverage
1 parent e8e85a1 commit df943f6

File tree

4 files changed

+69
-7
lines changed

4 files changed

+69
-7
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Code coverage
2+
3+
env:
4+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
5+
MICROSOFT_EMAIL: [email protected]
6+
USER_NAME: Gurkan Indibay
7+
MAIN_BRANCH: all-citus
8+
DB_USER_NAME: ${{ secrets.STATS_DB_USER_NAME }}
9+
DB_PASSWORD: ${{ secrets.STATS_DB_PASSWORD }}
10+
DB_HOST_AND_PORT: ${{ secrets.STATS_DB_HOST_AND_PORT }}
11+
DB_NAME: ${{ secrets.STATS_DB_NAME }}
12+
PACKAGE_CLOUD_API_TOKEN: ${{ secrets.PACKAGE_CLOUD_API_TOKEN }}
13+
PACKAGE_CLOUD_ADMIN_API_TOKEN: ${{ secrets.PACKAGE_CLOUD_ADMIN_API_TOKEN }}
14+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
15+
PACKAGING_PASSPHRASE: ${{ secrets.PACKAGING_PASSPHRASE }}
16+
PLATFORM: el/8
17+
on:
18+
push:
19+
branches:
20+
- "**"
21+
22+
workflow_dispatch:
23+
24+
jobs:
25+
make-install:
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Check out repository
30+
uses: actions/checkout@v2
31+
- name: Install all scripts
32+
run: make && sudo make install
33+
34+
code_coverage:
35+
runs-on: ubuntu-latest
36+
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v2
40+
with:
41+
fetch-depth: 0
42+
43+
- name: Define git credentials
44+
run: git config --global user.email "${MICROSOFT_EMAIL}"&& git config --global user.name "${USER_NAME}"
45+
46+
- name: Install package dependencies
47+
run: sudo apt-get update && sudo apt-get install libcurl4-openssl-dev libssl-dev python3-testresources
48+
49+
- name: Install python requirements
50+
run: python -m pip install -r packaging_automation/requirements.txt
51+
52+
- name: Run code coverage
53+
run: python -m pytest --cov=packaging_automation packaging_automation/tests/

.github/workflows/tool-tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,19 @@ jobs:
4545
run: python -m prospector
4646

4747
- name: Unit tests for "Common tools"
48-
run: python -m pytest -q packaging_automation/tests/test_common_tool_methods.py
48+
run: coverage run -m pytest -q packaging_automation/tests/test_common_tool_methods.py
4949

5050
- name: Unit tests for "Update Package Properties"
51-
run: python -m pytest -q packaging_automation/tests/test_update_package_properties.py
51+
run: coverage run --cov-append -m pytest -q packaging_automation/tests/test_update_package_properties.py
5252

5353
- name: Unit tests for "Prepare Release"
54-
run: python -m pytest -q packaging_automation/tests/test_prepare_release.py
54+
run: coverage run --cov-append -m pytest -q packaging_automation/tests/test_prepare_release.py
5555

5656
- name: Unit tests for "Update Docker"
57-
run: python -m pytest -q packaging_automation/tests/test_update_docker.py
57+
run: coverage run --cov-append -m pytest -q packaging_automation/tests/test_update_docker.py
5858

5959
- name: Unit tests for "Update Pgxn"
60-
run: python -m pytest -q packaging_automation/tests/test_update_pgxn.py
60+
run: coverage run --cov-append -m pytest -q packaging_automation/tests/test_update_pgxn.py
6161

6262
- name: Packaging Warning Handler
63-
run: python -m pytest -q packaging_automation/tests/test_packaging_warning_handler.py
63+
run: coverage run --cov-append -m pytest -q packaging_automation/tests/test_packaging_warning_handler.py

packaging_automation/requirements.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ urllib3
1616
wheel
1717
python-dotenv
1818
prospector[with_everything]
19+
pytest-cov

packaging_automation/requirements.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ cffi==1.14.5
2020
# via pynacl
2121
chardet==4.0.0
2222
# via requests
23+
coverage[toml]==6.0.2
24+
# via pytest-cov
2325
deprecated==1.2.12
2426
# via pygithub
2527
docker==5.0.0
@@ -130,8 +132,12 @@ pyparsing==2.4.7
130132
# via packaging
131133
pyroma==3.2
132134
# via prospector
133-
pytest==6.2.4
135+
pytest-cov==3.0.0
134136
# via -r requirements.in
137+
pytest==6.2.4
138+
# via
139+
# -r requirements.in
140+
# pytest-cov
135141
python-dotenv==0.19.0
136142
# via -r requirements.in
137143
python-gnupg==0.4.7
@@ -173,6 +179,8 @@ toml==0.10.2
173179
# pylint
174180
# pytest
175181
# vulture
182+
tomli==1.2.1
183+
# via coverage
176184
typing-extensions==3.10.0.2
177185
# via mypy
178186
urllib3==1.26.6

0 commit comments

Comments
 (0)