Skip to content

Commit d38e314

Browse files
committed
Rolled back and re-added files again
1 parent 39d74d4 commit d38e314

File tree

103 files changed

+6926
-18035
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+6926
-18035
lines changed

.coveragerc

-2
This file was deleted.

.github/pull_request_template.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<!-- e.g. [#1020] Make bash_runcommand in WorkUnitSubmit class configurable -->
66

77
<!-- Add the issue number to the "Fixes" keyword below. This will automatically close the issue once the PR is merged -->
8-
Fixes [#<JIRA ID>](https://hpccsystems.atlassian.net/browse/HPCC-<JIRA ID>)
8+
Fixes #<Issue ID>
99

1010
### Type of change: <!--- Bug, Feature, Test, Doc -->
1111

.github/workflows/build.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ env:
1111
POETRY: ${{vars.POETRY}}
1212
jobs:
1313
make-build:
14+
name: Make build
1415
runs-on: ubuntu-latest
1516
steps:
1617
- uses: actions/checkout@v4

.github/workflows/ci.yaml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Test Coverage
2+
on:
3+
pull_request:
4+
branches:
5+
main
6+
push:
7+
branches:
8+
"main"
9+
workflow_dispatch:
10+
env:
11+
POETRY_HOME: ${{vars.POETRY_HOME}}
12+
POETRY: ${{vars.POETRY}}
13+
HPCC_USERNAME: ${{ secrets.HPCC_USERNAME }}
14+
HPCC_PASSWORD: ${{ secrets.HPCC_PASSWORD }}
15+
DUMMY_USERNAME: ${{ vars.DUMMY_USERNAME }}
16+
DUMMY_PASSWORD: ${{ vars.DUMMY_PASSWORD }}
17+
HPCC_HOST: ${{ vars.HPCC_HOST }}
18+
HPCC_PORT: ${{ vars.HPCC_PORT }}
19+
DUMMY_HOST: ${{ vars.DUMMY_HOST }}
20+
DUMMY_PORT: ${{ vars.DUMMY_PORT }}
21+
LANDING_ZONE_IP: ${{ vars.LANDING_ZONE_IP }}
22+
LANDING_ZONE_PATH: ${{ vars.LANDING_ZONE_PATH }}
23+
DFU_CLUSTER: ${{ vars.DFU_CLUSTER }}
24+
ENV: ${{ vars.ENV }}
25+
HPCC_PROTOCOL: ${{ vars.HPCC_PROTOCOL }}
26+
jobs:
27+
coverage:
28+
name: PyTest coverage
29+
runs-on: ubuntu-latest
30+
permissions:
31+
pull-requests: write
32+
contents: write
33+
steps:
34+
- uses: actions/checkout@v4
35+
- name: Install python
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: "3.12"
39+
- name: Install Poetry and dependencies
40+
run: ./scripts/poetry-install.sh
41+
- name: Run Tests
42+
run: |
43+
$POETRY run coverage run
44+
continue-on-error: true
45+
- name: Get Cover
46+
id: coverage_comment
47+
uses: py-cov-action/python-coverage-comment-action@v3
48+
with:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
- name: Store Pull Request comment to be posted
51+
uses: actions/upload-artifact@v4
52+
if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
53+
with:
54+
# If you use a different name, update COMMENT_ARTIFACT_NAME accordingly
55+
name: python-coverage-comment-action
56+
# If you use a different name, update COMMENT_FILENAME accordingly
57+
path: python-coverage-comment-action.txt

.github/workflows/coverage.yaml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# .github/workflows/coverage.yml
2+
name: Post coverage comment
3+
4+
on:
5+
workflow_run:
6+
workflows: ["CI"]
7+
types:
8+
- completed
9+
10+
jobs:
11+
test:
12+
name: Run tests & display coverage
13+
runs-on: ubuntu-latest
14+
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
15+
permissions:
16+
# Gives the action the necessary permissions for publishing new
17+
# comments in pull requests.
18+
pull-requests: write
19+
# Gives the action the necessary permissions for editing existing
20+
# comments (to avoid publishing multiple comments in the same PR)
21+
contents: write
22+
# Gives the action the necessary permissions for looking up the
23+
# workflow that launched this workflow, and download the related
24+
# artifact that contains the comment to be published
25+
actions: read
26+
steps:
27+
# DO NOT run actions/checkout here, for security reasons
28+
# For details, refer to https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
29+
- name: Post comment
30+
uses: py-cov-action/python-coverage-comment-action@v3
31+
with:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }}
34+
# Update those if you changed the default values:
35+
# COMMENT_ARTIFACT_NAME: python-coverage-comment-action
36+
# COMMENT_FILENAME: python-coverage-comment-action.txt

