Skip to content

Commit 2c73c64

Browse files
Fixes PYT-900 : Initial migration: Write pre commit action (#4)
Github Action for pre-commit validations on the Delphix Virtualization SDK repo.
1 parent 01c3404 commit 2c73c64

File tree

6 files changed

+97
-5
lines changed

6 files changed

+97
-5
lines changed

.github/workflows/pre-commit.yml

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Pre-commit actions for Delphix Virtualization SDK
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
pytest:
7+
name: Test ${{ matrix.package }} on ${{ matrix.os }} using pytest
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
max-parallel: 4
11+
matrix:
12+
python-version: [2.7]
13+
os: [ubuntu-latest, macos-latest]
14+
package: [common, libs, platform, tools]
15+
16+
steps:
17+
- name: Checkout ${{ matrix.package }} project
18+
uses: actions/checkout@v1
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v1
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install ${{ matrix.package }} dependencies
26+
working-directory: ${{ matrix.package }}
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install -r requirements.txt --find-links https://test.pypi.org/simple/dvp-api/
30+
31+
- name: Install ${{ matrix.package }} project
32+
working-directory: ${{ matrix.package }}
33+
run: |
34+
pip install . --find-links https://test.pypi.org/simple/dvp-api/
35+
36+
- name: Test ${{ matrix.package }} project with pytest
37+
working-directory: ${{ matrix.package }}
38+
run: |
39+
python -m pytest src/test/python
40+
41+
lint:
42+
name: Lint ${{ matrix.package }}
43+
44+
runs-on: ubuntu-latest
45+
strategy:
46+
max-parallel: 4
47+
matrix:
48+
package: [tools]
49+
50+
steps:
51+
- name: Checkout ${{ matrix.package }}
52+
uses: actions/checkout@v1
53+
54+
- name: Set up Python 2.7
55+
uses: actions/setup-python@v1
56+
with:
57+
python-version: 2.7
58+
59+
- name: Install flake8
60+
run: |
61+
python -m pip install --upgrade pip
62+
pip install flake8
63+
64+
- name: Run flake8 on src directory
65+
working-directory: ${{ matrix.package }}
66+
run: python -m flake8 src/main/python --max-line-length 88
67+
68+
- name: Run flake8 on test directory
69+
working-directory: ${{ matrix.package }}
70+
run: python -m flake8 test/main/python --max-line-length 88
71+
72+
#format:
73+
#name: Check format ${{ matrix.package}}
74+
75+
#runs-on: ubuntu-latest
76+
#strategy:
77+
#max-parallel: 4
78+
#matrix:
79+
#package: [common, libs, platform, tools]
80+
81+
#steps:
82+
#- uses: actions/checkout@v1
83+
84+
#- name: Check src format
85+
#uses: lgeiger/[email protected]
86+
#with:
87+
#args: "${{ matrix.package }}/src/main/python -t py27 --check"
88+
89+
#- name: Check test format
90+
#uses: lgeiger/[email protected]
91+
#with:
92+
#args: "${{ matrix.package }}/src/test/python -t py27 --check"

common/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
PYTHON_SRC = 'src/main/python'
55

66
install_requires = [
7-
"dvp-api == 1.1.0-master-003",
7+
"dvp-api == 1.1.0.dev3",
88
]
99

1010
with open(os.path.join(PYTHON_SRC, 'dlpx/virtualization/common/VERSION')) as version_file:

libs/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
version = version_file.read().strip()
88

99
install_requires = [
10-
"dvp-api == 1.1.0-master-003",
10+
"dvp-api == 1.1.0.dev3",
1111
"dvp-common == {}".format(version)
1212
]
1313

platform/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
version = version_file.read().strip()
88

99
install_requires = [
10-
"dvp-api == 1.1.0-master-003",
10+
"dvp-api == 1.1.0.dev3",
1111
"dvp-common == {}".format(version),
1212
"enum34;python_version < '3.4'",
1313
]

platform/src/test/python/dlpx/virtualization/test_plugin.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def virtual_source(connection, mount):
284284
virtual_source.guid = TEST_GUID
285285
virtual_source.connection.CopyFrom(connection)
286286
virtual_source.parameters.json = TEST_VIRTUAL_SOURCE_JSON
287-
virtual_source.mounts.MergeFrom([mount])
287+
virtual_source.mounts.extend([mount])
288288
return virtual_source
289289

290290
@staticmethod

tools/src/test/python/dlpx/virtualization/_internal/test_package_util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_get_engine_api_version_json():
4343
@staticmethod
4444
def test_get_internal_package_root():
4545
assert package_util.get_internal_package_root().endswith(
46-
'main/python/dlpx/virtualization/_internal')
46+
'dlpx/virtualization/_internal')
4747

4848
@staticmethod
4949
@pytest.mark.parametrize('version_string', [

0 commit comments

Comments
 (0)