Skip to content

Commit

Permalink
Rolled back and re-added files again
Browse files Browse the repository at this point in the history
  • Loading branch information
amila-desilva committed Aug 22, 2024
1 parent 39d74d4 commit d38e314
Show file tree
Hide file tree
Showing 103 changed files with 6,926 additions and 18,035 deletions.
2 changes: 0 additions & 2 deletions .coveragerc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- e.g. [#1020] Make bash_runcommand in WorkUnitSubmit class configurable -->

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

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

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:
POETRY: ${{vars.POETRY}}
jobs:
make-build:
name: Make build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Test Coverage
on:
pull_request:
branches:
main
push:
branches:
"main"
workflow_dispatch:
env:
POETRY_HOME: ${{vars.POETRY_HOME}}
POETRY: ${{vars.POETRY}}
HPCC_USERNAME: ${{ secrets.HPCC_USERNAME }}
HPCC_PASSWORD: ${{ secrets.HPCC_PASSWORD }}
DUMMY_USERNAME: ${{ vars.DUMMY_USERNAME }}
DUMMY_PASSWORD: ${{ vars.DUMMY_PASSWORD }}
HPCC_HOST: ${{ vars.HPCC_HOST }}
HPCC_PORT: ${{ vars.HPCC_PORT }}
DUMMY_HOST: ${{ vars.DUMMY_HOST }}
DUMMY_PORT: ${{ vars.DUMMY_PORT }}
LANDING_ZONE_IP: ${{ vars.LANDING_ZONE_IP }}
LANDING_ZONE_PATH: ${{ vars.LANDING_ZONE_PATH }}
DFU_CLUSTER: ${{ vars.DFU_CLUSTER }}
ENV: ${{ vars.ENV }}
HPCC_PROTOCOL: ${{ vars.HPCC_PROTOCOL }}
jobs:
coverage:
name: PyTest coverage
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- uses: actions/checkout@v4
- name: Install python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Poetry and dependencies
run: ./scripts/poetry-install.sh
- name: Run Tests
run: |
$POETRY run coverage run
continue-on-error: true
- name: Get Cover
id: coverage_comment
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Store Pull Request comment to be posted
uses: actions/upload-artifact@v4
if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
with:
# If you use a different name, update COMMENT_ARTIFACT_NAME accordingly
name: python-coverage-comment-action
# If you use a different name, update COMMENT_FILENAME accordingly
path: python-coverage-comment-action.txt
36 changes: 36 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# .github/workflows/coverage.yml
name: Post coverage comment

on:
workflow_run:
workflows: ["CI"]
types:
- completed

jobs:
test:
name: Run tests & display coverage
runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
permissions:
# Gives the action the necessary permissions for publishing new
# comments in pull requests.
pull-requests: write
# Gives the action the necessary permissions for editing existing
# comments (to avoid publishing multiple comments in the same PR)
contents: write
# Gives the action the necessary permissions for looking up the
# workflow that launched this workflow, and download the related
# artifact that contains the comment to be published
actions: read
steps:
# DO NOT run actions/checkout here, for security reasons
# For details, refer to https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
- name: Post comment
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }}
# Update those if you changed the default values:
# COMMENT_ARTIFACT_NAME: python-coverage-comment-action
# COMMENT_FILENAME: python-coverage-comment-action.txt
1 change: 1 addition & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:
POETRY: ${{vars.POETRY}}
jobs:
docs:
name: Make docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
pull_number: context.issue.number
})
const isTitleValid = /^\[#\d+\] /.test(pr.data.title)
const isDescriptionValid = /([Ff]ix(es|ed)?|[Cc]lose(s|d)?|[Rr]esolve(s|d)?|[Pp]art [Oo]f) \[.*\]\(.*\)/.test(pr.data.body)
const isDescriptionValid = /([Ff]ix(es|ed)?|[Cc]lose(s|d)?|[Rr]esolve(s|d)?|[Pp]art [Oo]f) #\d+/.test(pr.data.body)
if (isTitleValid && isDescriptionValid) {
return
}
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/pytest-coverage.yaml

This file was deleted.

23 changes: 21 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ env:
POETRY: ${{vars.POETRY}}
jobs:
build:
name: Make Release build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -43,5 +44,23 @@ jobs:
- run: gh release upload ${{ github.event.release.tag_name }} dist/*.{tar.gz,whl}
env:
GH_TOKEN: ${{ github.token }}



## Future integration with PyPI
# upload-pypi:
# name: Upload (PyPI)
# runs-on: ubuntu-latest
# environment:
# name: pypi
# url: https://pypi.org/project/pyhpcc/
# permissions:
# id-token: write
# needs: build
# steps:
# - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
# with:
# name: distfiles
# path: dist/

# - uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14
# with:
# password: <SECRET PYPI TOKEN>
1 change: 1 addition & 0 deletions .github/workflows/ruff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
main
jobs:
ruff:
name: Ruff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
21 changes: 14 additions & 7 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,21 @@ env:
POETRY: ${{vars.POETRY}}
HPCC_USERNAME: ${{ secrets.HPCC_USERNAME }}
HPCC_PASSWORD: ${{ secrets.HPCC_PASSWORD }}
DUMMY_USERNAME: ${{ secrets.DUMMY_USERNAME }}
DUMMY_PASSWORD: ${{ secrets.DUMMY_PASSWORD }}
HPCC_HOST: ${{ secrets.HPCC_HOST }}
HPCC_PORT: ${{ secrets.HPCC_PORT }}
DUMMY_HOST: ${{ secrets.DUMMY_HOST }}
DUMMY_PORT: ${{ secrets.DUMMY_PORT }}
DUMMY_USERNAME: ${{ vars.DUMMY_USERNAME }}
DUMMY_PASSWORD: ${{ vars.DUMMY_PASSWORD }}
HPCC_HOST: ${{ vars.HPCC_HOST }}
HPCC_PORT: ${{ vars.HPCC_PORT }}
DUMMY_HOST: ${{ vars.DUMMY_HOST }}
DUMMY_PORT: ${{ vars.DUMMY_PORT }}
LANDING_ZONE_IP: ${{ vars.LANDING_ZONE_IP }}
LANDING_ZONE_PATH: ${{ vars.LANDING_ZONE_PATH }}
DFU_CLUSTER: ${{ vars.DFU_CLUSTER }}
ENV: ${{ vars.ENV }}
HPCC_PROTOCOL: ${{ vars.HPCC_PROTOCOL }}

jobs:
tests:
name: Pytest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -29,4 +36,4 @@ jobs:
- name: Install Poetry and dependencies
run: ./scripts/poetry-install.sh
- name: Python tests
run: $POETRY run pytest
run: $POETRY run pytest -rs
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
poetry.lock
.DS_Store

# PyInstaller
Expand Down
66 changes: 52 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,38 @@ We value your interest in contributing to `PyHPCC.`

Thank you

- Check the issue tab for any issues that you would like to work on
- Comment on the issue showing your interest to work on the issue
- 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.

## Project Structure
```
.
└── pyhpcc/
├── .github # contains build, release, test and other gh actions
├── docs/ # contains files for documentation
├── examples/ # contains starter examples
├── scripts # GitHub CI/CD Poetry install script
├── src/
── pyhpcc/
├── handlers/ # contains thor and roxie handler
└── models/ # contains classes auth, workunit submit
│ └── tests/
├── models/
├── test_files/ # contains resource files needed for testing
└── hanlders/
── pyhpcc/
├── handlers/ # contains thor and roxie handler
└── models/ # contains classes auth, workunit submit
── tests/
│ ├── models/
│ ├── test_files/ # contains resource files needed for testing
│ └── handlers/
├── pyproject.toml # Project config
├── MAINTAINING.md
├── CONTRIBUTING.md
└── README.md
├── README.md
└── LICENSE
```

## Set up the repository locally.
## Prerequisites
Before starting to develop, make sure you install the following software:
1. [Python3](https://www.python.org/downloads/)
2. [ECL Client Tools](https://hpccsystems.com/download/): Select your operating systems to download client tools
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))
3. [Poetry](https://python-poetry.org/docs/#installation)

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

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

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.

Running whole test suite

```
pytest # Run in project root
```

Running a specific test file

```
pytest tests/models/test_workunit_submit.py # /path/to/test_file
```

Running a specific test
```
pytest run # Run in project root
pytest tests/models/test_workunit_submit.py::test_create_file # /path/to/test_file::test_name
```

## How to build docs
In the root folder after completing the installation setup:

Run the following command. This will rebuild Sphinx documentation on changes, with hot reloading in the browser.

``` bash
sphinx-autobuild docs/source docs/build # Builds the docs and creates a live server that reloads on changes
```

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

``` bash
pip install ruff
ruff check # For linting your code.
ruff check # For check any lint errors
ruff check --fix # Applies fix to resolve lint violations for safe fixes
ruff format # For formatting your code.
```

Expand All @@ -78,11 +110,17 @@ poetry run coverage run
poetry run coverage report
```



## Submitting an PR
[Create a PR](https://help.github.com/articles/creating-a-pull-request/) with the following configuration:

The base branch is the main repo's main branch.
- Create a feature branch with the name `features/<issue_id_to_be_fixed>_<short description>` from the `dev` branch
- Commit your changes and push the changes to your fork.
- Create a PR to the `dev` branch
- 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 `
- PR description: mention the issue number in this format: Fixes #1020. Doing so will automatically close the related issue once the PR is merged.
- Please Ensure that "Allow edits from maintainers" is ticked.
- Please describe the changes you have made in your branch and how they resolve the issue.
- Please describe the changes you have made in your branch and how they resolve the issue.
- Ensure code code coverage is above 85% for file and overall
- 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.
- Make changes mentioned by reviewer.
Loading

0 comments on commit d38e314

Please sign in to comment.