Skip to content

Commit e958fef

Browse files
Merge pull request #6 from RohithSurya/features/gh_actions
Github workflow for docs, coverage, tests
2 parents 78fa01c + 3b13f7a commit e958fef

11 files changed

+186
-40
lines changed

.github/pull_request_template.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!-- Before opening a PR, please read our PR guidelines in CONTRIBUTING.md-->
2+
3+
<!-- PR title: Copy-and-paste the name of the issue this PR is fixing, -->
4+
<!-- and include the issue number in front in square brackets. -->
5+
<!-- e.g. [#1020] Make bash_runcommand in WorkUnitSubmit class configurable -->
6+
7+
<!-- Add the issue number to the "Fixes" keyword below. This will automatically close the issue once the PR is merged -->
8+
Fixes #
9+
10+
### Type of change: <!--- Bug, Feature, Test, Doc -->
11+
12+
### Description
13+
<!--- Describe your changes in detail -->
14+
15+
### Checklist
16+
- Did I make sure I wrote the tests if I have implemented new functionality?
17+
- Did I make sure the test coverage meets the guidelines specified in CONTRIBUTING.md?
18+
- Did I lint and format the code?

.github/workflows/build.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Make build
2+
on:
3+
push:
4+
branches:
5+
main
6+
pull_request:
7+
branches:
8+
main
9+
env:
10+
POETRY_HOME: ${{vars.POETRY_HOME}}
11+
POETRY: ${{vars.POETRY}}
12+
jobs:
13+
poetry:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Install python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.12"
21+
- name: Install Poetry and dependencies
22+
run: ./scripts/poetry-install.sh
23+
- name: Make build
24+
run: $POETRY build
25+
- uses: actions/upload-artifact@v4
26+
with:
27+
name: dist
28+
path: ./dist

.github/workflows/docs.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Make docs
2+
on:
3+
push:
4+
branches:
5+
main
6+
pull_request:
7+
branches:
8+
main
9+
env:
10+
POETRY_HOME: ${{vars.POETRY_HOME}}
11+
POETRY: ${{vars.POETRY}}
12+
jobs:
13+
poetry:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Install python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.12"
21+
- name: Install Poetry and dependencies
22+
run: ./scripts/poetry-install.sh
23+
- name: Check docs
24+
working-directory: ./docs
25+
run: $POETRY run make html

.github/workflows/only-run-tests.yaml

-34
This file was deleted.
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test Coverage
2+
on:
3+
push:
4+
branches:
5+
main
6+
pull_request:
7+
branches:
8+
main
9+
workflow_dispatch:
10+
env:
11+
POETRY_HOME: ${{vars.POETRY_HOME}}
12+
POETRY: ${{vars.POETRY}}
13+
jobs:
14+
coverage:
15+
name: PyTest coverage
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Install python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.12"
23+
- name: Install Poetry and dependencies
24+
run: ./scripts/poetry-install.sh
25+
- name: Run Tests
26+
run: |
27+
$POETRY run coverage run -m pytest
28+
continue-on-error: true
29+
- name: Run Coverage
30+
run: $POETRY run coverage xml
31+
- name: Get Cover
32+
uses: orgoro/coverage@v3.1
33+
with:
34+
coverageFile: ./coverage.xml
35+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ruff.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Ruff
2+
on:
3+
push:
4+
branches:
5+
main
6+
pull_request:
7+
branches:
8+
main
9+
jobs:
10+
ruff:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: chartboost/ruff-action@v1

.github/workflows/tests.yaml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Run tests
2+
on:
3+
push:
4+
branches:
5+
main
6+
pull_request:
7+
branches:
8+
main
9+
env:
10+
POETRY_HOME: ${{vars.POETRY_HOME}}
11+
POETRY: ${{vars.POETRY}}
12+
HPCC_USERNAME: ${{ secrets.HPCC_USERNAME }}
13+
HPCC_PASSWORD: ${{ secrets.HPCC_PASSWORD }}
14+
DUMMY_USERNAME: ${{ secrets.DUMMY_USERNAME }}
15+
DUMMY_PASSWORD: ${{ secrets.DUMMY_PASSWORD }}
16+
HPCC_HOST: ${{ secrets.HPCC_HOST }}
17+
HPCC_PORT: ${{ secrets.HPCC_PORT }}
18+
DUMMY_HOST: ${{ secrets.DUMMY_HOST }}
19+
DUMMY_PORT: ${{ secrets.DUMMY_PORT }}
20+
jobs:
21+
poetry:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Install python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: "3.12"
29+
- name: Install Poetry and dependencies
30+
run: ./scripts/poetry-install.sh
31+
- name: Python tests
32+
run: $POETRY run pytest

CONTRIBUTING.md

+18
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,23 @@ ruff format # For formatting your code.
4141
```
4242

4343

44+
## PR Guidelines
45+
For test coverage, please make sure to have more than 85% code coverage for both the individual and overall.
46+
To check code coverage, run the following commands
47+
``` bash
48+
poetry run coverage run
49+
poetry run coverage report
50+
```
51+
52+
## Submitting an PR
53+
[Create a PR](https://help.github.com/articles/creating-a-pull-request/) with the following configuration:
54+
55+
The base branch is the main repo's main branch.
56+
- PR name: copy-and-paste the relevant issue name and include the issue number in front in square brackets, e.g. `[#1020] Make bash_runcommand in WorkUnitSubmit class configurable `
57+
- PR description: mention the issue number in this format: Fixes #1020. Doing so will automatically close the related issue once the PR is merged.
58+
- Please Ensure that "Allow edits from maintainers" is ticked.
59+
- Please describe the changes you have made in your branch and how they resolve the issue.
60+
61+
4462

4563

pyproject.toml

+6-1
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@ elementpath = "^3.0.2" # XPath selectors for XML Data structures
2020
pytest = "^7.1.3"
2121
pytest-mock = "^3.0.2"
2222

23+
[tool.poetry.group.coverage.dependencies]
24+
coverage = "^7.5.3"
2325

24-
26+
#For Python Coverage
27+
[tool.coverage.run]
28+
command_line = "-m pytest"
29+
source = ["."]
2530

2631

2732
[build-system]

scripts/poetry-install.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
python3 -m venv $POETRY_HOME
3+
$POETRY_HOME/bin/pip install poetry==1.2.0
4+
$POETRY install

tests/test_hpcc_api.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# Unit tests to test the authentication module
2-
import config
32
import os # used by test_UploadFile
43
import unittest
5-
64
from datetime import datetime # used by test_UploadFile
7-
from pyhpcc.auth import auth
8-
from pyhpcc.models import hpcc
5+
6+
import config
7+
8+
from pyhpcc.auth import Auth
99
from pyhpcc.errors import HPCCException
10+
from pyhpcc.models import hpcc
1011

1112

1213
class TestHPCCAPI(unittest.TestCase):
@@ -19,7 +20,7 @@ class TestHPCCAPI(unittest.TestCase):
1920
DUMMY_HPCC_HOST = config.DUMMY_HPCC_HOST
2021
DUMMY_HPCC_PORT = config.DUMMY_HPCC_PORT
2122

22-
AUTH_OBJ = auth(HPCC_HOST, HPCC_PORT, HPCC_USERNAME, HPCC_PASSWORD, True, "https")
23+
AUTH_OBJ = Auth(HPCC_HOST, HPCC_PORT, HPCC_USERNAME, HPCC_PASSWORD, True, "https")
2324
HPCC_OBJ = hpcc(AUTH_OBJ)
2425

2526
# Used by test_AddtoSuperfileRequest, test_getSubFileInfoall

0 commit comments

Comments
 (0)