|
1 |
| -name: Pre-commit actions for Delphix Virtualization SDK |
| 1 | +# |
| 2 | +# Copyright (c) 2020, 2022 by Delphix. All rights reserved. |
| 3 | +# |
2 | 4 |
|
3 |
| -on: [pull_request] |
| 5 | +name: "Pre-commit actions for Delphix Virtualization SDK" |
4 | 6 |
|
5 |
| -jobs: |
6 |
| - pytest27: |
7 |
| - name: Test ${{ matrix.package }} on ${{ matrix.os }} using pytest (Python 2.7) |
8 |
| - runs-on: ${{ matrix.os }} |
9 |
| - strategy: |
10 |
| - max-parallel: 4 |
11 |
| - matrix: |
12 |
| - python-version: [2.7] |
13 |
| - os: [ubuntu-latest, macos-10.15, windows-latest] |
14 |
| - package: [common, libs, platform] |
15 |
| - |
16 |
| - steps: |
17 |
| - - name: Checkout ${{ matrix.package }} project |
18 |
| - uses: actions/checkout@v3 |
19 |
| - |
20 |
| - - name: Set up Python ${{ matrix.python-version }} |
21 |
| - uses: actions/setup-python@v3 |
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 |
| 7 | +on: |
| 8 | + # It is important to check the commits done to master, develop and release branches only. |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - master |
| 12 | + - develop |
| 13 | + - release |
40 | 14 |
|
| 15 | +jobs: |
41 | 16 | pytest38:
|
42 | 17 | name: Test ${{ matrix.package }} on ${{ matrix.os }} using pytest (Python 3.8)
|
43 | 18 | runs-on: ${{ matrix.os }}
|
44 | 19 | strategy:
|
45 | 20 | max-parallel: 4
|
46 | 21 | matrix:
|
47 |
| - python-version: [3.8] |
48 |
| - os: [ubuntu-latest, macos-latest, windows-latest] |
49 |
| - package: [common, libs, platform, tools] |
50 |
| - |
51 |
| - steps: |
52 |
| - - name: Checkout ${{ matrix.package }} project |
53 |
| - uses: actions/checkout@v1 |
54 |
| - |
55 |
| - - name: Set up Python ${{ matrix.python-version }} |
56 |
| - uses: actions/setup-python@v1 |
57 |
| - with: |
58 |
| - python-version: ${{ matrix.python-version }} |
59 |
| - |
60 |
| - - name: Install ${{ matrix.package }} dependencies |
61 |
| - working-directory: ${{ matrix.package }} |
62 |
| - run: | |
63 |
| - python -m pip install --upgrade pip |
64 |
| - pip install -r requirements.txt --find-links https://test.pypi.org/simple/dvp-api/ |
65 |
| -
|
66 |
| - - name: Install ${{ matrix.package }} project |
67 |
| - working-directory: ${{ matrix.package }} |
68 |
| - run: | |
69 |
| - pip install . --find-links https://test.pypi.org/simple/dvp-api/ |
70 |
| -
|
71 |
| - - name: Test ${{ matrix.package }} project with pytest |
72 |
| - working-directory: ${{ matrix.package }} |
73 |
| - run: | |
74 |
| - python -m pytest src/test/python |
75 |
| -
|
76 |
| - lintpython27: |
77 |
| - name: Lint ${{ matrix.package }} - Python27 |
78 |
| - |
79 |
| - runs-on: ubuntu-latest |
80 |
| - strategy: |
81 |
| - max-parallel: 4 |
82 |
| - matrix: |
83 |
| - package: [common, libs, platform] |
| 22 | + python-version: [ 3.8 ] |
| 23 | + os: [ ubuntu-latest, macos-latest, windows-latest ] |
| 24 | + package: [ common, libs, platform, tools ] |
84 | 25 |
|
85 | 26 | steps:
|
86 |
| - - name: Checkout ${{ matrix.package }} |
87 |
| - uses: actions/checkout@v1 |
| 27 | + - name: Checkout ${{ matrix.package }} project |
| 28 | + uses: actions/checkout@v3 |
88 | 29 |
|
89 |
| - - name: Set up Python 2.7 |
90 |
| - uses: actions/setup-python@v1 |
| 30 | + - name: Set up Python ${{ matrix.python-version }} |
| 31 | + uses: actions/setup-python@v4 |
91 | 32 | with:
|
92 |
| - python-version: 2.7 |
| 33 | + python-version: ${{ matrix.python-version }} |
93 | 34 |
|
94 |
| - - name: Install flake8 |
| 35 | + - name: Install ${{ matrix.package }} dependencies |
| 36 | + working-directory: ${{ matrix.package }} |
95 | 37 | run: |
|
96 | 38 | python -m pip install --upgrade pip
|
97 |
| - pip install flake8 |
| 39 | + pip install -r requirements.txt --find-links https://test.pypi.org/simple/dvp-api/ |
98 | 40 |
|
99 |
| - - name: Run flake8 on src directory |
| 41 | + - name: Install ${{ matrix.package }} project |
100 | 42 | working-directory: ${{ matrix.package }}
|
101 |
| - run: python -m flake8 src/main/python --max-line-length 88 |
| 43 | + run: | |
| 44 | + pip install . --find-links https://test.pypi.org/simple/dvp-api/ |
102 | 45 |
|
103 |
| - - name: Run flake8 on test directory |
| 46 | + # Run all the test cases part of the package. |
| 47 | + - name: Test ${{ matrix.package }} project with pytest |
104 | 48 | working-directory: ${{ matrix.package }}
|
105 |
| - run: python -m flake8 src/test/python --max-line-length 88 |
106 |
| - |
107 |
| - lintpython38: |
108 |
| - name: Lint ${{ matrix.package }} - Python38 |
109 |
| - |
110 |
| - runs-on: ubuntu-latest |
111 |
| - strategy: |
112 |
| - max-parallel: 4 |
113 |
| - matrix: |
114 |
| - package: [common, libs, platform, tools] |
115 |
| - |
116 |
| - steps: |
117 |
| - - name: Checkout ${{ matrix.package }} |
118 |
| - uses: actions/checkout@v1 |
119 |
| - |
120 |
| - - name: Set up Python 3.8 |
121 |
| - uses: actions/setup-python@v1 |
122 |
| - with: |
123 |
| - python-version: 3.8 |
| 49 | + run: | |
| 50 | + python -m pytest src/test/python |
124 | 51 |
|
| 52 | + # Install flake8 and run linting on src and test for linting if OS is ubuntu. |
125 | 53 | - name: Install flake8
|
| 54 | + if: ${{ matrix.os == 'ubuntu-latest' }} |
126 | 55 | run: |
|
127 |
| - python -m pip install --upgrade pip |
128 | 56 | pip install flake8
|
129 | 57 |
|
130 | 58 | - name: Run flake8 on src directory
|
| 59 | + if: ${{ matrix.os == 'ubuntu-latest' }} |
131 | 60 | working-directory: ${{ matrix.package }}
|
132 | 61 | run: python -m flake8 src/main/python --max-line-length 88
|
133 | 62 |
|
134 | 63 | - name: Run flake8 on test directory
|
| 64 | + if: ${{ matrix.os == 'ubuntu-latest' }} |
135 | 65 | working-directory: ${{ matrix.package }}
|
136 | 66 | run: python -m flake8 src/test/python --max-line-length 88
|
137 |
| - |
138 |
| - #format: |
139 |
| - #name: Check format ${{ matrix.package}} |
140 |
| - |
141 |
| - #runs-on: ubuntu-latest |
142 |
| - #strategy: |
143 |
| - #max-parallel: 4 |
144 |
| - #matrix: |
145 |
| - #package: [common, libs, platform, tools] |
146 |
| - |
147 |
| - #steps: |
148 |
| - #- uses: actions/checkout@v1 |
149 |
| - |
150 |
| - #- name: Check src format |
151 |
| - #uses: lgeiger/black-action@v1.0.1 |
152 |
| - #with: |
153 |
| - #args: "${{ matrix.package }}/src/main/python -t py27 --check" |
154 |
| - |
155 |
| - #- name: Check test format |
156 |
| - #uses: lgeiger/black-action@v1.0.1 |
157 |
| - #with: |
158 |
| - #args: "${{ matrix.package }}/src/test/python -t py27 --check" |
0 commit comments