Skip to content

Commit

Permalink
Fixes PYT-900 : Initial migration: Write pre commit action (#4)
Browse files Browse the repository at this point in the history
Github Action for pre-commit validations on the Delphix Virtualization SDK repo.
  • Loading branch information
muralinimmagadda authored Jan 29, 2020
1 parent 01c3404 commit 2c73c64
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 5 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Pre-commit actions for Delphix Virtualization SDK

on: [pull_request]

jobs:
pytest:
name: Test ${{ matrix.package }} on ${{ matrix.os }} using pytest
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 4
matrix:
python-version: [2.7]
os: [ubuntu-latest, macos-latest]
package: [common, libs, platform, tools]

steps:
- name: Checkout ${{ matrix.package }} project
uses: actions/checkout@v1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install ${{ matrix.package }} dependencies
working-directory: ${{ matrix.package }}
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt --find-links https://test.pypi.org/simple/dvp-api/
- name: Install ${{ matrix.package }} project
working-directory: ${{ matrix.package }}
run: |
pip install . --find-links https://test.pypi.org/simple/dvp-api/
- name: Test ${{ matrix.package }} project with pytest
working-directory: ${{ matrix.package }}
run: |
python -m pytest src/test/python
lint:
name: Lint ${{ matrix.package }}

runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
package: [tools]

steps:
- name: Checkout ${{ matrix.package }}
uses: actions/checkout@v1

- name: Set up Python 2.7
uses: actions/setup-python@v1
with:
python-version: 2.7

- name: Install flake8
run: |
python -m pip install --upgrade pip
pip install flake8
- name: Run flake8 on src directory
working-directory: ${{ matrix.package }}
run: python -m flake8 src/main/python --max-line-length 88

- name: Run flake8 on test directory
working-directory: ${{ matrix.package }}
run: python -m flake8 test/main/python --max-line-length 88

#format:
#name: Check format ${{ matrix.package}}

#runs-on: ubuntu-latest
#strategy:
#max-parallel: 4
#matrix:
#package: [common, libs, platform, tools]

#steps:
#- uses: actions/checkout@v1

#- name: Check src format
#uses: lgeiger/[email protected]
#with:
#args: "${{ matrix.package }}/src/main/python -t py27 --check"

#- name: Check test format
#uses: lgeiger/[email protected]
#with:
#args: "${{ matrix.package }}/src/test/python -t py27 --check"
2 changes: 1 addition & 1 deletion common/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
PYTHON_SRC = 'src/main/python'

install_requires = [
"dvp-api == 1.1.0-master-003",
"dvp-api == 1.1.0.dev3",
]

with open(os.path.join(PYTHON_SRC, 'dlpx/virtualization/common/VERSION')) as version_file:
Expand Down
2 changes: 1 addition & 1 deletion libs/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
version = version_file.read().strip()

install_requires = [
"dvp-api == 1.1.0-master-003",
"dvp-api == 1.1.0.dev3",
"dvp-common == {}".format(version)
]

Expand Down
2 changes: 1 addition & 1 deletion platform/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
version = version_file.read().strip()

install_requires = [
"dvp-api == 1.1.0-master-003",
"dvp-api == 1.1.0.dev3",
"dvp-common == {}".format(version),
"enum34;python_version < '3.4'",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def virtual_source(connection, mount):
virtual_source.guid = TEST_GUID
virtual_source.connection.CopyFrom(connection)
virtual_source.parameters.json = TEST_VIRTUAL_SOURCE_JSON
virtual_source.mounts.MergeFrom([mount])
virtual_source.mounts.extend([mount])
return virtual_source

@staticmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_get_engine_api_version_json():
@staticmethod
def test_get_internal_package_root():
assert package_util.get_internal_package_root().endswith(
'main/python/dlpx/virtualization/_internal')
'dlpx/virtualization/_internal')

@staticmethod
@pytest.mark.parametrize('version_string', [
Expand Down

0 comments on commit 2c73c64

Please sign in to comment.