-
Notifications
You must be signed in to change notification settings - Fork 15
229 lines (196 loc) · 8.02 KB
/
TestOnPR.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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
name: "PR Checks"
on:
pull_request:
branches:
- dev
- main
- 'releases/**'
paths-ignore:
- 'debian/changelog'
jobs:
Lint-Project:
timeout-minutes: 30
name: "Linting checks"
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: install static-checks-requirements
run: |
python3 -m pip install pip --upgrade
python3 -m pip install pyopenssl --upgrade
python3 -m pip install docker-compose yamllint
- name: Yamllint
uses: karancode/yamllint-github-action@master
with:
yamllint_file_or_dir: docker-compose.yml docker-compose-nvidia.yml docker-compose-host.yml docker-compose-nvidia-host.yml
yamllint_strict: false
yamllint_comment: true
yamllint_config_filepath: .yamllint-config.yml
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: run docker-compose lint
run: |
docker-compose -f docker-compose.yml config
docker-compose -f docker-compose-host.yml config
docker-compose -f docker-compose-nvidia.yml config
docker-compose -f docker-compose-nvidia-host.yml config
# - name: Validate json
# uses: anyone-developer/anyone-validate-json@main
# with:
# file-extension: '.json'
# ignore-files: ''
# ignore-directories: '.git'
# read-path: 'robots'
Test-Project:
timeout-minutes: 30
name: "Cluster sanity checks"
runs-on: ubuntu-20.04
needs: [ Lint-Project ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: install requirements
run: |
python3 -m pip install pip --upgrade
python3 -m pip install pyopenssl --upgrade
python3 -m pip install docker-compose
- name: prepare docker-compose cluster
run: |
mkdir -p ./{logs,shared,userspace,models_database} || true
sudo chown 1000:1000 ./{logs,shared,userspace,models_database} -R
- name: run docker-compose cluster
uses: isbang/compose-action@v2.0.0
with:
compose-file: './docker-compose.yml'
down-flags: '--volumes'
- name: test cluster frontend
run: |
export base_url="http://localhost:8080"
export token_url="$base_url/token-auth/"
export authenticated_url="$base_url/api/v1/User/movai/?"
# retry for 1 minute
count=10
set +e
for i in $(seq $count); do
status_code=$(curl -k -s -o /dev/null --cookie-jar cookies --header 'Content-Type: application/json' -X POST --data '{"username":"movai","password":"movai","remember":true}' -w "%{http_code}" $token_url)
if [ $status_code == 200 ]; then
break
fi
echo "Waiting for MOV.AI Flow™ availability (ret:$status_code)"
sleep 10
done
[ $status_code == 200 ] || exit -1
err_status_code=$(curl "$authenticated_url" -k -s -o /dev/null -w "%{http_code}")
[ $err_status_code == 401 ] || exit -1
json_token=$(curl -k -s --cookie-jar cookies --header 'Content-Type: application/json' -X POST --data '{"username":"movai","password":"movai","remember":true}' $token_url)
token=$( jq -r ".access_token" <<<"$json_token" )
ok_status_code=$(curl "$authenticated_url" -k -s -o /dev/null -H "Authorization: Bearer $token" -w "%{http_code}")
[ $ok_status_code == 200 ] || exit -1
Test-Project-HostMode:
timeout-minutes: 30
name: "Host Mode Cluster checks"
runs-on: ubuntu-20.04
needs: [ Lint-Project ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: install requirements
run: |
python3 -m pip install pip --upgrade
python3 -m pip install pyopenssl --upgrade
python3 -m pip install docker-compose
- name: prepare docker-compose cluster
run: |
mkdir -p ./{logs,shared,userspace,models_database} || true
sudo chown 1000:1000 ./{logs,shared,userspace,models_database} -R
- name: run docker-compose cluster in host mode
uses: isbang/compose-action@v2.0.0
with:
compose-file: './docker-compose-host.yml'
down-flags: '--volumes'
- name: test cluster frontend in host mode
run: |
export base_url="http://localhost:8080"
export token_url="$base_url/token-auth/"
export authenticated_url="$base_url/api/v1/User/movai/?"
# retry for 1 minute
count=10
set +e
for i in $(seq $count); do
status_code=$(curl -k -s -o /dev/null --cookie-jar cookies --header 'Content-Type: application/json' -X POST --data '{"username":"movai","password":"movai","remember":true}' -w "%{http_code}" $token_url)
if [ $status_code == 200 ]; then
break
fi
echo "Waiting for MOV.AI Flow™ availability (ret:$status_code)"
sleep 10
done
[ $status_code == 200 ] || exit -1
err_status_code=$(curl "$authenticated_url" -k -s -o /dev/null -w "%{http_code}")
[ $err_status_code == 401 ] || exit -1
json_token=$(curl -k -s --cookie-jar cookies --header 'Content-Type: application/json' -X POST --data '{"username":"movai","password":"movai","remember":true}' $token_url)
token=$( jq -r ".access_token" <<<"$json_token" )
ok_status_code=$(curl "$authenticated_url" -k -s -o /dev/null -H "Authorization: Bearer $token" -w "%{http_code}")
[ $ok_status_code == 200 ] || exit -1
Pack-Project:
timeout-minutes: 30
name: "Pack Checks"
runs-on: ubuntu-20.04
needs: [ Lint-Project ]
container:
image: registry.cloud.mov.ai/qa/ros-buildtools-noetic:v2.0.3
options: --user root
credentials:
username: ${{secrets.PORTUS_APP_USER}}
password: ${{secrets.PORTUS_APP_TOKEN}}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Find Package details
id: vars
run: |
PACKAGE_VERSION=$(dpkg-parsechangelog --show-field Version)
PACKAGE_NAME=$(dpkg-parsechangelog --show-field Source)
echo ::set-output name=pkg_name::$PACKAGE_NAME
echo ::set-output name=pkg_version::$PACKAGE_VERSION
- name: Raise Version
id: vars-after-raise
run: |
PACKAGE_VERSION=${{ steps.vars.outputs.pkg_version }}
main_version=${PACKAGE_VERSION%-*}
build_id="${PACKAGE_VERSION#*-}"
raised_buildid=$(($build_id+1))
RAISED_PACKAGE_VERSION="$main_version-$raised_buildid"
echo ::set-output name=pkg_version::$RAISED_PACKAGE_VERSION
- name: Pack debian
run: |
git config --global --add safe.directory $(pwd)
git config --global user.name '${{ secrets.RAISE_BOT_COMMIT_USER }}'
git config --global user.email '${{ secrets.RAISE_BOT_COMMIT_MAIL }}'
apt-get update
apt-get install -y devscripts equivs git-buildpackage
# Set the install command to be used by mk-build-deps (use --yes for non-interactive)
install_tool="apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes"
# Install build dependencies automatically
mk-build-deps --install --tool="${install_tool}" debian/control
# Add version into changelog and commit it
gbp dch --ignore-branch -N ${{ steps.vars-after-raise.outputs.pkg_version }} -c
# Build .deb with binaries only
dpkg-buildpackage -b --unsigned-source --unsigned-changes
# Store generated .deb
mkdir artifacts && \
cp ../*.deb artifacts
- name: Publish to Nexus ppa-dev
run: |
NEXUS_ENDPOINT="artifacts.cloud.mov.ai"
NEXUS_REPO="ppa-dev"
FILE_LOCATION=$(find artifacts/*.deb)
curl -u "${{ secrets.NEXUS_PUBLISHER_USR }}:${{ secrets.NEXUS_PUBLISHER_PWD }}" \
-H "Content-Type: multipart/form-data" \
--data-binary "@$FILE_LOCATION" \
"https://$NEXUS_ENDPOINT/repository/$NEXUS_REPO/"
- name: Store artifacts
uses: actions/upload-artifact@v3
with:
name: packages
path: artifacts/*