forked from apache/submarine
-
Notifications
You must be signed in to change notification settings - Fork 0
185 lines (178 loc) · 7 KB
/
python.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: python-sdk
# Trigger the workflow on push or pull request
on: [push, pull_request]
env:
KUBERNETES_VERSION: "v1.25.3"
jobs:
check-style:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install -r ./dev-support/style-check/python/lint-requirements.txt
pip install -r ./dev-support/style-check/python/mypy-requirements.txt
- name: List installed packages
run: pip list
- name: Check python sdk code style
run: ./dev-support/style-check/python/lint.sh
unit:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
tf-version: ['2.12.0', '2.13.0', '2.14.0']
exclude:
# Support for Python 3.8 has been removed starting with TF 2.14.
- python-version: '3.8'
tf-version: '2.14.0'
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Setup python environment
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install requirements
run: |
pip install --upgrade pip setuptools wheel
pip install -r ./submarine-sdk/pysubmarine/github-actions/test-requirements.txt
- name: Install pysubmarine with tf2 and pytorch
run: |
sed -i "s/tensorflow>=2.12.0,<2.15.0/tensorflow~=${{ matrix.tf-version }}/" ./submarine-sdk/pysubmarine/setup.py
sed -i "s/tensorflow-estimator>=2.12.0,<2.15.0/tensorflow-estimator~=${{ matrix.tf-version }}/" ./submarine-sdk/pysubmarine/setup.py
pip install --no-cache-dir -e ./submarine-sdk/pysubmarine/.[tf2,pytorch]
- name: List installed packages
run: pip list && pipdeptree
- name: Run unit test
working-directory: ./submarine-sdk/pysubmarine
run: pytest -m "not e2e" --cov-report xml
- uses: codecov/codecov-action@v3
with:
flags: python-unit
files: ./submarine-sdk/pysubmarine/coverage.xml
name: codecov-unit
integration:
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
tf-version: ['2.12.0', '2.13.0', '2.14.0']
exclude:
- python-version: '3.8'
tf-version: '2.14.0'
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Free Disk Space
run: bash ./.github/scripts/free-disk-space.sh
- name: Setup python environment
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install tf2 dependencies
run: |
pip install --upgrade pip setuptools wheel
sed -i "s/tensorflow>=2.12.0,<2.15.0/tensorflow~=${{ matrix.tf-version }}/" ./submarine-sdk/pysubmarine/setup.py
sed -i "s/tensorflow-estimator>=2.12.0,<2.15.0/tensorflow-estimator~=${{ matrix.tf-version }}/" ./submarine-sdk/pysubmarine/setup.py
pip install --no-cache-dir -e ./submarine-sdk/pysubmarine/.[tf2,pytorch]
pip install -r ./submarine-sdk/pysubmarine/github-actions/test-requirements.txt
pip cache purge
- name: List installed packages
run: pip list
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: "11"
- name: Set up Maven 3.6.3
uses: stCarolas/setup-maven@v4
with:
maven-version: 3.6.3
- name: Check version
run: |
mvn --version
java -version
- name: Create kind cluster
run: kind create cluster --config ./.github/config/kind-config-kind.yaml --wait 3m --image kindest/node:${KUBERNETES_VERSION}
- name: Download Istio 1.17.1
run: |
curl -L https://istio.io/downloadIstio | ISTIO_VERSION=1.17.1 sh -
cd istio-1.17.1
echo "$PWD/bin" >> $GITHUB_PATH
- name: Install Istio
run: istioctl install -y --set values.global.proxy.resources.requests.cpu=10m
- name: Show K8s cluster information
run: |
kubectl cluster-info
kubectl version
kubectl get pods -n kube-system
echo "current-context:" $(kubectl config current-context)
echo "environment-kubeconfig:" ${KUBECONFIG}
# Cache maven (for submarine server)
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build Image locally
run:
.github/scripts/build-image-locally-v3.sh
mvn clean
- name: Start submarine
run: bash ./.github/scripts/start-submarine.sh
- name: Set CLI config for e2e pytest
run: |
submarine config set connection.hostname localhost
submarine config set connection.port 8080
submarine config list
- name: Run integration test
working-directory: ./submarine-sdk/pysubmarine
run: pytest -m "e2e" --cov-report xml
- uses: codecov/codecov-action@v3
with:
flags: python-integration
files: ./submarine-sdk/pysubmarine/coverage.xml
name: codecov-integration
- name: Failure status
run: |
kubectl describe nodes
kubectl get pods
kubectl -n default get events --sort-by='{.lastTimestamp}'
if: ${{ failure() }}
sonarcloud:
if: github.repository == 'apache/submarine' && github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
with:
projectBaseDir: submarine-sdk/pysubmarine
args: >
-Dsonar.organization=apache
-Dsonar.projectKey=apache_submarine_python_sdk
-Dsonar.python.version=3.8,3.9,3.10,3.11