.github/workflows/docs.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ env:
1111
POETRY: ${{vars.POETRY}}
1212
jobs:
1313
docs:
14+
name: Make docs
1415
runs-on: ubuntu-latest
1516
steps:
1617
- uses: actions/checkout@v4

.github/workflows/pr.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
pull_number: context.issue.number
2323
})
2424
const isTitleValid = /^\[#\d+\] /.test(pr.data.title)
25-
const isDescriptionValid = /([Ff]ix(es|ed)?|[Cc]lose(s|d)?|[Rr]esolve(s|d)?|[Pp]art [Oo]f) \[.*\]\(.*\)/.test(pr.data.body)
25+
const isDescriptionValid = /([Ff]ix(es|ed)?|[Cc]lose(s|d)?|[Rr]esolve(s|d)?|[Pp]art [Oo]f) #\d+/.test(pr.data.body)
2626
if (isTitleValid && isDescriptionValid) {
2727
return
2828
}

.github/workflows/pytest-coverage.yaml

-34
This file was deleted.

.github/workflows/release.yaml

+21-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ env:
99
POETRY: ${{vars.POETRY}}
1010
jobs:
1111
build:
12+
name: Make Release build
1213
runs-on: ubuntu-latest
1314
steps:
1415
- uses: actions/checkout@v4
@@ -43,5 +44,23 @@ jobs:
4344
- run: gh release upload ${{ github.event.release.tag_name }} dist/*.{tar.gz,whl}
4445
env:
4546
GH_TOKEN: ${{ github.token }}
46-
47-
47+
48+
## Future integration with PyPI
49+
# upload-pypi:
50+
# name: Upload (PyPI)
51+
# runs-on: ubuntu-latest
52+
# environment:
53+
# name: pypi
54+
# url: https://pypi.org/project/pyhpcc/
55+
# permissions:
56+
# id-token: write
57+
# needs: build
58+
# steps:
59+
# - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
60+
# with:
61+
# name: distfiles
62+
# path: dist/
63+
64+
# - uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14
65+
# with:
66+
# password: <SECRET PYPI TOKEN>

.github/workflows/ruff.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
main
99
jobs:
1010
ruff:
11+
name: Ruff
1112
runs-on: ubuntu-latest
1213
steps:
1314
- uses: actions/checkout@v4

.github/workflows/tests.yaml

+14-7
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,21 @@ env:
1111
POETRY: ${{vars.POETRY}}
1212
HPCC_USERNAME: ${{ secrets.HPCC_USERNAME }}
1313
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 }}
14+
DUMMY_USERNAME: ${{ vars.DUMMY_USERNAME }}
15+
DUMMY_PASSWORD: ${{ vars.DUMMY_PASSWORD }}
16+
HPCC_HOST: ${{ vars.HPCC_HOST }}
17+
HPCC_PORT: ${{ vars.HPCC_PORT }}
18+
DUMMY_HOST: ${{ vars.DUMMY_HOST }}
19+
DUMMY_PORT: ${{ vars.DUMMY_PORT }}
20+
LANDING_ZONE_IP: ${{ vars.LANDING_ZONE_IP }}
21+
LANDING_ZONE_PATH: ${{ vars.LANDING_ZONE_PATH }}
22+
DFU_CLUSTER: ${{ vars.DFU_CLUSTER }}
23+
ENV: ${{ vars.ENV }}
24+
HPCC_PROTOCOL: ${{ vars.HPCC_PROTOCOL }}
25+
2026
jobs:
2127
tests:
28+
name: Pytest
2229
runs-on: ubuntu-latest
2330
steps:
2431
- uses: actions/checkout@v4
@@ -29,4 +36,4 @@ jobs:
2936
- name: Install Poetry and dependencies
3037
run: ./scripts/poetry-install.sh
3138
- name: Python tests
32-
run: $POETRY run pytest
39+
run: $POETRY run pytest -rs

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ share/python-wheels/
2626
.installed.cfg
2727
*.egg
2828
MANIFEST
29-
poetry.lock
3029
.DS_Store
3130

3231
# PyInstaller

CONTRIBUTING.md

+52-14
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,38 @@ We value your interest in contributing to `PyHPCC.`
44

55
Thank you
66

7+
- Check the issue tab for any issues that you would like to work on
8+
- Comment on the issue showing your interest to work on the issue
9+
- Raise a PR request to the repository and it will be reviewed for it to be merged. For more guidelines on creating a PR check [Submitting an PR](#submitting-an-pr) section.
10+
711
## Project Structure
812
```
913
.
1014
└── pyhpcc/
1115
├── .github # contains build, release, test and other gh actions
1216
├── docs/ # contains files for documentation
1317
├── examples/ # contains starter examples
18+
├── scripts # GitHub CI/CD Poetry install script
1419
├── src/
15-
── pyhpcc/
16-
├── handlers/ # contains thor and roxie handler
17-
└── models/ # contains classes auth, workunit submit
18-
│ └── tests/
19-
├── models/
20-
├── test_files/ # contains resource files needed for testing
21-
└── hanlders/
20+
── pyhpcc/
21+
├── handlers/ # contains thor and roxie handler
22+
└── models/ # contains classes auth, workunit submit
23+
── tests/
24+
│ ├── models/
25+
│ ├── test_files/ # contains resource files needed for testing
26+
│ └── handlers/
2227
├── pyproject.toml # Project config
28+
├── MAINTAINING.md
2329
├── CONTRIBUTING.md
24-
└── README.md
30+
├── README.md
31+
└── LICENSE
2532
```
2633

2734
## Set up the repository locally.
2835
## Prerequisites
2936
Before starting to develop, make sure you install the following software:
3037
1. [Python3](https://www.python.org/downloads/)
31-
2. [ECL Client Tools](https://hpccsystems.com/download/): Select your operating systems to download client tools
38+
2. [ECL Client Tools](https://hpccsystems.com/download/): Select your operating systems to download client tools (More instructions to setup client-tools is mentioned in [README.md](README.md))
3239
3. [Poetry](https://python-poetry.org/docs/#installation)
3340

3441
After installing the prerequisites, fork the repository.
@@ -50,8 +57,32 @@ Since ecl client tools aren't installed in the GitHub runner, some tests are ski
5057

5158
Some tests will fail if `ecl client tools` aren't installed.
5259

60+
Create `my-secret.py` in project root and copy the contents of `my-secret-dummy.py`. Since, some of the tests require access to HPCC Cluster.
61+
62+
Running whole test suite
63+
64+
```
65+
pytest # Run in project root
66+
```
67+
68+
Running a specific test file
69+
70+
```
71+
pytest tests/models/test_workunit_submit.py # /path/to/test_file
72+
```
73+
74+
Running a specific test
5375
```
54-
pytest run # Run in project root
76+
pytest tests/models/test_workunit_submit.py::test_create_file # /path/to/test_file::test_name
77+
```
78+
79+
## How to build docs
80+
In the root folder after completing the installation setup:
81+
82+
Run the following command. This will rebuild Sphinx documentation on changes, with hot reloading in the browser.
83+
84+
``` bash
85+
sphinx-autobuild docs/source docs/build # Builds the docs and creates a live server that reloads on changes
5586
```
5687

5788
## Linting and Formatting
@@ -65,7 +96,8 @@ You can also install `ruff` using pip
6596

6697
``` bash
6798
pip install ruff
68-
ruff check # For linting your code.
99+
ruff check # For check any lint errors
100+
ruff check --fix # Applies fix to resolve lint violations for safe fixes
69101
ruff format # For formatting your code.
70102
```
71103

@@ -78,11 +110,17 @@ poetry run coverage run
78110
poetry run coverage report
79111
```
80112

113+
114+
81115
## Submitting an PR
82116
[Create a PR](https://help.github.com/articles/creating-a-pull-request/) with the following configuration:
83-
84-
The base branch is the main repo's main branch.
117+
- Create a feature branch with the name `features/<issue_id_to_be_fixed>_<short description>` from the `dev` branch
118+
- Commit your changes and push the changes to your fork.
119+
- Create a PR to the `dev` branch
85120
- 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 `
86121
- PR description: mention the issue number in this format: Fixes #1020. Doing so will automatically close the related issue once the PR is merged.
87122
- Please Ensure that "Allow edits from maintainers" is ticked.
88-
- Please describe the changes you have made in your branch and how they resolve the issue.
123+
- Please describe the changes you have made in your branch and how they resolve the issue.
124+
- Ensure code code coverage is above 85% for file and overall
125+
- Once PR is raised, check if any checks are failing. Please fix these issues. Pull Requests will not be reviewed if any checks are failing.
126+
- Make changes mentioned by reviewer.

0 commit comments

Comments
 (0)